Use with Jenkins
Cycleops can be automated in a few steps to be part of your existing CI/CD system with Jenkins. All that is needed to integrate Jenkins actions is:
Requirements
- Jenkins installed on a server
- Python 3.11 or newer installed on the Jenkins server
- An API key for Cycleops
Instructions
- Create a new Freestyle project
- Add an Execute shell build step to install the Cycleops CLI:
pip install cycleops
- Add an Execute shell build step to update your Cycleops service with a new image:
export CYCLEOPS_API_KEY=<your_cycleops_api_key> cycleops services update-container <service_name> <container_name> --image <image_name>:<image_tag>
- Add an Execute shell build step to deploy your Cycleops setup:
export CYCLEOPS_API_KEY=<your_cycleops_api_key> cycleops setups deploy <setup_name>
The Cycleops CLI is open source with its documentation available at GitHub: https://github.com/stackmasters/cycleops.
Advanced
Use with Docker
You can use the Cycleops CLI via its Docker image (ghcr.io/stackmasters/cycleops
), instead of depending on Python. In order to do this, pass your Cycleops API key in the CYCLEOPS_API_KEY
environment variable, by using the -e
flag and CYCLEOPS_API_KEY
.
Example build step:
docker run -e CYCLEOPS_API_KEY=<your_cycleops_api_key> \
ghcr.io/stackmasters/cycleops \
cycleops services update-container <service_name> <container_name> --image <image_name>:<image_tag>
Credential bindings
Your Cycleops API key is sensitive and should be kept secret. For that reason, to further guard your system against attacks, it should be handled with a sensitive data manager like the Credential Binding Plugin. To set the value of your Cycleops API key in the Use secret text(s) or file(s)
environment variable, in the project configuration page:
- Go to the Build environment section
- Select Use secret text(s) or file(s)
- Click Add and then Secret text
- Fill in
CYCLEOPS_API_KEY
in the Variable field - Select Add and then Jenkins under Credentials
- Select the Global credentials (unrestricted) value under Domain
- Select Secret text under Kind
- Select the Global, under Scope
- Type the value of your Cycleops API key in Secret
- Type
cycleops-api-key
in ID - Click Add
Now you can use your Cycleops API key securely via the CYCLEOPS_API_KEY
environment variable.
Example with Cycleops CLI when installed with Python:
cycleops services update-container <service_name> <container_name> --image <image_name>:<image_tag>
Example with Cycleops CLI when used via Docker:
docker run -e CYCLEOPS_API_KEY=$CYCLEOPS_API_KEY \
ghcr.io/stackmasters/cycleops \
cycleops services update-container <service_name> <container_name> --image <image_name>:<image_tag>