From 8577e38b8bf54f59eab94a4e3ef1394d91f0825b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Dec 2023 14:46:13 +0100 Subject: [PATCH] add CI --- automation/Dockerfile | 18 ++++++++++++++++++ automation/Jenkinsfile | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 automation/Dockerfile create mode 100644 automation/Jenkinsfile diff --git a/automation/Dockerfile b/automation/Dockerfile new file mode 100644 index 0000000..d4a1fd7 --- /dev/null +++ b/automation/Dockerfile @@ -0,0 +1,18 @@ +# npm base container, we need to install some npm dependencies as part of the website build. +FROM node:latest + +RUN apt-get update +RUN apt-get --yes upgrade +# Required in case tzdata is a installed, won't install otherwise +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get --yes install rsync openssh-client + +# Install hugo v0.121.1 +RUN curl -sSL https://github.com/gohugoio/hugo/releases/download/v0.121.1/hugo_0.121.1_darwin-universal.tar.gz | tar -xz --directory /usr/local/bin + +#ssh needs a valid user to work +RUN adduser --uid 114 jenkins + +# add documentation server to known hosts +RUN echo "|1|/LzCV4BuTmTb2wKnD146l9fTKgQ=|NJJtVjvWbtRt8OYqFgcYRnMQyVw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts +RUN echo "|1|CcBvBc3EG03G+XM5rqRHs6gK/Gg=|oGeJQ+1I8NGI2THIkJsW92DpTzs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile new file mode 100644 index 0000000..b50ef74 --- /dev/null +++ b/automation/Jenkinsfile @@ -0,0 +1,26 @@ + +pipeline { + agent { + dockerfile { + dir 'automation' + reuseNode true + args '--network host' + } + } + // agent any + stages { + stage('Deployment') { + when { + branch 'main' + } + steps { + sh 'npm install' + sh 'hugo' + sshagent(credentials: ['documentation-buildfix']) { + // Deploy to Apache webserver + sh "rsync -r --delete --exclude 'content/projects/' --exclude static/fonts/univers public/ buildfix@documentation.irs.uni-stuttgart.de:/" + } + } + } + } +}