ci: Begin Jenkins build pipeline
dustin/dynk8s-provisioner/pipeline/head This commit looks good
Details
dustin/dynk8s-provisioner/pipeline/head This commit looks good
Details
parent
ac1b20d910
commit
c8e0fe1256
|
@ -0,0 +1,4 @@
|
||||||
|
target/
|
||||||
|
!target/*/dynk8s-provisioner
|
||||||
|
src/
|
||||||
|
test/
|
|
@ -8,3 +8,8 @@ trim_trailing_whitespace = true
|
||||||
|
|
||||||
[**.rs]
|
[**.rs]
|
||||||
max_line_length = 79
|
max_line_length = 79
|
||||||
|
|
||||||
|
[Jenkinsfile]
|
||||||
|
max_line_length = 79
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
FROM fedora:36
|
||||||
|
|
||||||
|
COPY target/release/dynk8s-provisioner /usr/bin/
|
||||||
|
|
||||||
|
CMD ["/usr/bin/dynk8s-provisioner"]
|
|
@ -0,0 +1,63 @@
|
||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
kubernetes {
|
||||||
|
yamlFile 'ci/podTemplate.yaml'
|
||||||
|
workspaceVolume dynamicPVC()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
options {
|
||||||
|
buildDiscarder logRotator(numToKeepStr: '5')
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
CARGO_HOME = "${env.WORKSPACE}/.cargo"
|
||||||
|
TMPDIR = "${env.WORKSPACE_TMP}"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Test') {
|
||||||
|
steps {
|
||||||
|
container('build') {
|
||||||
|
sh '. ci/test.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
container('build') {
|
||||||
|
sh '. ci/build.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
dir('target/release') {
|
||||||
|
archiveArtifacts 'dynk8s-provisioner'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Container') {
|
||||||
|
steps {
|
||||||
|
container('podman') {
|
||||||
|
sh '. ci/container.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish') {
|
||||||
|
steps {
|
||||||
|
container('podman') {
|
||||||
|
withCredentials([usernameColonPassword(
|
||||||
|
credentialsId: 'jenkins-packages', variable: 'PODMAN_AUTH'
|
||||||
|
)]) {
|
||||||
|
sh '. ci/publish.sh'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
cargo build --release
|
|
@ -0,0 +1,5 @@
|
||||||
|
# shellcheck: shell=sh
|
||||||
|
|
||||||
|
tag_name() {
|
||||||
|
echo "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g' -e 's/^[.-]/_/'
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
. ci/common.sh
|
||||||
|
|
||||||
|
podman build -t dynk8s-provisioner:$(tag_name ${BUILD_TAG}) .
|
|
@ -0,0 +1,19 @@
|
||||||
|
spec:
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 1000
|
||||||
|
containers:
|
||||||
|
- name: build
|
||||||
|
image: docker.io/rust:1.63
|
||||||
|
command:
|
||||||
|
- sleep
|
||||||
|
- infinity
|
||||||
|
securityContext:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsUser: 1000
|
||||||
|
- name: podman
|
||||||
|
image: quay.io/containers/podman:v3.4
|
||||||
|
command:
|
||||||
|
- sleep
|
||||||
|
- infinity
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
. ci/common.sh
|
||||||
|
|
||||||
|
remote=git.pyrocufflink.blue/packages/dynk8s-provisioner
|
||||||
|
t=$(tag_name ${BUILD_TAG})
|
||||||
|
podman push --creds="${PODMAN_AUTH}" dynk8s-provisioner:${t} ${remote}:${t}
|
||||||
|
podman push --creds="${PODMAN_AUTH}" dynk8s-provisioner:${t} ${remote}:$(tag_name ${BRANCH_NAME})
|
||||||
|
if [ "${BRANCH_NAME}" = master ]; then
|
||||||
|
podman push --creds="${PODMAN_AUTH}" dynk8s-provisioner:${t} ${remote}:latest
|
||||||
|
fi
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
cargo test
|
Loading…
Reference in New Issue