wip: ci: run in kubernetes
dustin/basementhud/pipeline/pr-master There was a failure building this commit Details

Dustin 2022-11-25 16:24:30 -06:00
parent 03da29b5a6
commit 8eb6d78f6f
3 changed files with 57 additions and 31 deletions

11
.editorconfig Normal file
View File

@ -0,0 +1,11 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[Jenkinsfile]
indent_style = space
indent_size = 4

39
ci/Jenkinsfile vendored
View File

@ -1,11 +1,8 @@
DOCKER_BUILD_ARGS = '''\
--build-arg UID=$(id -u) \
--build-arg GID=$(id -g) \
'''
pipeline { pipeline {
agent { agent {
label 'docker && aarch64' kubernetes {
yamlFile 'ci/podTemplate.yaml'
}
} }
options { options {
@ -13,10 +10,6 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
} }
triggers {
pollSCM ''
}
parameters { parameters {
booleanParam \ booleanParam \
name: 'Clean', name: 'Clean',
@ -25,15 +18,8 @@ pipeline {
stages { stages {
stage('Build') { stage('Build') {
agent {
dockerfile {
reuseNode true
dir 'ci'
args '--privileged -u 0:0'
additionalBuildArgs DOCKER_BUILD_ARGS
}
}
steps { steps {
container('build') {
script { script {
if (params.Clean) { if (params.Clean) {
sh 'rm -rf _build' sh 'rm -rf _build'
@ -46,6 +32,13 @@ pipeline {
sh 'install aarch64/mqttdpms overlay/usr/local/bin/' sh 'install aarch64/mqttdpms overlay/usr/local/bin/'
sh 'make rootfs initramfs' sh 'make rootfs initramfs'
} }
copyArtifacts \
filter: 'aarch64/mqttdpms',
projectName: '../mqttdpms/master',
selector: lastSuccessful()
sh 'install aarch64/mqttdpms overlay/usr/local/bin/'
sh 'make rootfs initramfs'
}
} }
stage('Publish') { stage('Publish') {
@ -54,15 +47,8 @@ pipeline {
changeRequest() changeRequest()
} }
} }
agent {
dockerfile {
reuseNode true
dir 'ci'
args '-v /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts'
additionalBuildArgs DOCKER_BUILD_ARGS
}
}
steps { steps {
container('publish') {
sshagent(['jenkins-pxe']) { sshagent(['jenkins-pxe']) {
sh 'make publish' sh 'make publish'
} }
@ -70,3 +56,4 @@ pipeline {
} }
} }
} }
}

28
ci/podTemplate.yaml Normal file
View File

@ -0,0 +1,28 @@
spec:
nodeSelector:
kubernetes.io/arch: arm64
terminationGracePeriodSeconds: 0
containers:
- name: build
image: registry.pyrocufflink.blue/build/basementhud
command:
- sleep
- infinity
securityContext:
readOnlyRootFilesystem: true
privileged: true
volumeMounts:
- name: tmp
mountPath: /tmp
- name: publish
image: registry.fedoraproject.org/fedora
command:
- sleep
- infinity
securityContext:
readOnlyRootFilesystem: true
runAsUser: 1000
volumes:
- name: tmp
emptyDir:
medium: Memory