add failure handler
This commit is contained in:
parent
7dc508ffb9
commit
3e74f5a84f
1 changed files with 28 additions and 0 deletions
28
pipeline.yml
28
pipeline.yml
|
@ -1,3 +1,19 @@
|
||||||
|
---
|
||||||
|
notify-failed: ¬ify-failed
|
||||||
|
task: notify-failed
|
||||||
|
config:
|
||||||
|
platform: linux
|
||||||
|
image_resource:
|
||||||
|
type: registry-image
|
||||||
|
source:
|
||||||
|
repository: badouralix/curl-jq
|
||||||
|
run:
|
||||||
|
path: sh
|
||||||
|
args:
|
||||||
|
- -exc
|
||||||
|
- |
|
||||||
|
curl -X POST -d '{"body":"Deployment failed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
- name: site-repo
|
- name: site-repo
|
||||||
type: git
|
type: git
|
||||||
|
@ -38,6 +54,8 @@ jobs:
|
||||||
cd site-repo/jekyll
|
cd site-repo/jekyll
|
||||||
bundle install
|
bundle install
|
||||||
bundle exec jekyll build --disable-disk-cache --destination ../../site-html
|
bundle exec jekyll build --disable-disk-cache --destination ../../site-html
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
- task: build-image
|
- task: build-image
|
||||||
privileged: true
|
privileged: true
|
||||||
config:
|
config:
|
||||||
|
@ -61,6 +79,8 @@ jobs:
|
||||||
build
|
build
|
||||||
ls image
|
ls image
|
||||||
cat image/digest | cut -d ":" -f 2- > image/tag
|
cat image/digest | cut -d ":" -f 2- > image/tag
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
- task: get-site-packages
|
- task: get-site-packages
|
||||||
config:
|
config:
|
||||||
platform: linux
|
platform: linux
|
||||||
|
@ -78,6 +98,8 @@ jobs:
|
||||||
ls -lash
|
ls -lash
|
||||||
curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim?type=container&q=static' -H 'accept: application/json' | jq -rc 'map(.version) | .[]' > site-packages/packages.txt
|
curl -X 'GET' 'https://git.pim.kunis.nl/api/v1/packages/pim?type=container&q=static' -H 'accept: application/json' | jq -rc 'map(.version) | .[]' > site-packages/packages.txt
|
||||||
cat site-packages/packages.txt
|
cat site-packages/packages.txt
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
- task: delete-old-packages
|
- task: delete-old-packages
|
||||||
config:
|
config:
|
||||||
platform: linux
|
platform: linux
|
||||||
|
@ -94,10 +116,14 @@ jobs:
|
||||||
- |
|
- |
|
||||||
ls -lash
|
ls -lash
|
||||||
while read pkg; do curl -X 'DELETE' "https://git.pim.kunis.nl/api/v1/packages/pim/container/static/$pkg?token=((api_key))" -H 'accept: application/json'; done < site-packages/packages.txt
|
while read pkg; do curl -X 'DELETE' "https://git.pim.kunis.nl/api/v1/packages/pim/container/static/$pkg?token=((api_key))" -H 'accept: application/json'; done < site-packages/packages.txt
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
- put: site-registry-image
|
- put: site-registry-image
|
||||||
params:
|
params:
|
||||||
image: image/image.tar
|
image: image/image.tar
|
||||||
additional_tags: image/tag
|
additional_tags: image/tag
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
- load_var: tag
|
- load_var: tag
|
||||||
file: image/tag
|
file: image/tag
|
||||||
- task: deploy-site
|
- task: deploy-site
|
||||||
|
@ -137,3 +163,5 @@ jobs:
|
||||||
- -exc
|
- -exc
|
||||||
- |
|
- |
|
||||||
curl -X POST -d '{"body":"Static website deployed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
|
curl -X POST -d '{"body":"Static website deployed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
|
||||||
|
on_failure:
|
||||||
|
<< : *notify-failed
|
||||||
|
|
Reference in a new issue