From 95c87fad2b6374d0aec64804a3f268a0ab6e89aa Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Wed, 28 Aug 2019 09:22:15 +0100 Subject: [PATCH] HMBXR5601-827 - Publish package --- publish/package.groovy | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/publish/package.groovy b/publish/package.groovy index eac8553..8e91143 100644 --- a/publish/package.groovy +++ b/publish/package.groovy @@ -92,7 +92,7 @@ pipeline { } } } - stage('Create snapshot - if not already there') { + stage('Create snapshot') { steps { script { echo "Snapshot name is ${SNAPSHOT_NAME}" @@ -109,6 +109,21 @@ pipeline { } } } + stage('Publish snapshot') { + steps { + script { + echo "Snapshot name is ${SNAPSHOT_NAME}" + FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}" + echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME}" + sh """#!/bin/bash -v + # This errors if the published repo exists already; Ignore it + aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" + aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" + if [ \$? -ne 0 ]; then exit 1; fi + """ + } + } + } } post { always {