try git ref
Some checks are pending
Build Multiarch Container Image / call-reusable-workflow (push) Waiting to run
Some checks are pending
Build Multiarch Container Image / call-reusable-workflow (push) Waiting to run
This commit is contained in:
parent
9e35d642b8
commit
7094d75d91
1 changed files with 4 additions and 2 deletions
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
|
@ -5,12 +5,14 @@ pipeline {
|
||||||
returnStdout: true,
|
returnStdout: true,
|
||||||
script: 'git describe --tags --exact-match 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD'
|
script: 'git describe --tags --exact-match 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD'
|
||||||
).trim()}"""
|
).trim()}"""
|
||||||
|
CONTAINER_REGISTRY = credentials('container_registry')
|
||||||
|
REPO_NAME = env.GIT_URL.replaceFirst(/^.*\/([^\/]+?).git$/, '$1')
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when { tag "*" }
|
when { tag "*" }
|
||||||
steps {
|
steps {
|
||||||
sh "podman build -t docker.io/thallian/atuin:${env.GIT_REF} ."
|
sh "podman build -t ${CONTAINER_REGISTRY}/${REPO_NAME}:${env.GIT_REF} ."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Push') {
|
stage('Push') {
|
||||||
|
@ -19,7 +21,7 @@ pipeline {
|
||||||
withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'REG_USERNAME', passwordVariable: 'REG_PASSWORD')]) {
|
withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'REG_USERNAME', passwordVariable: 'REG_PASSWORD')]) {
|
||||||
sh '''
|
sh '''
|
||||||
podman login docker.io -u $REG_USERNAME -p $REG_PASSWORD
|
podman login docker.io -u $REG_USERNAME -p $REG_PASSWORD
|
||||||
podman push docker.io/thallian/atuin:${GIT_REF}
|
podman push ${CONTAINER_REGISTRY}/${REPO_NAME}:${GIT_REF}
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue