Code Monkey home page Code Monkey logo

bundle-cwr-ci's Introduction

Overview

This bundle deploys a reference platform for building, testing, and releasing Juju Charms and Bundles into the Juju Charm Store. The CI used in this bundle is Jenkins, paired with the following charm-specific tools:

The cornerstone of this bundle is Cloud Weather Report (CWR). The cwr charm handles CI requests (e.g. from from a webhook), manages the necessary models on your controller(s), dispatches jobs to Jenkins, provides job status to the requester, and can automatically release charms to your namespace in the charm store.

Note: We have a variation of this bundle called cwr-rq that includes all of the same components plus the Review Queue. If you are interested in a charm/bundle CI system that includes a source review application, we recommend you have a look at cwr-rq.

Bundle Composition

The charms that comprise this bundle are colocated on 1 machine. Additional information about these charms can by found in the following linked READMEs:

  • jenkins
  • cwr (colocated on the jenkins machine)

Getting Started

Note: A bootstrapped Juju controller is required. If Juju is not yet set up, please follow the getting-started instructions prior to deploying this bundle.

Deploy this bundle from the charm store:

juju deploy cwr-ci

Charms in this bundle provide status messages to indicate their readiness. Monitor the progress of the deployment with:

watch juju status

Note: Once the charms indicate they are ready, use Ctrl-c to terminate the watch command and proceed with the following instructions.

Set a password for Jenkins:

juju config jenkins password=<yourpassword>

CWR needs access to your controller(s) to create models and allocate resources needed to run charm/bundle tests. Grant this by creating a user on your bootstrapped controller(s) with appropriate permissions:

juju add-user ciuser
juju grant ciuser add-model

To register the controller with the CWR charm, you will need to call the register-controller action and provide a human-friendly name and the registration token from the above juju add-user command.

juju run-action cwr/0 register-controller token=<controller-name> \
    token=<registration-token>

You should also setup a session with the charm store to allow CWR to release charms to your namespace. To do this, call the store-login action and provide the base64 representation of an existing auth token. For example:

charm login
.........
export TOKEN=`base64 ~/.local/share/juju/store-usso-token`
juju run-action cwr/0 store-login charmstore-usso-token="$TOKEN"

At this point, you have the foundation for a powerful charm/bundle CI system. Workflows that leverage this system are described in the next section.

Workflows

Manage the Charm Release Cycle from Github

Description

Our goal is to build and test a charm/bundle every time code is committed to a repository. In light of a successful test, the resulting charm/bundle is pushed to the store and released in the edge channel. Similarly, releases to the stable channel can be made by tagging the code in Github when ready.

The rationale of this workflow is that you want charm/bundle updates released as soon as you are confident that things are working as expected. With good tests, the CI system can give you that confidence and automatically handle the release process from a source repo to an edge or stable channel in the charm store.

Prerequisites

  • A charm/top charm layer, e.g.: awesome-charm
  • Source repository on Github, e.g.: http://github.com/myself/my-awesome-charm
  • A charm store namespace, e.g.: awesome-team

Procedure

To include awesome-charm in our CI pipeline, we need to call the build-on-commit action:

juju run-action cwr/0 build-on-commit \
    repo=http://github.com/myself/my-awesome-charm \
    charm-name=awesome-charm \
    push-to-channel=edge \
    lp-id=awesome-team \
    controller=lxd

This will instruct CWR to run a Jenkins job to test awesome-charm on your lxd controller and release it to the edge channel each time you commit to your repo.

For releasing awesome-charm to the stable channel, we need a similar call to the build-on-release action:

juju run-action cwr/0 build-on-release \
    repo=http://github.com/myself/my-awesome-charm \
    charm-name=awesome-charm \
    push-to-channel=stable \
    lp-id=awesome-team \
    controller=aws

This will instruct CWR to run a Jenkins job to test awesome-charm on your aws controller and release it to the stable channel any time you tag your source with a release tag.

Summary

We have described an example workflow that can leverage the charm/bundle CI system provided by this bundle. Do you have ideas or other workflows built around CWR? Please let us know by contacting us on the mailing list below.

Resources

bundle-cwr-ci's People

Contributors

kwmonroe avatar

Watchers

Jason Hobbs avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.