Giter Club home page Giter Club logo

pipeline-templates's Introduction

Pipeline Templates

This repository collects up all that tribal wisdom we've gained from building Concourse Pipelines for various different purposes. Each template provides a base ci/pipeline.yml that structures the pipeline, ci/settings.yml to override any parameters defined by the template, a set of scripts (in ci/scripts/) that are referenced from the pipeline, and a ci/repipe utility for putting all the pieces together into a functioning Concourse pipeline.

This project was initially created by Stark & Wayne, and is now maintained by Gstack.

Setup

Setup is straightforward:

git clone https://github.com/cloudfoundry-community/pipeline-templates
cd pipeline-templates
./setup <template> ~/bosh/my-new-boshrelease

Alternatively, you can initialize the pipeline from inside the target repository:

cd code/my-buildpack
~/code/pipeline-templates/setup <template>

The first argument to setup is the template you want to use. Currently available templates:

  • bash
  • boshrelease
  • genesis-kit
  • buildpack
  • cfpush
  • docker/base
  • docker/ext-tests
  • go
  • helm

Don't let the name fool you! ./setup can also be used to update an existing templated pipeline ci/ directory to pick up new changes made to the templates.

Once you've set up your repository, you'll need to fill in your ci/settings.yml file with any parameters the template required:

cd code/my-project
ci/repipe # Attempt to update the pipeline config,
          # spitting out errors for missing parameters
vi ci/settings.yml # fill in the missing parameters
ci/repipe # Deploy the pipeline config!

Dependencies

The ci/repipe script uses Spruce to merge ci/pipeline.yml and your bespoke ci/settings.yml.

On MacOS/Homebrew:

brew install cloudfoundry-community/cf/spruce

On Debian/Ubuntu:

wget -q -O - https://raw.githubusercontent.com/cloudfoundry-community/homebrew-cf/master/public.key | apt-key add -
echo "deb http://apt.community.cloudfoundry.org stable main" | tee /etc/apt/sources.list.d/cf-community.list
apt-get update

apt-get install spruce

The ci/repipe for genesis-kits also requires jq, which can be installed via brew on MacOS or apt-get on Debian/Ubuntu.

And Now, The Templates!

docker/base and docker/ext-tests

For building Docker images, with tests. This template comes in two flavors: docker/base (where the unit tests are inside the Docker image) and docker/ext-tests, where the tests live outside of the image.

Docker Pipeline

go

Takes a Go software project repository, runs unit tests and (when the manual shipit job is run) releases to Github.

Go Project Pipeline

boshrelease

Tries to create a BOSH release from the repository, upload it to a hosted BOSH-lite for viability testing, and (when the manual shipit job is run) releasing it to Github with a tarball artifact, and also uploading that release tarball to S3.

BOSH Release Pipeline

genesis-kit

Builds a pipeline to create a pipeline that builds a release candidate, runs it through spec tests and spec-check, then any deployment, upgrad and acceptance tests. Passing those, it prepares the release notes based on commit messages, and then can be manually released. It also includes a manual prerelease after the initial RC is built.

There is also provision for pulling upstream dependencies and bumping semantic version components.

Read the README.md file under genesis-kit for customization options. As written, it is based on the cf-genesis-kit.

Genesis Kit Pipeline

buildpack

Runs unit and integration tests on a Cloud Foundry buildpack, and can release it to Github.

Buildpack Pipeline

helm

Builds a docker image and uploads Helm chart to an S3 bucket

Helm

ci/settings.yml

You will need to customize your pipeline with information about your CI, your Amazon AWS credentials + S3 bucket for storing assets + version file, your Slack account, etc.

You will create and maintain ci/settings.yml for this.

Try very very hard to not modify ci/pipeline.yml. Instead, use ./setup to update ci/pipeline.yml with new changes from this repo. If you do need to modify ci/pipeline.yml please feel welcome to submit PRs to this repo so that we can merge them and share them with everyone.

