ci: Build in Kubernetes
dustin/dustin.web/pipeline/pr-master This commit looks good
Details
dustin/dustin.web/pipeline/pr-master This commit looks good
Details
Can't use the official Zola container image because it doesn't have a shell, so Jenkins can't run commands in it.pull/1/head
parent
12c99fb5f0
commit
fab714379c
|
@ -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
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
dockerfile {
|
kubernetes {
|
||||||
dir 'ci'
|
yamlFile 'ci/podTemplate.yaml'
|
||||||
filename 'Containerfile'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,22 +11,29 @@ pipeline {
|
||||||
disableConcurrentBuilds()
|
disableConcurrentBuilds()
|
||||||
}
|
}
|
||||||
|
|
||||||
triggers {
|
environment {
|
||||||
pollSCM ''
|
HOME = "${env.WORKSPACE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh '. ci/build.sh'
|
container('zola') {
|
||||||
|
sh 'zola build --base-url /'
|
||||||
|
}
|
||||||
|
container('python') {
|
||||||
|
sh '. ci/build.sh'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish') {
|
stage('Publish') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['jenkins-web']) {
|
container('rsync') {
|
||||||
sh '. ci/publish.sh'
|
sshagent(['jenkins-web']) {
|
||||||
|
sh '. ci/publish.sh'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
zola build --base-url /
|
python3 -m pip install --user ruamel.yaml
|
||||||
|
|
||||||
python3 /dev/fd/3 < songquotes.yml > public/songquotes.json 3<<EOF
|
python3 /dev/fd/3 < songquotes.yml > public/songquotes.json 3<<EOF
|
||||||
from ruamel.yaml import safe_load as load
|
from ruamel.yaml import safe_load as load
|
||||||
from json import dump
|
from json import dump
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 1000
|
||||||
|
containers:
|
||||||
|
- name: zola
|
||||||
|
image: git.pyrocufflink.net/containerimages/zola
|
||||||
|
- name: python
|
||||||
|
image: docker.io/python:3.10
|
||||||
|
command:
|
||||||
|
- python
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- import signal; signal.pause()
|
||||||
|
- name: rsync
|
||||||
|
image: git.pyrocufflink.net/containerimages/rsync
|
||||||
|
command:
|
||||||
|
- python3
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- import signal; signal.pause()
|
Loading…
Reference in New Issue