From c4b73a869e25ca947f9c314b1a3c9928b5ef723a Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 23 Aug 2021 20:27:46 -0500 Subject: [PATCH] Add CI build/publish pipeline --- ci/Containerfile | 11 +++++++++++ ci/Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ ci/build.sh | 1 + ci/publish.sh | 5 +++++ 4 files changed, 53 insertions(+) create mode 100644 ci/Containerfile create mode 100644 ci/Jenkinsfile create mode 100644 ci/build.sh create mode 100644 ci/publish.sh diff --git a/ci/Containerfile b/ci/Containerfile new file mode 100644 index 0000000..ec7bfc7 --- /dev/null +++ b/ci/Containerfile @@ -0,0 +1,11 @@ +FROM alpine + +RUN useradd -u 3000018 -l -M -d / jenkins + +RUN apk update && \ + apk add zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ && \ + apk add \ + openssh-client-default \ + rsync \ + && \ + rm -rf /var/cache/apk/* diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile new file mode 100644 index 0000000..8184b16 --- /dev/null +++ b/ci/Jenkinsfile @@ -0,0 +1,36 @@ +// vim: set ft=groovy sw=4 ts=4 sts=4 et : + +pipeline { + agent { + dockerfile { + dir 'ci' + filename 'Containerfile' + } + } + + options { + disableConcurrentBuilds() + } + + triggers { + pollSCM '' + } + + stages { + + stage('Build') { + steps { + sh '. ci/build.sh' + } + } + + stage('Publish') { + steps { + sshagent(['jenkins-web']) { + sh '. ci/publish.sh' + } + } + } + + } +} diff --git a/ci/build.sh b/ci/build.sh new file mode 100644 index 0000000..e39cedb --- /dev/null +++ b/ci/build.sh @@ -0,0 +1 @@ +zola build diff --git a/ci/publish.sh b/ci/publish.sh new file mode 100644 index 0000000..970dc9f --- /dev/null +++ b/ci/publish.sh @@ -0,0 +1,5 @@ +PUBLISH_HOST=web0.pyrocufflink.blue +PUBLISH_USER=webapp.dchblog +PUBLISH_PATH=htdocs/ + +rsync -aP public/ ${PUBLISH_USER}@${PUBLISH_USER}:${PUBLISH_PATH}