ci: Switch to K8s build agent #2

Manually merged
dustin merged 1 commits from ci-kubernetes into master 2022-08-29 16:50:27 +00:00
3 changed files with 29 additions and 41 deletions

View File

@ -1,27 +0,0 @@
FROM registry.fedoraproject.org/fedora:30
ARG UID
ARG GID
RUN groupadd -g ${GID} jenkins \
&& useradd -u ${UID} -g ${GID} -m -d /var/lib/jenkins -l jenkins
RUN dnf install -y \
bc \
bzip2 \
cpio \
diffutils \
g++ \
gcc \
git \
make \
ncurses-devel \
openssh-clients \
patch \
perl-ExtUtils-MakeMaker \
perl-Thread-Queue \
rsync \
systemd \
wget \
which \
&& dnf clean all

23
ci/Jenkinsfile vendored
View File

@ -2,16 +2,12 @@
pipeline { pipeline {
agent { agent {
dockerfile { kubernetes {
dir 'ci' yamlFile 'ci/podTemplate.yaml'
args ''' defaultContainer 'buildroot'
-v /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts workspaceVolume persistentVolumeClaimWorkspaceVolume(
--pids-limit 16384 claimName: 'jenkins-ws-metricspi'
''' )
additionalBuildArgs '''\
--build-arg UID=$(id -u) \
--build-arg GID=$(id -g) \
'''
} }
} }
@ -20,10 +16,6 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
} }
triggers {
pollSCM ''
}
parameters { parameters {
booleanParam \ booleanParam \
name: 'Clean', name: 'Clean',
@ -32,6 +24,9 @@ pipeline {
environment { environment {
BUILDROOT_SRC = "${env.WORKSPACE}/buildroot" BUILDROOT_SRC = "${env.WORKSPACE}/buildroot"
TMPDIR = "${env.WORKSPACE_TMP}"
TEMP = "${env.WORKSPACE_TMP}"
TMP = "${env.WORKSPACE_TMP}"
} }
stages { stages {

20
ci/podTemplate.yaml Normal file
View File

@ -0,0 +1,20 @@
spec:
securityContext:
fsGroup: 1000
containers:
- name: buildroot
image: registry.pyrocufflink.blue/buildroot
command:
- sleep
- infinity
volumeMounts:
- name: tmp
mountPath: /tmp
securityContext:
readOnlyRootFilesystem: true
runAsUser: 1000
volumes:
- name: tmp
emptyDir:
medium: Memory
sizeLimit: 100Mi