From cdc38a9f5a0f6171111b92380cd4bfe1f913c8b7 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 16 Nov 2025 05:45:52 -0600 Subject: [PATCH] ci: Begin Jenkins pipeline --- ci/Jenkinsfile | 52 +++++++++++++++++++++++++++++++++++++++++++++ ci/build.sh | 21 ++++++++++++++++++ ci/podTemplate.yaml | 24 +++++++++++++++++++++ ci/prepare.sh | 8 +++++++ 4 files changed, 105 insertions(+) create mode 100644 ci/Jenkinsfile create mode 100644 ci/build.sh create mode 100644 ci/podTemplate.yaml create mode 100644 ci/prepare.sh diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile new file mode 100644 index 0000000..113ed2a --- /dev/null +++ b/ci/Jenkinsfile @@ -0,0 +1,52 @@ +pipeline { + agent none + + stages { + stage('RPM') { + matrix { + axes { + axis { + name 'FEDORA' + values '41', '42' + } + } + + agent { + kubernetes { + yamlFile 'ci/podTemplate.yaml' + yamlMergeStrategy merge() + defaultContainer 'fedora' + containerTemplate { + name 'fedora' + image "registry.fedoraproject.org/fedora:${FEDORA}" + } + } + } + + stages { + stage('Prepare') { + steps { + sh '. ci/prepare.sh' + } + } + + stage('Build') { + steps { + sh '. ci/build.sh' + } + } + } + } + } + } + + post { + failure { + emailext( + to: 'gyrfalcon@ebonfire.com', + subject: '$DEFAULT_SUBJECT', + body: '$DEFAULT_CONTENT', + ) + } + } +} diff --git a/ci/build.sh b/ci/build.sh new file mode 100644 index 0000000..0c11384 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ $(id -u) -eq 0 ]; then + exec setpriv --clear-groups --reuid 1000 --regid 1000 --inh-caps=-all \ + sh -ex ci/build.sh +fi + +git_rev=$( + sed -nr '/^%global git_revision_full/s/.* ([a-z0-9]{40})$/\1/p' \ + gasket-driver.spec +) +curl -fL \ + -o gasket-driver-${git_rev}.tar.gz \ + https://github.com/google/gasket-driver/archive/${git_rev}.tar.gz + +rpmbuild \ + -D "_topdir ${PWD}" \ + -D '_sourcedir %{_topdir}' \ + -ba gasket-driver.spec + +ln RPMS/*/*.rpm SRPMS/*.rpm . diff --git a/ci/podTemplate.yaml b/ci/podTemplate.yaml new file mode 100644 index 0000000..f43ae33 --- /dev/null +++ b/ci/podTemplate.yaml @@ -0,0 +1,24 @@ +spec: + containers: + - name: fedora + command: + - cat + stdin: true + tty: true + resources: + requests: + cpu: 1500m + securityContext: + runAsUser: 0 + runAsGroup: 0 + volumeMounts: + - mountPath: /etc/ssh/ssh_known_hosts + name: ssh-known-hosts + subPath: ssh_known_hosts + hostUsers: false + nodeSelector: + du5t1n.me/jenkins: + volumes: + - name: ssh-known-hosts + configMap: + name: ssh-known-hosts diff --git a/ci/prepare.sh b/ci/prepare.sh new file mode 100644 index 0000000..42755a3 --- /dev/null +++ b/ci/prepare.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +xargs dnf install -y --setopt install_weak_deps=0 <