281 lines
9.1 KiB
YAML
281 lines
9.1 KiB
YAML
---
|
|
#
|
|
# ci/pipeline.yml
|
|
#
|
|
# Pipeline structure file for a Cloud Foundry Buildpack
|
|
#
|
|
# DO NOT MAKE CHANGES TO THIS FILE. Instead, modify
|
|
# ci/settings.yml and override what needs overridden.
|
|
# This uses spruce, so you have some options there.
|
|
#
|
|
# author: Dr Nic Williams <drnicwilliams@gmail.com>
|
|
# created: 2017-10-24
|
|
|
|
meta:
|
|
name: (( param "Please name your pipeline" ))
|
|
pipeline: (( concat meta.name "-buildpack" ))
|
|
target: (( param "Please identify the name of the target Concourse CI" ))
|
|
url: (( param "Please specify the full url of the target Concourse CI" ))
|
|
|
|
git:
|
|
email: (( param "Please provide the git email for automated commits" ))
|
|
name: (( param "Please provide the git name for automated commits" ))
|
|
|
|
image:
|
|
name: starkandwayne/concourse-go
|
|
tag: 1.12
|
|
registry:
|
|
username: (( param "Please set your Docker registry username for your pipeline image" ))
|
|
password: (( param "Please set your Docker registry password for your pipeline image" ))
|
|
|
|
cf:
|
|
api_url: (( param "Please provide api_url" ))
|
|
admin_username: (( param "Please provide admin_username" ))
|
|
admin_password: (( param "Please provide admin_password" ))
|
|
organization: (( param "Please provide organization" ))
|
|
space: (( param "Please provide space" ))
|
|
|
|
aws:
|
|
bucket: (( grab meta.pipeline ))
|
|
region_name: us-east-1
|
|
access_key: (( param "Please set your AWS Access Key ID for your pipeline S3 Bucket" ))
|
|
secret_key: (( param "Please set your AWS Secret Key ID for your pipeline S3 Bucket" ))
|
|
|
|
github:
|
|
uri: (( concat "git@github.com:" meta.github.owner "/" meta.github.repo ))
|
|
owner: (( param "Please specify the name of the user / organization that owns the Github repository" ))
|
|
repo: (( grab meta.pipeline ))
|
|
branch: master
|
|
private_key: (( param "Please generate an SSH Deployment Key for this repo and specify it here" ))
|
|
access_token: (( param "Please generate a Personal Access Token to be used for creating github releases (do you have a ci-bot?)" ))
|
|
|
|
slack:
|
|
webhook: (( param "Please specify your Slack Incoming Webhook Integration URL" ))
|
|
success_moji: ":airplane_departure:"
|
|
fail_moji: ":airplane_arriving:"
|
|
upset_moji: ":sadpanda:"
|
|
channel: (( param "Please specify the channel (#name) or user (@user) to send messages to" ))
|
|
username: concourse
|
|
icon: https://cl.ly/2F421Y300u07/concourse-logo-blue-transparent.png
|
|
fail_url: '(( concat "<" meta.url "/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME| Concourse Failure! " meta.slack.upset_moji ">" ))'
|
|
|
|
groups:
|
|
- name: (( grab meta.pipeline ))
|
|
jobs:
|
|
- unit-tests
|
|
- integration-tests
|
|
- rc
|
|
- minor
|
|
- major
|
|
- shipit
|
|
|
|
jobs:
|
|
- name: unit-tests
|
|
public: true
|
|
plan:
|
|
- do:
|
|
- in_parallel:
|
|
- { get: git, trigger: true }
|
|
- { get: image }
|
|
- task: unit-tests
|
|
image: image
|
|
config:
|
|
platform: linux
|
|
inputs:
|
|
- { name: git }
|
|
run:
|
|
path: ./git/scripts/unit.sh
|
|
args: []
|
|
params: {}
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": unit-tests job failed" ))'
|
|
|
|
- name: integration-tests
|
|
public: true
|
|
serial: true
|
|
plan:
|
|
- do:
|
|
- in_parallel:
|
|
- { get: git, trigger: true }
|
|
- { get: image }
|
|
- task: integration-tests
|
|
image: image
|
|
config:
|
|
platform: linux
|
|
inputs:
|
|
- { name: git }
|
|
run:
|
|
path: ./git/scripts/integration.sh
|
|
args: []
|
|
params:
|
|
CF_API_URL: (( grab meta.cf.api_url ))
|
|
CF_USERNAME: (( grab meta.cf.admin_username ))
|
|
CF_PASSWORD: (( grab meta.cf.admin_password ))
|
|
CF_ORGANIZATION: (( grab meta.cf.organization ))
|
|
CF_SPACE: (( grab meta.cf.space ))
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": integration-tests job failed" ))'
|
|
|
|
- name: rc
|
|
public: true
|
|
plan:
|
|
- do:
|
|
- in_parallel:
|
|
- { get: git, trigger: true, passed: [unit-tests, integration-tests] }
|
|
- { get: version, trigger: true, params: {pre: rc} }
|
|
- put: version
|
|
params: {file: version/number}
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": rc job failed" ))'
|
|
|
|
- name: minor
|
|
public: true
|
|
plan:
|
|
- do:
|
|
- { get: version, trigger: false, params: {bump: minor} }
|
|
- { put: version, params: {file: version/number} }
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": minor job failed" ))'
|
|
|
|
- name: major
|
|
public: true
|
|
plan:
|
|
- do:
|
|
- { get: version, trigger: false, params: {bump: major} }
|
|
- { put: version, params: {file: version/number} }
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": major job failed" ))'
|
|
|
|
- name: shipit
|
|
public: true
|
|
serial: true
|
|
plan:
|
|
- do:
|
|
- in_parallel:
|
|
- { get: version, passed: [rc], params: {bump: final} }
|
|
- { get: git, passed: [rc] }
|
|
- { get: image }
|
|
- task: release
|
|
image: image
|
|
config:
|
|
platform: linux
|
|
inputs:
|
|
- name: version
|
|
- name: git
|
|
outputs:
|
|
- name: gh
|
|
- name: pushme
|
|
- name: notifications
|
|
run:
|
|
path: ./git/ci/scripts/shipit.sh
|
|
args: []
|
|
params:
|
|
RELEASE_NAME: (( grab meta.pipeline ))
|
|
REPO_ROOT: git
|
|
VERSION_FROM: version/number
|
|
RELEASE_OUT: gh
|
|
REPO_OUT: pushme
|
|
REPO_BRANCH: (( grab meta.github.branch ))
|
|
REPO_URL: (( concat "https://github.com/" meta.github.owner "/" meta.github.repo ))
|
|
NOTIFICATION_OUT: notifications
|
|
GIT_EMAIL: (( grab meta.git.email ))
|
|
GIT_NAME: (( grab meta.git.name ))
|
|
|
|
- put: git
|
|
params:
|
|
rebase: true
|
|
repository: pushme
|
|
- put: github
|
|
params:
|
|
name: gh/name
|
|
tag: gh/tag
|
|
body: gh/notes.md
|
|
globs: [gh/artifacts/*]
|
|
- put: version
|
|
params:
|
|
bump: patch
|
|
- in_parallel:
|
|
- put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text_file: notifications/message
|
|
on_failure:
|
|
put: notify
|
|
params:
|
|
channel: (( grab meta.slack.channel ))
|
|
username: (( grab meta.slack.username ))
|
|
icon_url: (( grab meta.slack.icon ))
|
|
text: '(( concat meta.slack.fail_url " " meta.pipeline ": shipit job failed" ))'
|
|
|
|
resource_types:
|
|
- name: slack-notification
|
|
type: docker-image
|
|
source:
|
|
repository: cfcommunity/slack-notification-resource
|
|
|
|
resources:
|
|
- name: image
|
|
type: docker-image
|
|
source:
|
|
repository: (( grab meta.image.name ))
|
|
tag: (( grab meta.image.tag ))
|
|
username: (( grab meta.image.registry.username ))
|
|
password: (( grab meta.image.registry.password ))
|
|
|
|
- name: git
|
|
type: git
|
|
source:
|
|
uri: (( grab meta.github.uri ))
|
|
branch: (( grab meta.github.branch ))
|
|
private_key: (( grab meta.github.private_key ))
|
|
|
|
- name: notify
|
|
type: slack-notification
|
|
source:
|
|
url: (( grab meta.slack.webhook ))
|
|
|
|
- name: version
|
|
type: semver
|
|
source:
|
|
driver: s3
|
|
bucket: (( grab meta.aws.bucket ))
|
|
region_name: (( grab meta.aws.region_name ))
|
|
key: version
|
|
access_key_id: (( grab meta.aws.access_key ))
|
|
secret_access_key: (( grab meta.aws.secret_key ))
|
|
initial_version: (( grab meta.initial_version || "0.0.1" ))
|
|
|
|
- name: github
|
|
type: github-release
|
|
source:
|
|
user: (( grab meta.github.owner ))
|
|
repository: (( grab meta.github.repo ))
|
|
access_token: (( grab meta.github.access_token ))
|