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
01aa9f8dc6
commit
5e914f13c9
|
@ -1,13 +1,13 @@
|
||||||
static def imageName = "jdk14-alpine"
|
def IMAGE_BASE_NAME
|
||||||
static def releaseTagPrefix = "release-"
|
def RELEASE_TAG_PREFIX
|
||||||
static def registryHost = "git.tswf.io"
|
def REGISTRY_HOST
|
||||||
|
|
||||||
def resolveImageTag(env) {
|
def resolveImageTag(env) {
|
||||||
return env.TAG_NAME?.replace(releaseTagPrefix, '') ?: 'latest'
|
return env.TAG_NAME?.replace(RELEASE_TAG_PREFIX, '') ?: 'latest'
|
||||||
}
|
}
|
||||||
|
|
||||||
def resolveImageName(env) {
|
def resolveImageName(env) {
|
||||||
return "${registryHost}/docker-base-images/${imageName}:${resolveImageTag(env)}"
|
return "${REGISTRY_HOST}/docker-base-images/${IMAGE_BASE_NAME}:${resolveImageTag(env)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
|
@ -24,6 +24,9 @@ pipeline {
|
||||||
sh "apk update && apk add --no-cache git"
|
sh "apk update && apk add --no-cache git"
|
||||||
// Try to get tag name from git repo if it empty. By default this env fills only at tag builds in Jenkins
|
// Try to get tag name from git repo if it empty. By default this env fills only at tag builds in Jenkins
|
||||||
script {
|
script {
|
||||||
|
IMAGE_BASE_NAME = "jdk14-alpine"
|
||||||
|
RELEASE_TAG_PREFIX = "release-"
|
||||||
|
REGISTRY_HOST = "git.tswf.io"
|
||||||
if (env.TAG_NAME == null) {
|
if (env.TAG_NAME == null) {
|
||||||
env.TAG_NAME = sh(returnStdout: true, script: "git tag --points-at HEAD").trim()
|
env.TAG_NAME = sh(returnStdout: true, script: "git tag --points-at HEAD").trim()
|
||||||
}
|
}
|
||||||
|
@ -37,10 +40,10 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('push_docker') {
|
stage('push_docker') {
|
||||||
when {
|
when {
|
||||||
tag "${releaseTagPrefix}*"
|
tag "${RELEASE_TAG_PREFIX}*"
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh "docker login ${registryHost} -u ${env.GITEA_USER} -p ${env.GITEA_OAUTH_TOKEN}"
|
sh "docker login ${REGISTRY_HOST} -u ${env.GITEA_USER} -p ${env.GITEA_OAUTH_TOKEN}"
|
||||||
sh "docker image push ${resolveImageName(env)}"
|
sh "docker image push ${resolveImageName(env)}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue