DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • CPU vs. GPU Intensive Applications
  • Navigating Digital Assurance With a Scrum Master: Maximizing Quality in Agile Projects
  • How to Implement Istio in Multicloud and Multicluster
  • 13 Impressive Ways To Improve the Developer’s Experience by Using AI

Trending

  • CPU vs. GPU Intensive Applications
  • Navigating Digital Assurance With a Scrum Master: Maximizing Quality in Agile Projects
  • How to Implement Istio in Multicloud and Multicluster
  • 13 Impressive Ways To Improve the Developer’s Experience by Using AI

Continuous Packaging: Using Cloudsmith and CircleCI to Automate Package Management And Distribution

Integrating 'continuous packaging' with continuous integration platforms means automating publishing and distributing the packages your organization builds.

Paddy Carey user avatar by
Paddy Carey
·
Jun. 16, 20 · Tutorial
Like (1)
Save
Tweet
Share
28.10K Views

Join the DZone community and get the full member experience.

Join For Free

Getting control — and keeping control — over the software assets your organization creates should be a priority.

That’s why at Cloudsmith we provide cloud-native private repositories that allow our customers to store, manage, secure and distribute the packages they use, both those developed internally and third-party packages and dependencies.

Doing this provides many benefits, including:

  • The ability to manage permissions at organization, team and individual level

  • The ability for packages to be shared with teams and individuals anywhere on the globe without performance compromises, and from a single consistent source of truth

  • The ability to audit the usage of assets and understand what has been used where

  • The ability to manage all assets, no matter which language and package format they are created with, in a consistent manner 

Of course, in order to access these advantages, we want to make it as easy as possible to get your packages into our system, which is where integration with CircleCI comes into the equation.

As you probably know, CircleCI is a continuous integration and delivery platform that helps teams release quality code, faster. They provide a mechanism for users to share code and libraries which can be reused across pipelines called "orbs".

Cloudsmith provides first-class support for CircleCI with our official orb. Using the orb, users can easily integrate publishing to Cloudsmith with their existing CircleCI workflows. We sometimes call that ‘continuous packaging’: automatically packaging and publishing everything you deploy in order to make it findable and available to all (permissions allowing!)

Full reference documentation for the orb can be found on the CircleCI website. This documentation is automatically generated from the orb itself and so is guaranteed to always be up to date with the latest release of the orb. Below is an example of how this process works.

Orb Usage Example

To use the orb you must first ensure you are using Circle version 2.1. At the top of your .circleci/config.yml file you should add:

YAML
 




xxxxxxxxxx
1


 
1
version: 2.1



And then include the orb:

YAML
 




xxxxxxxxxx
1


 
1
orbs:
2
  cloudsmith: cloudsmith/cloudsmith@1.0.1



You'll need to configure authentication credentials for the orb. To do so, you can add an environment variable named CLOUDSMITH_API_KEY within the CircleCI settings page for your project:

Environment variables


The orb (for now) requires that you have already built the package you wish to publish. Assuming you're publishing a Python library (though the same process applies to any package type), you'll want to run setup.py sdist as a step in your job:

YAML
 




xxxxxxxxxx
1
13


 
1
jobs:
2
  publish:
3
    executor: circleci/python:3.7
4
    steps:
5
      - checkout
6
      - run:
7
          name: Build Python package
8
          command: python setup.py sdist
9

          
10
workflows:
11
  cloudsmith_publish:
12
    jobs:
13
      - publish



Once built, we can use the orb to easily publish the package. The orb provides a number of commands to make this process simpler. We'll first ensure the Cloudsmith CLI is configured and installed, then after we've built the package, publish it:

YAML
 




xxxxxxxxxx
1
14


 
1
jobs:
2
  publish:
3
    executor: circleci/python:3.7
4
    steps:
5
      - checkout
6
      - cloudsmith/ensure-api-key
7
      - cloudsmith/install-cli
8
      - run:
9
          name: Build Python package
10
          command: python setup.py sdist
11
      - cloudsmith/publish:
12
          cloudsmith-repository: myorg/myrepo
13
          package-path: dist/package-*.tar.gz
14
          package-type: python



Putting this all together, we end up with a .circleci/config.yaml file which looks like so:

YAML
 




xxxxxxxxxx
1
24


 
1
version: 2.1
2

          
3
orbs:
4
  cloudsmith: cloudsmith/cloudsmith@1.0.1
5

          
6
jobs:
7
  publish:
8
    executor: circleci/python:3.7
9
    steps:
10
      - checkout
11
      - cloudsmith/ensure-api-key
12
      - cloudsmith/install-cli
13
      - run:
14
          name: Build Python package
15
          command: python setup.py sdist
16
      - cloudsmith/publish:
17
          cloudsmith-repository: myorg/myrepo
18
          package-path: dist/package-*.tar.gz
19
          package-type: python
20

          
21
workflows:
22
  cloudsmith_publish:
23
    jobs:
24
      - publish



Manual integration

Our official orb provides simple integration for the majority of standard CI use cases, but we know that it won't fit every purpose. For additional flexibility, users can mix and match commands provided by the orb and/or use the Cloudsmith CLI directly.

For example, to use the orb to install and configure the CLI, but then use the CLI directly to publish to Cloudsmith, your configuration might look like so:

YAML
 




xxxxxxxxxx
1
23


 
1
version: 2.1
2

          
3
orbs:
4
  cloudsmith: cloudsmith/cloudsmith@1.0.1
5

          
6
jobs:
7
  publish:
8
    executor: circleci/python:3.7
9
    steps:
10
      - checkout
11
      - cloudsmith/ensure-api-key
12
      - cloudsmith/install-cli
13
      - run:
14
          name: Build Python package
15
          command: python setup.py bdist_wheel
16
      - run:
17
          name: Publish Python package
18
          command: cloudsmith push python myorg/myrepo dist/my-package-0.1.0.whl
19

          
20
workflows:
21
  cloudsmith_publish:
22
    jobs:
23
      - publish



It's that easy to integrate CircleCI with Cloudsmith and start enjoying the benefits of continuous packaging!

Orb (software) Distribution (differential geometry)

Published at DZone with permission of Paddy Carey. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • CPU vs. GPU Intensive Applications
  • Navigating Digital Assurance With a Scrum Master: Maximizing Quality in Agile Projects
  • How to Implement Istio in Multicloud and Multicluster
  • 13 Impressive Ways To Improve the Developer’s Experience by Using AI

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: