/replicated-ci-demo

Example repo showcasing how to use the Replicated APIs and tools to manage your Replicated application YAML using git

Primary LanguageMakefileMIT LicenseMIT

Replicated CI Demo

Example project showcasing how to combine several Replicated tools in order to manage Replicated YAML using a git repository.

Scheduler

Kubernetes Swarm Native

Tools

Pipeline Overview

The project includes CI configs for Travis CI and CircleCI. Both configs will:

On pull requests:

  • Install dependencies
  • Lint yaml for syntax and logic errors

On merges to the github master branch:

  • Install dependencies
  • Test yaml for syntax and logic errors
  • Create a new release on the Unstable channel in Replicated

On merges to the github release branch:

  • Install dependencies
  • Test yaml for syntax and logic errors
  • Create a new release on the Stable channel in Replicated

Make Commands

make deps -- Install replicated yaml linter and replicated vendor cli

make lint -- Lint the yaml at replicated.yml

make release -- Deploy and promote a new release to the replicated vendor portal. By default it will be promoted to the Unstable channel, but can be overriden by the channel make variable:

make release channel="Beta"

We use this to deploy releases to other channels.

Setup

You'll need to set the following env vars to run the project:

REPLICATED_APP - either an app slug or app ID

REPLICATED_API_TOKEN - a token for the Replicated Vendor API

If you need help finding the values for these, check out the guide for Finding Your API Token and App ID

Build Prequisites

To enable linting, you'll need to be using a build environment that provides a reasonably recent version of nodejs. We use 8.7.0 in this example, see circle.yml and .travis.yml for examples on how to set this up for Travis CI and CircleCI

Pull Requests

Repo includes two examples of using CI to test pull requests. Travis will test PRs from forks automatically, but CircleCI requires enabling building for the fork.

Success

There's a passing pull request at #1. It has all its checks passing:

checks-passing

Failure

There's a failing pull request at #2. It has checks failing:

checks-fail

The travis build shows the failure in the build log:

travis-output-failed

We can even use replicated-lint's JUnit XML reporter to integrate with Circle's test report parsing:

circle-tests-failed