chore: updated Jenkinsfile
Gitea/docker-base-images/jdk14-alpine/pipeline/head There was a failure building this commit
Details
Gitea/docker-base-images/jdk14-alpine/pipeline/head There was a failure building this commit
Details
parent
5e9c7e0cb7
commit
7a5662ff90
|
@ -1,14 +1,11 @@
|
|||
def resolveImageTag(env) {
|
||||
return env.TAG_NAME?.replace(RELEASE_TAG_PREFIX, '') ?: 'latest'
|
||||
return env.TAG_NAME?.replace(env.RELEASE_TAG_PREFIX, '') ?: 'latest'
|
||||
}
|
||||
|
||||
def resolveImageName(env) {
|
||||
return "${REGISTRY_HOST}/docker-base-images/${IMAGE_BASE_NAME}:${resolveImageTag(env)}"
|
||||
return "${env.REGISTRY_HOST}/docker-base-images/${env.IMAGE_BASE_NAME}:${resolveImageTag(env)}"
|
||||
}
|
||||
|
||||
def IMAGE_BASE_NAME
|
||||
def RELEASE_TAG_PREFIX
|
||||
def REGISTRY_HOST
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
|
@ -22,9 +19,9 @@ pipeline {
|
|||
steps {
|
||||
sh "apk update && apk add --no-cache git"
|
||||
script {
|
||||
IMAGE_BASE_NAME = "jdk14-alpine"
|
||||
RELEASE_TAG_PREFIX = "release-"
|
||||
REGISTRY_HOST = "git.tswf.io"
|
||||
env.IMAGE_BASE_NAME = "jdk14-alpine"
|
||||
env.RELEASE_TAG_PREFIX = "release-"
|
||||
env.REGISTRY_HOST = "git.tswf.io"
|
||||
if (env.TAG_NAME == null) {
|
||||
env.TAG_NAME = sh(returnStdout: true, script: "git tag --points-at HEAD").trim()
|
||||
}
|
||||
|
@ -38,10 +35,10 @@ pipeline {
|
|||
}
|
||||
stage('push_docker') {
|
||||
when {
|
||||
tag "${RELEASE_TAG_PREFIX}*"
|
||||
tag "${env.RELEASE_TAG_PREFIX}*"
|
||||
}
|
||||
steps {
|
||||
sh "docker login ${REGISTRY_HOST} -u ${env.GITEA_USER} -p ${env.GITEA_OAUTH_TOKEN}"
|
||||
sh "docker login ${env.REGISTRY_HOST} -u ${env.GITEA_USER} -p ${env.GITEA_OAUTH_TOKEN}"
|
||||
sh "docker image push ${resolveImageName(env)}"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue