Unable to get Remote build trigger working

928 views
Skip to first unread message

Vinoth raj

unread,
Mar 20, 2015, 1:38:16 AM3/20/15
to jenkin...@googlegroups.com
I know this post applies to user group but I haven't have found any response there.
I believe the developers will be prudent to spot my issue and propose a solution instantly.

I need to use curl to remotely trigger build for a project.

Jenkins ver. 1.580.3
Following setting is done:
In Configure Global Security section:
- Jenkins' own user database set is enabled
- Project based matrix authorization strategy is enabled
There is one user who has all rights enabled here.

Project settings:
Trigger builds remotely is enabled (gave token a value '123abc')
Also, API token for the user is retrieved from user configure page.

Tried different versions of post from curl. 

curl -user <username:apiToken> http://[jenkins:port]/job/projectname/build?token=123abc

I always get:
Authentication required
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read


Not sure what is causing this authentication fail. Please help!

Suckow, Thomas J

unread,
Mar 20, 2015, 11:03:40 AM3/20/15
to jenkin...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1f71a2fc-8ba9-4792-a6ab-56e79de2deef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vinoth raj

unread,
Mar 20, 2015, 11:33:59 AM3/20/15
to jenkin...@googlegroups.com
I have tried the following:
1.
curl -X POST http://jenkins/job/projectname/build --user username:apiToken --data token=tokenvalue
curl -X POST http://jenkins/job/projectname/build?token=tokenvalue --user username:apiToken

Result: Authentication required

2. 

wget --auth-no-challenge --http-user=username --http-password=apiToken http://jenkins/job/projectname/build?token=token
Result: 403 Forbidden

I am able to login with that specific user in browser without problem.
Have tried changing apitoken values also.

What could be missing? Please help!

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/O74r3I2Mm1Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/D1318489.1107F%25thomas.suckow%40pnnl.gov.

Vinoth raj

unread,
Mar 20, 2015, 12:17:31 PM3/20/15
to jenkin...@googlegroups.com
ALSO....

I enabled the Logged-in users can do anything.
This means that anonymous users do not have rights to build.

Strangely, the following triggers a build:
which I think it should not. Not sure what is happening.

If I enable Matrix-based or Project based Matrix strategy, I get authentication required as mentioned before. Please HELP!


On Fri, Mar 20, 2015 at 8:32 PM, Suckow, Thomas J <Thomas...@pnnl.gov> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/O74r3I2Mm1Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/D1318489.1107F%25thomas.suckow%40pnnl.gov.

Hiteswar

unread,
Mar 20, 2015, 8:16:33 PM3/20/15
to jenkin...@googlegroups.com
Add user credential in .netrc file at Jenkins $HOME 
And on enabling matrix bases strategy , add user for giving permission to build .

Then curl -x post Jenkins-build-url-with-token-value should work from user's computer script .

Regards
Hiteswar 

Daniel Beck

unread,
Mar 20, 2015, 8:24:33 PM3/20/15
to jenkin...@googlegroups.com

On 20.03.2015, at 17:17, Vinoth raj <vinot...@gmail.com> wrote:

> which I think it should not. Not sure what is happening.

The whole point of build trigger tokens is to allow building for users who usually would not be allowed to.

If you're allowed to trigger builds anyway, you don't need the token to begin with.

Vinoth raj

unread,
Mar 23, 2015, 2:59:09 AM3/23/15
to jenkin...@googlegroups.com
Seems like root cause of the problem is below:
- Jenkins runs in a local machine on port 8085
- Port forwarding has been setup in gateway
- One can access jenkins using http://gateway:8085 from outside
- Curl http api command succeeds if I use the local IP of the machine within the network
If I pass the curl command using http://gateway:8085 then I get authentication required message.

I am running jenkins as standalone application only.
How do I allow remote api request through http://gateway:8085?

I would appreciate some insight into this. Please help!

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/O74r3I2Mm1Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages