ci: Add Jenkins build+publish pipeline

master
Dustin 2025-07-02 15:15:28 -05:00
parent 1822514b36
commit 06ffb6713c
5 changed files with 59 additions and 1 deletions

7
.rsync-filter Normal file
View File

@ -0,0 +1,7 @@
- .git/
- ci/
- *.j2
- .gitignore
- Makefile
- publish.sh
- render.py

View File

@ -4,12 +4,15 @@ KICKSTARTS = \
fedora-rpi.ks \
fedora.ks
.PHONY: all clean
.PHONY: all clean publish
all: $(KICKSTARTS)
%.ks: %.ks.j2
python3 render.py $< > $@
publish:
sh publish.sh
clean:
rm -f $(KICKSTARTS)

29
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,29 @@
pipeline {
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
yamlMergeStrategy merge()
defaultContainer 'build'
}
}
stages {
stage('Build') {
steps {
sh 'make'
}
}
stage('Publish') {
environment {
PUBLISH_PATH = "/var/www/html/kickstart/${BRANCH_NAME}/"
}
steps {
sshagent(['jenkins-pxe']) {
sh 'make publish'
}
}
}
}
}

12
ci/podTemplate.yaml Normal file
View File

@ -0,0 +1,12 @@
spec:
containers:
- name: build
image: git.pyrocufflink.net/containerimages/jenkins-common
volumeMounts:
- mountPath: /etc/ssh/ssh_known_hosts
name: ssh-known-hosts
subPath: ssh_known_hosts
volumes:
- name: ssh-known-hosts
configMap:
name: ssh-known-hosts

7
publish.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
: "${PUBLISH_HOST:=$(getent hosts pxe.pyrocufflink.blue | cut -d' ' -f2 | head -n1)}"
: "${PUBLISH_PATH:=/var/www/html/kickstart/}"
ssh "${PUBLISH_HOST}" mkdir -p "${PUBLISH_PATH}"
rsync ${PRETEND+-n} -aiFF --delete ./ "${PUBLISH_HOST}:${PUBLISH_PATH}"