This pack creates a basic integration with Jenkins
To trigger events from Jenkins, use Jenkins to send a webhook to StackStorm.
Examples of rules can be found in the rules
directory.
Jenkins jobs are required to have the "parameterized" setting enabled in order for this pack to be able to start jobs.
Once the pack is installed, issue st2 pack config jenkins
command to enter url, username and password (if auth is enabled) of your primary Jenkins instance.
Copy the example configuration in jenkins.yaml.example
to /opt/stackstorm/configs/jenkins.yaml
and edit as required.
url
- FQDN to Jenkins API endpoint (e.x.: http://jenkins.mycompany.org:8080)username
- Jenkins Username (if auth is enabled)password
- Jenkins Password (if auth is enabled)
You can also use dynamic values from the datastore. See the docs for more info.
Note : Configuration can be overridden per each action execution. See below.
Note : When modifying the configuration in /opt/stackstorm/configs/
please
remember to tell StackStorm to load these new values by running
st2ctl reload --register-configs
Note : If your Jenkins server has a self-signed certificate and you get
certificate verify failed
Error, set PYTHONHTTPSVERIFY=0
in /etc/sysconfig/st2api
and /etc/sysconfig/st2actionrunner
.
Then reload st2api and st2actionrunner services with commands
st2ctl restart-component st2api
and st2ctl restart-component st2actionrunner
to apply the changes.
Note : As of v0.7.2 each action supports optional config_override
parameter to override url
, username
and password
configuration values. Pass it as an object, e.g. {"url": "http://someotherjenkinshost.example.com:8080", "username": "user1", "password": "somepassword"}
or {"url": "http://someotherjenkinshost.example.com:8080"}
if auth is not required.
build_job
- Kick off CI build based on project namebuild_job_enh
- Kick off CI build based on project name and wait for it to be executed (and optionally to complete), return build infolist_jobs
- List all jobsenable_job
- Enable Jenkins jobdisable_job
- Disable Jenkins jobget_job_info
- Retrieve Jenkins job informationget_job_params
- Retrieve Jenkins job params with default values and merge with the provided dict of params, if anyget_build_info
- Retrieve Jenkins build informationget_running_builds
- Retrieve all running Jenkins builds (possible to filter with regex by name)get_queue_info
- Retrieve queue information from the Jenkins instanceinstall_plugin
- Install pluginrebuild_last_job
- Rebuild last Jenkins joblist_jobs_regex
- List Jenkins job name by regex patternstop_build
- Stop a running Jenkins buildcancel_queued_build
- Cancel a queued buildset_build_logkeep
- Set build's LogKeep flag to true or false