In the previous article, Cloudify & Jenkins, I introduced Jenkins’ plugin for Cloudify — a plugin that provides Jenkins job/pipeline authors with a Jenkins-centric way to interact with Cloudify.
In this article, I will introduce Cloudify’s integration with two major players in the CI/CD landscape: CircleCI and GitHub Actions.
Common Interface
One central factor in our design is to keep the interface to CI/CD authors as consistent as possible across CI/CD products. We managed to achieve this by constructing a simple Docker image, containing everything required to connect to a Cloudify Manager instance.
In addition, the Docker image contains a special script (called cfyci
) that wraps calls to the Cloudify CLI, providing a more streamlined interface to CI/CD products. (It is expected that this wrapper functionality will be embedded with the Cloudify CLI in an upcoming release)
Both CircleCI and GitHub Actions support running commands in Docker containers. The same CI/CD Docker image is used by both products.
You can check out our Docker image on Docker Hub.
Functions
As of this writing, Cloudify’s CI/CD Docker image provides the following functions:
- All standard CLI functions (by using the
cfy
entrypoint) - Enhanced functions for CI/CD products (by using the
cfyci
entrypoint)
The enhanced functions include:
- Kubernetes integration
- Terraform integration
- Azure ARM integration
- AWS CloudFormation integration
- Simplified method of creating an environment by uploading a blueprint, creating a Cloudify deployment and installing it, in one command
- Simplified method of deleting an environment by uninstalling it and then deleting the Cloudify deployment.
Specifying Cloudify Manager Location
To specify Cloudify Manager’s location and credentials, you can use environment variables: CLOUDIFY_HOST
, CLOUDIFY_USERNAME
, CLOUDIFY_PASSWORD
, CLOUDIFY_TENANT
and CLOUDIFY_SSL
. Typically, you would define these environment variables at your CI/CD project’s settings, so they apply to all Cloudify invocations within that project.
- In CircleCI, head to “Project Settings”, then “Environment Variables”, and set your environment variables there. Alternatively, if you have multiple projects that require similar environment variables, you can create a CircleCI context and define environment variables there. Then, you would associate your projects with that context.
- With GitHub Actions, you can define environment variables at the workflow level, job level and step level. A common technique is to store values as GitHub Secrets, and refer to them when defining environment variables, such as:
jobs:
<job definitions>
env:
CLOUDIFY_HOST: ${{ secrets.CLOUDIFY_HOST }}
CLOUDIFY_USERNAME: ${{ secrets.CLOUDIFY_USERNAME }}
CLOUDIFY_PASSWORD: ${{ secrets.CLOUDIFY_PASSWORD }}
CLOUDIFY_SSL: ${{ secrets.CLOUDIFY_SSL }}
CLOUDIFY_SSL_TRUST_ALL: ${{ secrets.CLOUDIFY_SSL_TRUST_ALL }}
CircleCI
CircleCI provides vendors with the ability to package functionality in the form of an Orb. In CircleCI, workflow definitions import Orbs and then use functionality provided by that Orb.
Cloudify’s Orb name is cloudify/cfy
, and you can read about it in CircleCI’s Orb reference site.
You can also see a full example here.
GitHub Actions
Cloudify provides a set of GitHub Actions, each one encapsulates a single Cloudify function. From within your GitHub CI/CD configuration, you point to Cloudify GitHub Actions to carry out Cloudify commands.
You can query GitHub’s Actions Marketplace for Cloudify actions.
You can also see a full example here.
Conclusion
Cloudify’s Docker image for CI/CD platforms allows Cloudify users to interact with Cloudify through pipelines using the platform’s native interface, relieving you from the need to maintain lengthy command-line invocations, scripts and curl
commands.
Together with Cloudify’s integration with provisioners such as Kubernetes, Azure ARM and Terraform, Cloudify becomes a one-stop shop for resource provisioning through CI/CD platforms, allowing you to focus more on your technology stack and less on provisioning products’ installations and configurations.
Our CI/CD integration is sufficiently versatile to adapt to any CI/CD platform that supports Docker. Stay tuned for future integrations with additional CI/CD platforms!