Semaphore CI

How to integrate Semaphore CI with Cloudsmith

5068

Semaphore is a hosted continuous integration and deployment service used for testing and deploying software projects hosted on GitHub and BitBucket.

You can create your workflow and pipelines by writing YAML configuration files and committing them along with your source code, or using the intuitive Visual Builder that Semaphore includes.

No Code Uploading

The Cloudsmith CLI gives you full control when connecting to any CI/CD process; allowing you to upload any of our support formats or query your repositories. Just configure your API Key, install the CLI, and you'll be all set.

In the following examples:

IdentifierDescription
OWNERYour Cloudsmith account name or organisation name (namespace)
REPOSITORYYour Cloudsmith Repository name (also called "slug")
FORMATThe format of the package, i.e "deb", "maven", "npm" etc
PACKAGE_FILEThe filename of the package

API Key Configuration

You need to add your Cloudsmith API Key in order to authenticate to Cloudsmith for pushing packages. We recommend storing your Cloudsmith API Key as a secret in Semaphore. Secrets in Semaphore are organization-level objects that can contain environment variables or files which you can then access in your build jobs.

You can add a secret using the Semaphore CLI or the UI:

566

Adding a Secret using the Semaphore UI

Push Package Example

To Push a package to Cloudsmith from a Semaphore CI Pipeline, you just need to add your Cloudsmith API Key secret and the cloudsmith push CLI command to one of the blocks in your pipeline

For example:

  - name: Push Package
    task:
      secrets:
        - name: Cloudsmith-API
      jobs:
        - name: Push
          commands:
            - cache restore package
            - cloudsmith push FORMAT OWNER/REPOSITORY/ PACKAGE_FILE
      prologue:
        commands:
          - sem-version python 3.7
          - pip install cloudsmith-cli

📘

Note

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).

In the above example, we use the command executed during the block prologue to install the Cloudsmith CLI, so that the cloudsmith push command is available.

In addition, we also use the cache restore command to retrieve the package file that was built in a previous block. Please see the Semaphore Cache documentation for more detail on storing and retrieving artifacts using the Semaphore cache

📘

Note

Where supported, you can also use native publishing commands like docker push or npm publish instead of using the Cloudsmith CLI, provided you have installed the necessary tooling as part of your pipeline block setup.


Cloudsmith is the new standard in Package / Artifact Management and Software Distribution

With support for all major package formats, you can trust us to manage your software supply chain.


Start My Free Trial Now
Cookie Declaration (Manage Cookies)