Compare commits

...

2 Commits

Author SHA1 Message Date
Dustin 4e78c48fbf xxx
infra/dch-autoprovision/pipeline/head This commit looks good Details
2025-08-14 08:35:08 -05:00
Dustin c88b4c42e8 wip: ci: Add Jenkins build pipeline
infra/dch-autoprovision/pipeline/head This commit looks good Details
2025-08-14 08:35:08 -05:00
6 changed files with 167 additions and 0 deletions

84
ci/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,84 @@
pipeline {
agent none
stages {
stage('RPM') {
matrix {
axes {
axis {
name 'ARCH'
values 'amd64', 'arm64'
}
axis {
name 'FEDORA'
values '41', '42'
}
}
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
yamlMergeStrategy merge()
defaultContainer 'build'
nodeSelector "kubernetes.io/arch=${ARCH}"
containerTemplate {
name 'build'
image "registry.fedoraproject.org/fedora:${FEDORA}"
}
}
}
environment {
GNUPGHOME = "${env.WORKSPACE_TMP}/gnupg"
}
stages {
stage('Prepare') {
steps {
sh '. ci/prepare.sh'
}
}
stage('Build') {
steps {
sh '. ci/build.sh'
script {
if (env.BRANCH_NAME == 'dev/ci') {
withCredentials([
file(
credentialsId: 'rpm-gpg-key',
variable: 'RPM_GPG_PRIVATE_KEY',
),
file(
credentialsId: 'rpm-gpg-key-passphrase',
variable: 'RPM_GPG_KEY_PASSPHRASE',
),
]) {
sh '. ci/sign-rpms.sh'
}
}
}
}
post {
success {
archiveArtifacts "f${FEDORA}/**/*.rpm"
}
}
}
stage('Publish') {
when {
branch 'dev/ci'
}
steps {
sshagent(['jenkins-repohost']) {
sh '. ci/publish.sh'
}
}
}
}
}
}
}
}

6
ci/build.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
install -o 1000 -g 1000 -d f${FEDORA}
setpriv --reuid 1000 --regid 1000 --keep-groups \
make O=f${FEDORA} srpm rpm

19
ci/podTemplate.yaml Normal file
View File

@ -0,0 +1,19 @@
spec:
containers:
- name: build
command: &sleep
- /bin/sh
- -c
- |
trap 'kill $!' TERM
sleep infinity &
wait
volumeMounts:
- mountPath: /etc/ssh/ssh_known_hosts
name: ssh-known-hosts
subPath: ssh_known_hosts
hostUsers: false
volumes:
- name: ssh-known-hosts
configMap:
name: ssh-known-hosts

16
ci/prepare.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
xargs dnf install -y <<EOF
git-core
make
openssh-clients
rpm-build
rpm-sign
rsync
systemd-rpm-macros
EOF
install -m u=rwx,go= -d "${GNUPGHOME}"
cat > "${GNUPGHOME}"/gpg-agent.conf <<EOF
allow-loopback-pinentry
EOF

31
ci/publish.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/sh
ARCH="$(uname -m)"
REPO_HOST=jenkins@files.pyrocufflink.blue
REPO_PATH=/srv/www/repohost/repos/dch/fedora/$(rpm --eval %fedora)
ssh-add -l
ssh-add -L
mkdir -p "${WORKSPACE_TMP}/sync"
cd "${WORKSPACE_TMP}/sync"
ln "${WORKSPACE}/f${FEDORA}"/*.rpm .
ln "${WORKSPACE}/f${FEDORA}/${ARCH}"/*.rpm .
case "${ARCH}" in
x86_64)
# only include the SRPM once
include='*.rpm'
;;
*)
include="*.${ARCH}.rpm"
;;
esac
rsync -rtiO \
--chmod=ugo=rwX \
--include "${include}" \
--exclude '*' \
--dry-run \
./ \
"${REPO_HOST}:${REPO_PATH}/"

11
ci/sign-rpms.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
gpg2 --pinentry-mode loopback --passphrase-fd 0 \
--import "${RPM_GPG_PRIVATE_KEY}" \
< "${RPM_GPG_KEY_PASSPHRASE}"
rpmsign --addsign \
-D '_gpg_name jenkins@pyrocufflink.net' \
-D '_gpg_sign_cmd_extra_args --pinentry-mode loopback --passphrase-fd 3' \
f${FEDORA}/$(uname -m)/*.rpm \
3< "${RPM_GPG_KEY_PASSPHRASE}"