For those who use Vault to store their credentials, the spruce syntax (( vault "path1" )) can fetch the secret values during ci/repipe. Using this feature is not recommended though, because the secrets will leak as clear-text in the Concourse (Postgres) database. Since Concourse CI has native support for Vault, everyone should use that so that secrets are fetched just-in-time, and have lower risk of leaking.

Here is an example ci/settings.yml from the eden CLI project (uses the go template):

---
meta:
  name: eden
  target: sw
  url:     https://ci.starkandwayne.com

  initial_version: 0.5.0

  go:
    binary: eden
    cmd_module: .

  aws:
    access_key: (( vault "secret/aws/starkandwayne-s3:access" ))
    secret_key: (( vault "secret/aws/starkandwayne-s3:secret" ))
    region_name: eu-central-1

  slack:
    webhook: (( vault "secret/pipelines/eden/slack:webhook" ))
    channel: "#eden" # https://openservicebrokerapi.slack.com/messages/C6Y5A2N8Z/
    username: starkandwayne-ci
    icon:     https://www.starkandwayne.com/assets/images/shield-blue-50x50.png

  github:
    owner: starkandwayne
    repo: eden
    access_token: (( vault "secret/pipelines/shared/github:access_token" ))
    private_key: (( vault  "secret/pipelines/shared/github:private_key" ))

Bonus, we use https://github.com/starkandwayne/safe as our CLI to interact with Vault.

For example, to populate the (( vault "secret/pipelines/eden/slack:webhook" )) value in Vault:

safe set secret/pipelines/eden/slack webhook=https://hooks.slack.com/services/T2S1X7xxx/B6Y5A7xx/0nP7jxxx

pipeline-templates's People

Contributors

bgandon avatar drnic avatar geofffranks avatar jhunt avatar dennisjbell avatar bertrand-lupart avatar lnguyen avatar oddbloke avatar nacc avatar norman-abramovitz avatar 7hunderbird avatar starkandwayne-bot avatar

Stargazers

Michael W. Hanna avatar Souvick avatar SNOW avatar Aaron avatar Alex Tasioulis avatar pratikbin avatar Jose Garcia avatar James Stephens avatar José Wenceslao Castillo avatar Anton Strukov avatar Tom von Schwerdtner avatar Katie Schilling avatar bm8 bmFtZQ avatar Digital Fabric / David avatar José Riguera Lopez  avatar Aaron Parker avatar ismailuztemur avatar Matt Dodge avatar Paul Tinius avatar Damouse avatar Sebastian Holstein avatar Lucas de Souza avatar JR Boyens avatar Marc Vieira-Cardinal (VA2MVC) avatar Felix Hirner avatar dap avatar Hoseong Liam Hwang avatar Alex Kamalov avatar Ryan Meharg avatar Rickard Löfström avatar Danilo Sousa avatar  avatar Marwen Ounis avatar Manuel Eusebio de Paz Carmona avatar Dave Banerjee avatar simplify-len avatar Hue Kim avatar Alvaro Pinot @alvaropinot avatar Adriano Lisboa avatar Chris Eason avatar John Wells avatar Mathias Bogaert avatar Indrajith Bandara avatar Daniel Norman avatar Gabriel Gomes avatar Jesús García Crespo avatar Gabriel Dumitrescu avatar Bram Swenson avatar Noah Ispas avatar Tim Lombardo avatar Stephan Michard avatar James Webb avatar  avatar J. Felix Etcetera avatar Rimenes Ribeiro avatar Etourneau Gwenn avatar  avatar Oskar Maria Grande avatar Alberto Leal avatar Jason Morgan avatar Matthew Cosgrove avatar Manuel Eusebio de Paz Carmona avatar Ilya Bushin avatar Nikolay Kolev avatar Ticean Bennett avatar Kristoffer Ahl avatar Mick Pollard avatar Shingo Omura avatar mxs avatar Dan Young avatar Jonathan Matthews avatar Peter Sellars avatar Toshiaki Maki avatar Shane Sveller avatar

