From fa39e8f8dd2a6c820abfb33ece6252eddb348c16 Mon Sep 17 00:00:00 2001 From: Luis Gomez Date: Mon, 21 Jan 2019 12:23:26 -0800 Subject: [PATCH] Save infra resources - Only stable AR builds triggers dist test job. Today both stable and not stable trigger distribution test. - Jenkins queue has max 1 dist test job triggered by AR. This is achieved by passing the same parameter BUNDLE_URL=autorelease to the distribution test job, see: https://stackoverflow.com/questions/ 8974170/jenkins-parameterized-job-that-only-queues-one-build How this works: Stable AR will trigger a dist test job with BUNDLE_URL=autorelease, dist test job will resolve autorelease into last stable AR dist URL and will pass this value down to the CSIT jobs. Change-Id: I2bc42f1f2053997d2c364384accc0e68a53d4614 Signed-off-by: Luis Gomez --- jjb/autorelease/autorelease-templates.yaml | 9 ++++----- jjb/integration/integration-detect-variables.sh | 8 ++++++++ jjb/integration/integration-macros.yaml | 4 +++- jjb/integration/integration-test-jobs.yaml | 7 ++++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/jjb/autorelease/autorelease-templates.yaml b/jjb/autorelease/autorelease-templates.yaml index a17b29adc5..559de85f74 100644 --- a/jjb/autorelease/autorelease-templates.yaml +++ b/jjb/autorelease/autorelease-templates.yaml @@ -186,12 +186,11 @@ - opendaylight-infra-notify-status - trigger-parameterized-builds: - project: 'integration-distribution-test-{integration-test}' - condition: UNSTABLE_OR_BETTER - property-file: variables.jenkins-trigger + condition: STABLE + predefined-parameters: | + BUNDLE_URL=autorelease + KARAF_VERSION=$KARAF_VERSION fail-on-missing: true - - project: 'integration-distribution-test-{integration-test}' - condition: FAILED - trigger-with-no-params: true - project: 'packaging-build-rpm-{stream}' condition: UNSTABLE_OR_BETTER predefined-parameters: DOWNLOAD_URL=$BUNDLE_URL diff --git a/jjb/integration/integration-detect-variables.sh b/jjb/integration/integration-detect-variables.sh index 961df7bcbb..66e2df0d00 100644 --- a/jjb/integration/integration-detect-variables.sh +++ b/jjb/integration/integration-detect-variables.sh @@ -24,7 +24,15 @@ if [ ${BUNDLE_URL} == 'last' ]; then BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}" BUNDLE="${KARAF_ARTIFACT}-${TIMESTAMP}.zip" ACTUAL_BUNDLE_URL="${NEXUSPATH}/${BUNDLE_VERSION}/${BUNDLE}" +elif [ ${BUNDLE_URL} == 'autorelease' ]; then + # Use latest stable AR job distribution URL + ACTUAL_BUNDLE_URL="$(curl -sL -X GET -H 'Accept:text/plain' https://jenkins.opendaylight.org/releng/view/autorelease/job/autorelease-release-$DISTROSTREAM/lastStableBuild/injectedEnvVars/export | grep BUNDLE_URL | tr -d 'BUNDLE_URL=')" + BUNDLE="${ACTUAL_BUNDLE_URL##*/}" + ARTIFACT="$(basename "$(dirname "$(dirname "${ACTUAL_BUNDLE_URL}")")")" + BUNDLE_VERSION="$(basename "$(dirname "${ACTUAL_BUNDLE_URL}")")" + BUNDLEFOLDER="${ARTIFACT}-${BUNDLE_VERSION}" else + # Use provided BUNDLE_URL ACTUAL_BUNDLE_URL="${BUNDLE_URL}" BUNDLE="${BUNDLE_URL##*/}" ARTIFACT="$(basename "$(dirname "$(dirname "${BUNDLE_URL}")")")" diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml index b9e448a037..5a1922fb17 100644 --- a/jjb/integration/integration-macros.yaml +++ b/jjb/integration/integration-macros.yaml @@ -76,7 +76,9 @@ - string: name: BUNDLE_URL default: '{bundle-url}' - description: 'URL to karaf distribution zip' + description: | + Karaf distribution zip URL. Use last for last distribution in Nexus, + use autorelease for last stable AR job distribution. - parameter: name: integration-repo-url diff --git a/jjb/integration/integration-test-jobs.yaml b/jjb/integration/integration-test-jobs.yaml index b1b6c24d74..660144e2fa 100644 --- a/jjb/integration/integration-test-jobs.yaml +++ b/jjb/integration/integration-test-jobs.yaml @@ -183,17 +183,22 @@ build-days-to-keep: '{build-days-to-keep}' parameters: + - integration-distribution-branch: + branch: '{branch}' + - integration-distribution-stream: + stream: '{stream}' - integration-bundle-url: bundle-url: '{bundle-url}' - distribution-karaf-version: karaf-version: '{karaf-version}' builders: + - integration-detect-variables - trigger-builds: - project: '{csit-list}' block: true predefined-parameters: | - BUNDLE_URL=$BUNDLE_URL + BUNDLE_URL=$ACTUAL_BUNDLE_URL KARAF_VERSION=$KARAF_VERSION wrappers: -- 2.36.6