Drone is a Continuous Integration platform that allows automation of build, test, and release workflows using a powerful, cloud-native pipeline engine.
You need to add your Cloudsmith API Key within Drone CI. We recommend storing your Cloudsmith API Key as a per-repository or per-organization secret in the Drone Server and then injecting the
CLOUDSMITH_API_KEY environment variable into your build jobs like:
environment: CLOUDSMITH_API_KEY: from_secret: CLOUDSMITH_API_KEY
In the following examples:
|OWNER||Your Cloudsmith account name or organisation name (namespace)|
|REPOSITORY||Your Cloudsmith Repository name (also called "slug")|
|FORMAT||The format of the package, i.e "deb", "maven", "npm" etc|
|PACKAGE_FILE||The filename of the package|
To push an artifact from a build step, you just need to add the commands to install the Cloudsmith CLI and use the
cloudsmith push command:
steps: - pip install cloudsmith-cli - cloudsmith push FORMAT OWNER/REPOSITORY/PACKAGE_FILE
Drone supports different types of pipelines, each optimized for different use cases and runtime environments.
For example, you can use a Docker pipeline with your own Docker image that includes the Cloudsmith CLI, negating the need to install the CLI in a Build Step. The following example configuration specifies a Docker image from a Cloudsmith repository:
steps: - name: Build and Push Package image: docker.cloudsmith.io/OWNER/REPOSITORY/IMAGE_NAME:latest environment: CLOUDSMITH_API_KEY: from_secret: CLOUDSMITH_API_KEY commands: - ....... - ....... - cloudsmith push FORMAT OWNER/REPOSITORY/PACKAGE_FILENAME image_pull_secrets: - dockerconfigjson
As the Docker image used for the pipeline in this example is hosted in a private Cloudsmith repository, you need to authenticate to the repository to pull the image for use. You can add the authentication credentials as a per-repository or per-organization secret in Drone CI. You can obtain these credentials from your
~/.docker/.config.json file after you do a normal
docker login to your Cloudsmith repository
You then use
image_pull_secrets, with the name of the secrets file you created in Drone CI to enable your pipeline to authenticate to your Cloudsmith repository.
The push command will vary with the package format, an example of the push command for a debian package would look like:
cloudsmith push deb my-org/my-repo/ubuntu/xenial foo-1.0.deb
Please see the Cloudsmith CLI for full details of the push command for other formats and additional help.
Updated 20 days ago