Hey,

I want to trigger a build remotely with the command JENKINS_URL/job/
prestaging/build?token=TOKEN_NAME or /buildWithParameters?
token=TOKEN_NAME as described in http://LOCALHOST:8080/job/prestaging/configure
- Build Triggers - Triggers builds remotely (e.g. from scripts). This
works when I have no security enabled, resulting in enabling everybody
to trigger builds.

To prevent from that, I am using Jenkin's "Quick and Simple Security"
Feature as described in the wiki. Thus, in the defaults file I added
the "argumentsRealm.passwd.USER" and "argumentsRealm.roles.USER"
options and in the management console (http://HOST:8080/job/prestaging/
configure) I enabled security by checking the button and changing the
"Security Realm" to "Delegate to servlet container" and
"Authorization" to "Logged-in users can do anything". This works by
being able to logging in.

However, I could not figure out yet how one can trigger builds
remotely when security is enabled? I tried something like

curl -XGET 'http://HOST:8080/job/prestaging/buildWithParameters' -d '{
  "token": "TOKEN",
  "argumentsRealm" : {
    "passwd" : {
      "USER" : "PASSWORD"
    },
    "roles" : {
      "USER" : "admin"
    }
  }
}'

but this resulted in

<html><head><meta http-equiv='refresh' content='1;url=/loginEntry?from=
%2Fjob%2Fprestaging%2FbuildWithParameters'/
><script>window.location.replace('/loginEntry?from=%2Fjob%2Fprestaging
%2FbuildWithParameters');</script></head><body style='background-
color:white; color:white;'>Authentication required</body></html>

Thanks, for any help!

Stephan Fortelny

Reply via email to