Note: This plugin only support Rancher1
Enables Jenkins to deploy or upgrade Rancher stack service instance
Rancher is an open source software platform that enables organizations to run containers in production. With Rancher, organizations no longer have to build a container services platform from scratch using a distinct set of open source technologies. Rancher supplies the entire software stack needed to manage containers in production.
You can learn more on the Rancher Website
- Deploy docker image to Rancher
- Upgrade exist service instance in Rancher
- Support options to finish the upgrade automatically
- Support build environment variable as docker image tag, e.q. busybox:${BUILD_NUMBER}
- provision rancher stack with docker-compose and rancher-compose file
Jenkins Rancher Plugin Support Deploy or Upgrade Service Instance in Rancher.
Jenkins version 2.11 or newer is required.
Rancher version 1.2.2 or newer is required.
Install this plugin via the Jenkins plugin manager. Or Download the latest version of plugin from [releases][https://github.com/jenkinsci/rancher-plugin/releases].
- To enable access to your rancher server, you must create a account api key:
- Siigin in to rancher server dashboard
- Select Menu → API
- Click "Add Account API Key"
- Give the api key any name and description you like, e.g "Jenkins"
- Click the "Create Key"
- Save the "Access Key" and "Secret Key" any way you like, we will use it later
- You can now close the dialog
- Navigate to your Jenkins instance
- Select "Credentials" from the Jenkins sidebar
- Choose a credentials domain and click "Add Credentials"
- From the "Kind" drop-down, choose "Username with password"
- Enter a description for the credential — the actual value is not important
- Click "OK" to create the credential
Deploy or Upgrade Service Instance
- Create a new free-style project
- Ensure. via whatever build steps you need, that the Docker image you want to deploy to Rancher will be available in the docker registry
- Add "Deploy/Upgrade Rancher Service" post-build action
- Enter the target Rancher Service API endpoint, e.g 'http://rancher-server/v2-beta'
- Select the credential name from the drop-down list
- Enter the target rancher environment id, e.g '1a5558'
- Enter the target service name, e.g 'stack/service'
- Enter the docker image name, e.g 'busybox' (image name support current build environment variable like 'busybox:${BUILD_NUMBER}' to support dynamic image tag)
- Optionally choose "Auto Confirm" to finish the upgrade automatically
- Optionally choose "Public Ports" to export service ports. mutil port shoule be split be ",". e.g 8080:80,9191:91
- Optionally choose "Environment variables" to config service environment. mutil variable should be split by ",". e.g AAA:aaa,BBB:bbb (Note: The old environment of service will be merge)
- Optionally choose "Timeout" to config timeout seconds when wait rancher service status change.
For your convenience, this repository includes a docker-compose configuration
for running jenkins, rancher-server, and a rancher agent. It also includes a
bootstrapping script which will configure a Rancher service and Jenkins job
using the plugin from build/libs/rancher.hpi
. To use this test harness simply
run the following:
./gradlew jpi
cd test/
docker-compose up -d --build
Rancher, Jenkins, and an Echo Server will be run on ports 8080, 8081, and 8082 respectively. You can simply visit the jenkins web UI and run the "test" job to test the plugin.
- Initial release
- Fixed dependencies info missing issue.
- Preserves the log config while upgrading a service.
- Support export service ports.
- Support export environment variable.
- Support health check serialization.
- Support custom timeout, and build variable in all fields.
- Fixed issue of timeout logic.
- Fixed issues.
- Support start before stop options
- Fixed network config missing