Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
190 lines (183 sloc) 4.9 KB
---
resources:
- name: send-email
type: email
source:
from: YOUR-SENDER-EMAIL-GOES-HERE
- name: fly-release
type: github-release
source:
user: concourse
repository: concourse
access_token: {{github-access-token}}
jobs:
- name: Build-it
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
trigger: true
- task: do-your-build-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of build job. It gets automatically triggered by any changes in the resource."
- name: Test-it
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Build-it
trigger: true
- task: do-your-test-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of test job. It gets automatically triggered after a successful Build-it job."
- task: prep-email-text
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
echo "Version $LATEST_GOOD_VERSION is ready to ship!" > ./email-text/email-subject.txt
echo "Version $LATEST_GOOD_VERSION is ready to ship! For details, see pipeline {{ BUILD_PIPELINE_NAME }}, build {{ BUILD_NAME }}, job {{ BUILD_JOB_NAME }}." > ./email-text/email-body.txt
- put: send-email
params:
to: [YOUR-EMAIL-GOES-HERE]
subject: ./email-text/email-subject.txt
body: ./email-text/email-body.txt
- task: update-ship-it-job-name
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
mv ./fly-release/fly_linux_amd64 ./fly
chmod +x ./fly
./fly -t local login -c {{concourse-url}} -n {{concourse-team}} #-u {{concourse-username}} -p {{concourse-password}}
./fly -t local sync
./fly -t local get-pipeline -p {{concourse-pipeline-name}} > ./original-pipeline.yml
sed "s/Ship-version-.*/Ship-version-$LATEST_GOOD_VERSION/" ./original-pipeline.yml > ./updated-pipeline.yml
./fly -t local set-pipeline -p {{concourse-pipeline-name}} -c ./updated-pipeline.yml -n
- name: Ship-version-2.6.0
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Test-it
trigger: false
- task: do-your-shipit-task-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of your manually triggered Ship-it task."
- name: Deploy-and-AT-it!
plan:
- get: fly-release
params:
globs:
- fly_linux_amd64
passed:
- Ship-version-2.6.0
trigger: true
- task: do-your-deploy-and-AT-tasks-here
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
run:
path: sh
args:
- -exc
- |
echo "Output of your Deploy and AT tasks."
- task: prep-email-text
config:
platform: linux
image_resource:
type: docker-image
source:
repository: concourse/buildroot
tag: "git"
inputs:
- name: fly-release
outputs:
- name: email-text
run:
path: sh
args:
- -exc
- |
export LATEST_GOOD_VERSION=$(cat ./fly-release/version)
echo "Version $LATEST_GOOD_VERSION deployed and tested!" > ./email-text/email-subject.txt
echo "Version $LATEST_GOOD_VERSION has been deployed and tested successfully! For details, see pipeline {{ BUILD_PIPELINE_NAME }}, build {{ BUILD_NAME }}, job {{ BUILD_JOB_NAME }}." > ./email-text/email-body.txt
- put: send-email
params:
to: [YOUR-EMAIL-GOES-HERE]
subject: ./email-text/email-subject.txt
body: ./email-text/email-body.txt
resource_types:
- name: email
type: docker-image
source:
repository: mdomke/concourse-email-resource