From ff64357f2cdee210e33de9bc752c95a3eff28e17 Mon Sep 17 00:00:00 2001 From: Drew Short Date: Sat, 14 Dec 2019 23:33:30 -0600 Subject: [PATCH] Adding Concourse pipeline --- pipeline.yml | 70 ++++++++++++++++++++++++++++++++++++++++++++++ upload_pipeline.sh | 11 ++++++++ 2 files changed, 81 insertions(+) create mode 100644 pipeline.yml create mode 100755 upload_pipeline.sh diff --git a/pipeline.yml b/pipeline.yml new file mode 100644 index 0000000..d99fe4f --- /dev/null +++ b/pipeline.yml @@ -0,0 +1,70 @@ +--- +resources: + - name: git-resource + type: git + icon: git + source: + uri: ssh://git@git.nulloctet.com:8437/warricksothr/sothr-dot-com.git + private_key: | + ((pull_key)) + ignore_paths: + - pipeline.yml + - upload_pipeline.sh + - README.md + +jobs: + - name: publish + plan: + - get: git-resource + trigger: true + - task: build-site + config: + platform: linux + image_resource: + type: registry-image + source: + repository: ((nexus_docker_read.host))/sothr/hugo + username: ((nexus_docker_read.username)) + password: ((nexus_docker_read.password)) + inputs: + - name: git-resource + outputs: + - name: site-html + run: + path: /bin/sh + args: + - -c + - | + export HUGO_SOURCE="${PWD}/git-resource" + /run.sh --minify + tar -czvf site-html/website.tgz -C /output/ . + - task: publish-site + config: + platform: linux + image_resource: + type: registry-image + source: + repository: ((nexus_docker_read.host))/sothr/deploy + tag: "stable" + username: ((nexus_docker_read.username)) + password: ((nexus_docker_read.password)) + inputs: + - name: site-html + params: + DEPLOY_KEY: ((deploy.key)) + DEPLOY_HOST: ((deploy.host)) + DEPLOY_PORT: ((deploy.port)) + DEPLOY_USER: ((deploy.user)) + DEPLOY_TARGET: ((deploy.target)) + run: + path: /bin/bash + args: + - -c + - | + eval `ssh-agent -s` + ssh-add <(echo "${DEPLOY_KEY}") + mkdir -p ~/.ssh + ssh-keyscan -p ${DEPLOY_PORT} ${DEPLOY_HOST} >> ~/.ssh/known_hosts + mkdir /tmp/deploy + tar -xzvf site-html/website.tgz -C /tmp/deploy + rsync -avz --delete-delay -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${DEPLOY_PORT}" --progress /tmp/deploy/* ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_TARGET} diff --git a/upload_pipeline.sh b/upload_pipeline.sh new file mode 100755 index 0000000..967ed75 --- /dev/null +++ b/upload_pipeline.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +TEAM=sothr +PIPELINE=sothr-dot-com + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +pushd "${DIR}" + +fly -t ${TEAM} set-pipeline --pipeline ${PIPELINE} --config pipeline.yml + +popd