Child pages
  • Jenkins Script Console
41 more child pages

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Show example of scriptText using python

...

If security is configured in Jenkins, then curl can be provided options to authenticate using the using the curl --user option option.

Code Block
languagebash
titlecurl submitting groovy file providing username and password via bash
curl --user 'username:password' --data-urlencode "script=$(< ./somescript.groovy)" https://jenkins/scriptText

Here is the equivalent command using python, not curl.

Code Block
languagepy
titlepython submitting groovy file providing username and password
    with open('somescript.groovy', 'r') as fd:
        data = fd.read()
    r = requests.post('https://jenkins/scriptText', auth=('username', 'password'), data={'script': data})

Remote access with CSRF protection enabled

...