Resolution
Here is an example that replaces occurrences of oldvalue
with newvalue
in job test
.
#!/usr/bin/python from jenkinsapi.jenkins import Jenkins if __name__ == '__main__': jenkins = 'https://localhost:8080/' server = Jenkins(jenkins, username = 'admin', password = 'admin') job = server.get_job('test') config=job.get_config() new = config.replace('oldvalue', 'newvalue') job.update_config(new)
Obviously, replace:
-
username = 'admin', password = 'admin'
with your username and password -
https://localhost:8080/
with your Jenkins URL -
test
with your job name
See Remote Access API and JenkinsAPI for more.