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:
|
||||
- name: site-repo
|
||||
type: git
|
||||
|
@ -38,6 +54,8 @@ jobs:
|
|||
cd site-repo/jekyll
|
||||
bundle install
|
||||
bundle exec jekyll build --disable-disk-cache --destination ../../site-html
|
||||
on_failure:
|
||||
<< : *notify-failed
|
||||
- task: build-image
|
||||
privileged: true
|
||||
config:
|
||||
|
@ -61,6 +79,8 @@ jobs:
|
|||
build
|
||||
ls image
|
||||
cat image/digest | cut -d ":" -f 2- > image/tag
|
||||
on_failure:
|
||||
<< : *notify-failed
|
||||
- task: get-site-packages
|
||||
config:
|
||||
platform: linux
|
||||
|
@ -78,6 +98,8 @@ jobs:
|
|||
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
|
||||
cat site-packages/packages.txt
|
||||
on_failure:
|
||||
<< : *notify-failed
|
||||
- task: delete-old-packages
|
||||
config:
|
||||
platform: linux
|
||||
|
@ -94,10 +116,14 @@ jobs:
|
|||
- |
|
||||
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
|
||||
on_failure:
|
||||
<< : *notify-failed
|
||||
- put: site-registry-image
|
||||
params:
|
||||
image: image/image.tar
|
||||
additional_tags: image/tag
|
||||
on_failure:
|
||||
<< : *notify-failed
|
||||
- load_var: tag
|
||||
file: image/tag
|
||||
- task: deploy-site
|
||||
|
@ -137,3 +163,5 @@ jobs:
|
|||
- -exc
|
||||
- |
|
||||
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