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
1915d9bbff
commit
5af844f4d5
1 changed files with 5 additions and 4 deletions
9
Jenkinsfile
vendored
9
Jenkinsfile
vendored
|
@ -6,7 +6,8 @@ pipeline {
|
|||
script: 'git describe --tags --exact-match 2>/dev/null || git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD'
|
||||
).trim()}"""
|
||||
CONTAINER_REGISTRY = credentials('container_registry')
|
||||
REPO_NAME = env.GIT_URL.replaceFirst(/^.*\/([^\/]+)\/([^\/]+?)\.git$/, '$1/$2')
|
||||
REGISTRY_NAMESPACE = credentials('registry_namespace')
|
||||
REPO_NAME = env.GIT_URL.replaceFirst(/^.*\/([^\/]+?).git$/, '$1')
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
|
@ -14,7 +15,7 @@ pipeline {
|
|||
steps {
|
||||
sh "printenv"
|
||||
sh "echo $REPO_NAME"
|
||||
sh "podman build -t ${CONTAINER_REGISTRY}/${REPO_NAME}:${env.BRANCH_NAME} ."
|
||||
sh "podman build -t ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME} ."
|
||||
}
|
||||
}
|
||||
stage('Push') {
|
||||
|
@ -22,8 +23,8 @@ pipeline {
|
|||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'REG_USERNAME', passwordVariable: 'REG_PASSWORD')]) {
|
||||
sh '''
|
||||
podman login docker.io -u $REG_USERNAME -p $REG_PASSWORD
|
||||
podman push ${CONTAINER_REGISTRY}/${REPO_NAME}:${GIT_REF}
|
||||
podman login ${CONTAINER_REGISTRY -u ${REG_USERNAME} -p ${REG_PASSWORD}
|
||||
podman push ${CONTAINER_REGISTRY}/${REGISTRY_NAMESPACE}/${REPO_NAME}:${env.BRANCH_NAME}
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue