From cf74948db8d1c33e49c14428948aa8fca182e3bf Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 2 Dec 2022 21:36:03 -0600 Subject: [PATCH] wip: ci: Build in Kubernetes --- ci/Containerfile | 15 --------------- ci/Jenkinsfile | 22 ++++++++++++---------- ci/build.sh | 2 -- ci/podTemplate.yaml | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 27 deletions(-) delete mode 100644 ci/Containerfile create mode 100644 ci/podTemplate.yaml diff --git a/ci/Containerfile b/ci/Containerfile deleted file mode 100644 index f7a735b..0000000 --- a/ci/Containerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM alpine - -RUN echo jenkins:*:3000018:3000017::/var/lib/jenkins:/bin/bash >> /etc/passwd - -RUN apk update && \ - apk add zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ && \ - apk add \ - openssh-client-default \ - python3 \ - py3-ruamel.yaml \ - rsync \ - && \ - rm -rf /var/cache/apk/* - -COPY ssh_known_hosts /etc/ssh/ssh_known_hosts diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 8184b16..cf91b20 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -2,9 +2,8 @@ pipeline { agent { - dockerfile { - dir 'ci' - filename 'Containerfile' + kubernetes { + yaml 'ci/podTemplate.yaml' } } @@ -12,22 +11,25 @@ pipeline { disableConcurrentBuilds() } - triggers { - pollSCM '' - } - stages { stage('Build') { steps { - sh '. ci/build.sh' + container('zola') { + sh 'zola build --base-url /' + } + container('python') { + sh '. ci/build.sh' + } } } stage('Publish') { steps { - sshagent(['jenkins-web']) { - sh '. ci/publish.sh' + container('rsync') { + sshagent(['jenkins-web']) { + sh '. ci/publish.sh' + } } } } diff --git a/ci/build.sh b/ci/build.sh index df57139..ee15819 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -1,5 +1,3 @@ -zola build --base-url / - python3 /dev/fd/3 < songquotes.yml > public/songquotes.json 3<