add second job for deploying site

This commit is contained in:
Pim Kunis 2023-05-26 11:01:33 +02:00
parent 48b6369a3a
commit 37c8f1bcfd

View file

@ -13,6 +13,20 @@ notify-failed: &notify-failed
- -exc
- |
curl -X POST -d '{"body":"Deployment failed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
notify-success: &notify-success
task: notify-deployed
config:
platform: linux
image_resource:
type: registry-image
source:
repository: badouralix/curl-jq
run:
path: sh
args:
- -exc
- |
curl -X POST -d '{"body":"Static website deployed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
resources:
- name: site-repo
@ -29,7 +43,7 @@ resources:
icon: docker
jobs:
- name: build-and-deploy-static-website
- name: build-static-website
plan:
- get: site-repo
trigger: true
@ -128,6 +142,11 @@ jobs:
<< : *notify-failed
- load_var: tag
file: image/tag
- name: deploy-static-website
plan:
- get: site-registry-image
trigger: true
- get: site-repo
- task: deploy-site
config:
platform: linux
@ -139,6 +158,7 @@ jobs:
DOCKER_HOST: ssh://root@maestro.dmz
inputs:
- name: site-repo
- name: site-registry-image
run:
path: sh
args:
@ -149,21 +169,9 @@ jobs:
cp site-repo/ssh_config $HOME/.ssh/config
echo "((private_key))" > $HOME/.ssh/id_ed25519
chmod 600 $HOME/.ssh/id_ed25519
sed "s/TAG/((.:tag))/g" "site-repo/docker-stack.yml.template" > docker-stack.yml
sed "s/TAG/$(cat site-registry-image/tag)/g" "site-repo/docker-stack.yml.template" > docker-stack.yml
docker stack deploy --compose-file docker-stack.yml static
on_success:
task: notify-deployed
config:
platform: linux
image_resource:
type: registry-image
source:
repository: badouralix/curl-jq
run:
path: sh
args:
- -exc
- |
curl -X POST -d '{"body":"Static website deployed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse
<< : *notify-success
on_failure:
<< : *notify-failed