From 37c8f1bcfd7742710cd2e8d75d48b95973064954 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Fri, 26 May 2023 11:01:33 +0200 Subject: [PATCH] add second job for deploying site --- pipeline.yml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/pipeline.yml b/pipeline.yml index bde9740..2af369e 100644 --- a/pipeline.yml +++ b/pipeline.yml @@ -13,6 +13,20 @@ notify-failed: ¬ify-failed - -exc - | curl -X POST -d '{"body":"Deployment failed!"}' -H "Content-Type: application/json" https://apprise.pim.kunis.nl:444/notify/concourse +notify-success: ¬ify-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