Help with invoking scripts via CURL

22 views
Skip to first unread message

Naveen Srinivasan

unread,
Oct 8, 2016, 7:18:14 PM10/8/16
to Jenkins Developers
Hi, 

      I am trying to automate Jenkins fully using helm and kubernetes https://github.com/kubernetes/charts/tree/master/stable/jenkins . By doing this the admin password is available via kubernetes   secretes.  The goal is to automate bringing up jenkins without logging into the server manually. As part of that I would like to execute scripts pointing to jenkins server.


When I try to use admin with password 
curl --data-urlencode "script=$(<./test.groovy)" http://admin:cEunYtfPfP@http://192.168.99.100:31419/scriptText


I am getting an exception
hudson.security.AccessDeniedException2: anonymous is missing the Overall/Read permission
at hudson.security.ACL.checkPermission(ACL.java:65)
at hudson.model.Node.checkPermission(Node.java:464)
at jenkins.model.Jenkins.getTarget(Jenkins.java:4426)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:674)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)


 Where as If I login into the server and get the API token for admin then the same code works if i use the API token.
curl --data-urlencode "script=$(<./test.groovy)" http://admin:b8d84d283000b5ce...@192.168.99.100:31419/scriptText

What am I doing wrong? Is this possible?  Like I had mentioned I would like to use automate everything without ever logging into the server.

Thank you!
Naveen
 

Victor Martinez

unread,
Oct 9, 2016, 12:35:33 PM10/9/16
to Jenkins Developers
Please use the right mailing list for user questions, see the below mailing lists:


On Sunday, 9 October 2016 00:18:14 UTC+1, Naveen Srinivasan wrote:
Hi, 

      I am trying to automate Jenkins fully using helm and kubernetes https://github.com/kubernetes/charts/tree/master/stable/jenkins . By doing this the admin password is available via kubernetes   secretes.  The goal is to automate bringing up jenkins without logging into the server manually. As part of that I would like to execute scripts pointing to jenkins server.


When I try to use admin with password 
curl --data-urlencode "script=$(<./test.groovy)" http://admin:cEunYtfPfP@http://192.168.99.100:31419/scriptText


I am getting an exception
hudson.security.AccessDeniedException2: anonymous is missing the Overall/Read permission
at hudson.security.ACL.checkPermission(ACL.java:65)
at hudson.model.Node.checkPermission(Node.java:464)
at jenkins.model.Jenkins.getTarget(Jenkins.java:4426)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:674)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)


 Where as If I login into the server and get the API token for admin then the same code works if i use the API token.

What am I doing wrong? Is this possible?  Like I had mentioned I would like to use automate everything without ever logging into the server.

Thank you!
Naveen
 

Reply all
Reply to author
Forward
0 new messages