Plugin for integrating Jenkins with Rancher using pipeline scripts.
You can learn more on the Rancher/
Jenkins version 2.11 or newer is required.
Rancher API v2-beta
- Navigate to your Jenkins instance
- Select "Manage Jenkins" from the Jenkins sidebar
- Click "Configure System" link
- Search "Rancher API Keys"
- Click "Add"
- Enter "Rancher Configuration". See image.
- Name: A name for your configutation. Ex: BASIS
- Rancher URL: API endpoint
- Access Key: Rancher access key
- Private Key: Rancher secret key
- Click "Save" for apply configuration
- Create a new pipeline project
- Example pipeline definition:
stage('Calling Rancher API'){
rancher
.config('BASIS') //Name you defined into Rancher Configuration
.service() // Rancher Service API
.upgrade("RANCHER ENVIRONMENT NAME", "RANCHER STACK NAME","RANCHER SERVICE NAME");
// .upgrade("PRODUCTION", "SYSTEM","SERVER");
//you can define a timeout in millis - Default 40000
//.upgrade("RANCHER ENVIRONMENT NAME", "RANCHER STACK NAME","RANCHER SERVICE NAME",100000);
}