...
If security is configured in Jenkins, then curl can be provided options to authenticate using the using the curl --user
option option.
Code Block | ||||
---|---|---|---|---|
| ||||
curl --user 'username:password' --data-urlencode "script=$(< ./somescript.groovy)" https://jenkins/scriptText |
Here is the equivalent command using python, not curl.
Code Block | ||||
---|---|---|---|---|
| ||||
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
...