mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-03-18 14:05:29 +01:00
62 lines
2.0 KiB
Groovy
62 lines
2.0 KiB
Groovy
def dockerImage
|
|
//jenkins needs entrypoint of the image to be empty
|
|
// def runArgs = '--entrypoint \'\''
|
|
pipeline {
|
|
agent {
|
|
label 'linux-x64'
|
|
}
|
|
options {
|
|
buildDiscarder(logRotator(numToKeepStr: '100', artifactNumToKeepStr: '20'))
|
|
timestamps()
|
|
}
|
|
stages {
|
|
stage ('Environment') {
|
|
steps {
|
|
sh 'printenv'
|
|
}
|
|
}
|
|
stage('Build') {
|
|
options { timeout(time: 30, unit: 'MINUTES') }
|
|
steps {
|
|
script {
|
|
dockerImage = docker.build("albert/headscale-webui:${env.BRANCH_NAME}-${env.BUILD_ID}",
|
|
"--label \"GIT_COMMIT=${env.GIT_COMMIT}\""
|
|
+ " ."
|
|
)
|
|
}
|
|
}
|
|
}
|
|
stage('Test') {
|
|
options { timeout(time: 3, unit: 'MINUTES') }
|
|
steps {
|
|
script {
|
|
docker.image("albert/headscale-webui:${env.BRANCH_NAME}-${env.BUILD_ID}").inside {
|
|
sh 'ls /app'
|
|
sh '. /app/.venv/bin/activate'
|
|
sh 'exec $@'
|
|
sh 'apk add curl'
|
|
sh 'curl localhost:5000'
|
|
sh 'apk del curl'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Push') {
|
|
options { timeout(time: 5, unit: 'MINUTES') }
|
|
steps {
|
|
script {
|
|
if (env.BRANCH_NAME == '*-testing') {
|
|
docker.withRegistry('https://git.sysctl.io/', 'gitea-jenkins-pat') {
|
|
dockerImage.push("${env.BRANCH_NAME}-${env.BUILD_ID}")
|
|
}
|
|
}
|
|
if (env.BRANCH_NAME == 'main') {
|
|
docker.withRegistry('https://git.sysctl.io/', 'gitea-jenkins-pat') {
|
|
dockerImage.push("latest")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |