From 89750b3773dfc2729bf8446a4d618e3648e58c14 Mon Sep 17 00:00:00 2001 From: Edward Date: Tue, 24 Sep 2019 09:49:27 +1000 Subject: [PATCH] Only publish on Azure for SNAPSHOT releases (#43) * Only publish on Azure for SNAPSHOT releases Signed-off-by: Edward Evans * Fix comment char Signed-off-by: Edward Evans --- Jenkinsfile | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d9c7735a4a..e0aede6da7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -298,18 +298,25 @@ exit $status docker.image(docker_image_dind).withRun('--privileged') { d -> docker.image(build_image).inside("--link ${d.id}:docker") { - stage(stage_name + 'Prepare') { - sh './gradlew --no-daemon --parallel clean assemble' + stage(stage_name + 'Calculate variables') { + def gradleProperties = readProperties file: 'gradle.properties' + version = gradleProperties.version } - stage(stage_name + 'Publish') { - withCredentials([ - usernamePassword( - credentialsId: 'hyperledger-azure', - usernameVariable: 'AZURE_USER', - passwordVariable: 'AZURE_KEY' - ) - ]) { - sh './gradlew --no-daemon --parallel publish' + + if (version ==~ /.*-SNAPSHOT/) { // Only publish snapshots to Azure + stage(stage_name + 'Prepare') { + sh './gradlew --no-daemon --parallel clean assemble' + } + stage(stage_name + 'Publish') { + withCredentials([ + usernamePassword( + credentialsId: 'hyperledger-azure', + usernameVariable: 'AZURE_USER', + passwordVariable: 'AZURE_KEY' + ) + ]) { + sh './gradlew --no-daemon --parallel publish' + } } } }