Skip to content

Commit

Permalink
Fix ANT pattern & tag version
Browse files Browse the repository at this point in the history
This commit:
 - Switch the tags & branches selector from regex to ANT style patterns since jenkins doesn't support the former in declarative pipelines
 - Extracts the project version with a maven command and use it as docker image tag
  • Loading branch information
Alberto Brigandì authored and alberto-brigandi committed Nov 12, 2018
1 parent 8edb983 commit d367847
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,25 @@ pipeline {
when {
anyOf {
branch 'master'
buildingTag()
branch 'releases/*'
tag 'v*'
}
}
agent {
label 'docker-build'
}
steps {
checkout scm
dir("$WORKSPACE/docker") {
script {
dockerhub_image_id = DockerBuild(dockerhub_repo, env.BRANCH_NAME)
}
script {
PROJECT_VERSION="""${sh([
returnStdout: true,
script: 'mvn -q -Dexec.executable=echo -Dexec.args=\'${project.version}\' --non-recursive exec:exec']).trim()
}"""
MavenRun('-DskipTests=true package')
dockerhub_image_id = DockerBuild(
dockerhub_repo,
PROJECT_VERSION,
'docker')
}
}
post {
Expand All @@ -124,15 +131,15 @@ pipeline {

stage('Notifications') {
when {
buildingTag()
tag 'v*'
}
steps {
steps {
JiraIssueNotification(
'DEEP',
'DPM',
'10204',
"[preview-testbed] New Orchestrator version ${env.BRANCH_NAME} available",
"Check new artifacts at:\n\t- Docker image: [${dockerhub_image_id}:${env.BRANCH_NAME}|https://hub.docker.com/r/${dockerhub_image_id}/tags/]",
"Check new artifacts at:\n\t- Docker image: [${dockerhub_image_id}|https://hub.docker.com/r/${dockerhub_repo}/tags/]",
['wp3', 'preview-testbed', "orchestrator-${env.BRANCH_NAME}"],
'Task',
'mariojmdavid'
Expand Down

0 comments on commit d367847

Please sign in to comment.