Watchers

Bill Chapman avatar Tyler Poland avatar Dennis Walters avatar  avatar Lucas Bunt avatar James Cloos avatar Steven Kim avatar Van Nguyen avatar  avatar Justin Hartung avatar Xiujiao Gao avatar DigitalEagle avatar Ben Stumpf avatar Christian Roggia avatar Justin Carter avatar Chris McGowan avatar Andrew Hartpence avatar  avatar  avatar Harshita Girase avatar Rod Stratford avatar jacob goldverg avatar Tomasz Tudrej avatar  avatar  avatar Michael W. Hanna avatar

pipeline-templates's Issues

How to use?

Can you add a readme explaining how to use the templates, and the repipe/setup commands?

Print out go version

If pipeline release jobs that use go build could print out the go version being used that would be awesome. Took me longer than it should have to realize that safe was still being built against go1.8.

A simple go version should suffice.

Bad config in BOSH release pipeline `changes` resource

I had to apply this patch to a BOSH release ci/pipeline.yml yesterday to get builds triggering:

@@ -169,12 +169,12 @@ resources:
       uri:         (( grab meta.github.uri ))
       branch:      (( grab meta.github.branch ))
       private_key: (( grab meta.github.private_key ))
-    paths:
-      - src/**/*
-      - jobs/**/*
-      - packages/**/*
-      - config/blobs.yml
-      - templates/**/*
+      paths:
+        - src/**/*
+        - jobs/**/*
+        - packages/**/*
+        - config/blobs.yml
+        - templates/**/*

   - name: version
     type: semver

BOSH release git tags off-by-one

The semver git tag and the git commit with the changes are off-by-one:

* bc18612 - (HEAD -> master, origin/master, origin/HEAD) release v0.3.0 (10 minutes ago) CI Bot
* c7192a5 - (tag: v0.3.0) Upload blob for vault-broker (6 hours ago) James Hunt

In this case, bc18612 should be the commit with the v0.3.0 tag on it.

trigger: true for version on rc step

Good afternoon,

I've been testing the go pipeline and I witnessed a strange behaviour that seems to be caused by the trigger: true for the version resource on the RC step.

Basically for every git commit the test step runs, that eventually triggers the rc step and because rc bumps the version it seems like it runs twice. Later down the road when the bump-patch runs it looks like another rc is run again.

Is there something that I am doing wrong?

BOSH deployment tests not being deleted

There is a mismatch in the pipeline configs for BOSH releases that is causing the warden deployment (warden-$basename) to not be deleted because the pipeline is trying to delete ci-$basename-boshrelease.

Also, we should rearrange some steps to delete the deployment immediately after verifying that it worked, to keep the bosh-lites clean and tidy.

Release tags happening before release commit on go pipelines

For example:

(genesis)

$ gl
* 8a89142 - (HEAD -> type-template, origin/type-template) Allow overriding deployment type when using --template (5 minutes ago) Geoff Franks
* 97b0ec9 - (origin/master, origin/HEAD, master) release v1.5.0 (11 days ago) CI Bot
* 145f5c6 - (tag: v1.5.0) Revert "release v1.5.0" (11 days ago) Geoff Franks
* db0789d - release v1.5.0 (11 days ago) CI Bot
* 43cdec0 - Revert "release v1.5.0" (11 days ago) Geoff Franks

(spruce)

$ gl
* d921261 - (HEAD -> master, origin/master) release v1.4.2 (4 days ago) CI Bot
* feb8dde - (tag: v1.4.2) Added release notes (4 days ago) Geoff Franks
* 15a044d - Fixed issue with stdout/stderr (4 days ago) Geoff Franks

The tag/release should probably be placed on the CI Bot commit for that version.

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.