atuin/Jenkinsfile

33 lines
1.2 KiB
Text
Raw Normal View History

2025-03-06 16:03:07 +01:00
pipeline {
2025-06-03 19:10:54 +02:00
agent { label 'linux-aarch64' }
2025-06-03 18:52:56 +02:00
environment {
2025-06-03 19:03:17 +02:00
GIT_REF = """${sh(
returnStdout: true,
2025-06-03 19:14:47 +02:00
script: 'git describe --tags --exact-match 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD'
2025-06-03 19:03:17 +02:00
).trim()}"""
2025-06-03 19:40:43 +02:00
CONTAINER_REGISTRY = credentials('container_registry')
REPO_NAME = env.GIT_URL.replaceFirst(/^.*\/([^\/]+?).git$/, '$1')
2025-06-03 18:52:56 +02:00
}
2025-03-06 16:03:07 +01:00
stages {
2025-06-03 15:37:00 +00:00
stage('Build') {
2025-06-03 19:17:12 +02:00
when { tag "*" }
2025-03-06 16:03:07 +01:00
steps {
2025-06-04 08:03:08 +02:00
sh "printenv"
2025-06-03 21:34:37 +02:00
sh "echo $REPO_NAME"
2025-06-03 19:40:43 +02:00
sh "podman build -t ${CONTAINER_REGISTRY}/${REPO_NAME}:${env.GIT_REF} ."
2025-03-06 16:03:07 +01:00
}
}
2025-06-03 19:32:22 +02:00
stage('Push') {
when { tag "*" }
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'REG_USERNAME', passwordVariable: 'REG_PASSWORD')]) {
sh '''
podman login docker.io -u $REG_USERNAME -p $REG_PASSWORD
2025-06-03 19:40:43 +02:00
podman push ${CONTAINER_REGISTRY}/${REPO_NAME}:${GIT_REF}
2025-06-03 19:32:22 +02:00
'''
}
}
}
2025-03-06 16:03:07 +01:00
}
2025-06-03 18:38:40 +02:00
}