From 44fd63c499c0a7d3a9dbb534aab66ca38d46f456 Mon Sep 17 00:00:00 2001 From: "Eby, Robert (re2429)" Date: Wed, 21 Nov 2018 16:21:49 -0500 Subject: [PATCH] Added staging build steps for tar files This is needed to allow staging builds of tar files (without using maven for the build). Change-Id: Ia54878aadca377b86281f07166fa7e84842a0cb9 Signed-off-by: Eby, Robert (re2429) --- jjb/addon-onap/addon-onap.yaml | 1 + jjb/akraino-templates/akraino-jjb-templates.yaml | 126 +++++++++++++++++++++++ jjb/shell/make-tar.sh | 14 ++- 3 files changed, 138 insertions(+), 3 deletions(-) diff --git a/jjb/addon-onap/addon-onap.yaml b/jjb/addon-onap/addon-onap.yaml index 2167365..9bd4ab2 100644 --- a/jjb/addon-onap/addon-onap.yaml +++ b/jjb/addon-onap/addon-onap.yaml @@ -29,6 +29,7 @@ refspec: refs/heads/master jobs: - akraino-project-stream-release-config + - akraino-project-stream-stage-config views: - common-view cron: 'H H * * 0' # push fresh snapshot weekly diff --git a/jjb/akraino-templates/akraino-jjb-templates.yaml b/jjb/akraino-templates/akraino-jjb-templates.yaml index b78782f..55c6b58 100644 --- a/jjb/akraino-templates/akraino-jjb-templates.yaml +++ b/jjb/akraino-templates/akraino-jjb-templates.yaml @@ -134,3 +134,129 @@ publishers: - lf-infra-publish + + +- job-template: + id: akraino-project-stream-stage-config + name: '{project}-{stream}-stage-config' + + ###################### + # Default parameters # + ###################### + + archive-artifacts: > + **/*.log + **/hs_err_*.log + **/target/**/feature.xml + **/target/failsafe-reports/failsafe-summary.xml + **/target/surefire-reports/*-output.txt + build-days-to-keep: 14 + build-timeout: 60 + cron: '@daily' + disable-job: false + git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' + java-version: openjdk8 + mvn-global-settings: global-settings + mvn-goals: clean deploy + mvn-opts: '' + mvn-params: '' + mvn-version: mvn35 + sign-artifacts: false + stream: master + submodule-recursive: true + upload-files-dir: m2repo # expected by "lftools deploy nexus-stage" + + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: '{build-node}' + + properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' + + parameters: + - lf-infra-parameters: + project: '{project}' + branch: '{branch}' + stream: '{stream}' + lftools-version: '{lftools-version}' + - lf-infra-maven-parameters: + mvn-opts: '{mvn-opts}' + mvn-params: '{mvn-params}' + mvn-version: '{mvn-version}' + staging-profile-id: '{staging-profile-id}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + - string: + name: UPLOAD_FILES_PATH + default: '{upload-files-dir}' + description: File path to generate tarball and upload to repository. + - string: + name: STAGING_PROFILE_ID + default: '{staging-profile-id}' + description: Nexus staging profile ID. + - string: + name: STAGING_BUILD + default: 'true' + description: Mark this as a staging build. + + wrappers: + - lf-infra-wrappers: + build-timeout: '{build-timeout}' + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + gerrit_release_triggers: + - comment-added-contains-event: + comment-contains-value: stage-release$ + + disabled: '{disable-job}' + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: '{submodule-recursive}' + choosing-strategy: default + + triggers: + - timed: '{obj:cron}' + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: '{obj:gerrit_release_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + + builders: + - lf-infra-pre-build + - lf-jacoco-nojava-workaround + - lf-maven-install: + mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' + - lf-provide-maven-settings: + global-settings-file: '{mvn-global-settings}' + settings-file: '{mvn-settings}' + - lf-infra-create-netrc: + server-id: '{mvn-staging-id}' + - shell: !include-raw-escape: + - ../shell/make-tar.sh + - lf-sigul-sign-dir: + sign-artifacts: '{sign-artifacts}' + sign-dir: '$WORKSPACE/m2repo' + - lf-maven-stage + - lf-provide-maven-settings-cleanup + + publishers: + - lf-infra-publish diff --git a/jjb/shell/make-tar.sh b/jjb/shell/make-tar.sh index 79e7e6d..76d730d 100644 --- a/jjb/shell/make-tar.sh +++ b/jjb/shell/make-tar.sh @@ -24,21 +24,29 @@ set -e -u -x -o pipefail rm -fr "$TARDIR" mkdir "$TARDIR" +if [ -n "$STAGING_BUILD" ] +then + # Remove the "-SNAPSHOT" from the version for a staging build + VERSION=$(echo "$VERSION" | sed 's/-SNAPSHOT//') +else + # Make sure the version has the "-SNAPSHOT" on the end for other builds + [[ ! "$VERSION" =~ -SNAPSHOT$ ]] && VERSION="${VERSION}-SNAPSHOT" +fi + if [ "$PROJECT" == "addon-onap" ] then # ONAP addon is special. # Build the regional controller scripts tar ball - # NOTE: Remove the two "-SNAPSHOT" below when the ONAP version.properties is fixed. ARTIFACT_NAME="onap-amsterdam-regional-controller-${STREAM}" - TAR_NAME="${ARTIFACT_NAME}-${VERSION}-SNAPSHOT.tgz" + TAR_NAME="${ARTIFACT_NAME}-${VERSION}.tgz" echo "Making tar file ${TARDIR}/${TAR_NAME}" cd ./src/regional_controller_scripts/ tar -cvzf "${TARDIR}/${TAR_NAME}" -- * # Build the ONAP VM scripts tar ball ARTIFACT_NAME="onap-amsterdam-VM-${STREAM}" - TAR_NAME="${ARTIFACT_NAME}-${VERSION}-SNAPSHOT.tgz" + TAR_NAME="${ARTIFACT_NAME}-${VERSION}.tgz" echo "Making tar file ${TARDIR}/${TAR_NAME}" cd ../onap_vm_scripts/ tar -cvzf "${TARDIR}/${TAR_NAME}" -- * -- 2.16.6