Push OpFlex artifacts to Nexus repository. 97/61397/5
authorAnil Belur <abelur@linuxfoundation.org>
Sat, 5 Aug 2017 01:30:35 +0000 (11:30 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Thu, 10 Aug 2017 03:46:49 +0000 (13:46 +1000)
Improve OpFlex release process such that the artifacts are built and
deployed to Nexus staging repo.

Create a separte release job for OpFlex. OpFlex artifacts are created
with the staging profile id: 906b0d53d714e

Don't archive artifacts from OpFlex on logs server.

Change-Id: I4f93966f96fcb10723f4bbd41905cdf6275f6995
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/opflex/deploy-opflex.sh [new file with mode: 0644]
jjb/opflex/opflex-build.sh
jjb/opflex/opflex.yaml [new file with mode: 0644]

diff --git a/jjb/opflex/deploy-opflex.sh b/jjb/opflex/deploy-opflex.sh
new file mode 100644 (file)
index 0000000..4d7b95a
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+#
+# Todo: remove this script once change no 5753 is merged in global-jjb
+# This script publishes OpFlex artifacts to Nexus repository.
+#
+# $MAVEN_REPO_URL          :  Jenkins global variable should be defined.
+# $REPO_ID                 :  Provided by a job parameter.
+# $GROUP_ID                :  Provided by a job parameter.
+# $UPLOAD_FILES_PATH        :  Provided by a job parameter.
+echo "---> deploy-opflex.sh"
+
+# DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
+# Ensure we fail the job if any steps fail.
+set -e -o pipefail
+set +u
+
+export MAVEN_OPTIONS
+export MAVEN_PARAMS
+
+DEPLOY_LOG="$WORKSPACE/archives/deploy-maven-file.log"
+mkdir -p "$WORKSPACE/archives"
+
+while IFS="" read -r file
+do
+    lftools deploy maven-file "$MAVEN_REPO_URL" \
+                              "$REPO_ID" \
+                              "$file" \
+                              -b "$MVN" \
+                              -g "$GROUP_ID" \
+                              -p "$MAVEN_PARAMS $MAVEN_OPTIONS" \
+                              |& tee "$DEPLOY_LOG"
+done < <(find "$UPLOAD_FILES_PATH" -type f -name "*")
index bacd747fbf0e41bae9963979c266214426e63c72..a35cecd8d74bfbf20b6f90539c9e34d72ce7dd81 100644 (file)
@@ -23,6 +23,10 @@ export PATH="$ROOT/bin:$PATH"
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ROOT/lib"
 export PKG_CONFIG_PATH="$ROOT/lib/pkgconfig"
 
+# Move OpFlex artifacts to upload files directory
+UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+mkdir -p "$UPLOAD_FILES_PATH"
+
 # build libopflex
 pushd libopflex
 ./autogen.sh
@@ -34,6 +38,7 @@ make -j8
 if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi
 make install
 make dist
+mv *.tar.gz "$UPLOAD_FILES_PATH"
 popd
 
 # build libmodelgbp
@@ -45,6 +50,7 @@ bash autogen.sh
 make -j2
 make install
 make dist
+mv *.tar.gz "$UPLOAD_FILES_PATH"
 popd
 popd
 
@@ -58,4 +64,5 @@ pushd agent-ovs
 make -j8
 if ! make check; then find . -name test-suite.log -exec cat {} \; && false; fi
 make dist
+mv *.tar.gz "$UPLOAD_FILES_PATH"
 popd
diff --git a/jjb/opflex/opflex.yaml b/jjb/opflex/opflex.yaml
new file mode 100644 (file)
index 0000000..9d617fc
--- /dev/null
@@ -0,0 +1,150 @@
+---
+- project:
+    name: opflex-release
+    jobs:
+      - 'opflex-release-{stream}'
+
+    stream:
+      - nitrogen:
+          branch: 'master'
+          jdk: openjdk8
+      - carbon:
+          branch: 'stable/carbon'
+          jdk: openjdk8
+      - boron:
+          branch: 'stable/boron'
+          jdk: openjdk8
+
+    project: 'opflex'
+    project-name: 'opflex'
+
+    branch: master
+    global-settings-file: global-settings
+    settings-file: opflex-settings
+    group-id: org.opendaylight.opflex
+    upload-files-dir: "$WORKSPACE/upload_files"
+
+    # Used by the release job
+    staging-profile-id: 906b0d53d714e
+
+
+- builder:
+    name: opflex-deploy-maven-file
+    # Todo: Remove this builder when the generic version of the builder is
+    # available in global-jjb. Change no: 5753
+    # Deploy artifacts to a repository.
+    #
+    # The builder requires passing the following parameters
+    # REPO_ID:           Repository ID
+    # GROUP_ID:          Group ID of the repository
+    # UPLOAD_FILES_PATH: Path to directory containing one or more files
+    builders:
+      - lf-maven-install:
+          mvn-version: '{mvn-version}'
+      - lf-provide-maven-settings:
+          global-settings-file: '{global-settings-file}'
+          settings-file: '{settings-file}'
+      - inject:
+          properties-content: |
+              MAVEN_REPO_URL=file://$WORKSPACE/m2repo
+              REPO_ID={repo-id}
+              GROUP_ID={group-id}
+              UPLOAD_FILES_PATH={upload-files-dir}
+      - shell: !include-raw-escape:
+          - ../global-jjb/shell/lftools-install.sh
+          - ../global-jjb/shell/common-variables.sh
+          - deploy-opflex.sh
+
+- builder:
+    name: opflex-maven-stage
+    # Todo: Migrate to the generic version of the builders available in
+    # global-jjb. Change no: 5753
+    # Stage files to Nexus repository.
+    #
+    # The builder requires passing the following parameters
+    # REPO_ID             : Repository ID
+    # GROUP_ID            : Group ID of the repository
+    # UPLOAD_FILES_PATH   : Path to directory containing one or more files
+    # STAGING_PROFILE_ID  : Staging profile id created on Nexus
+    builders:
+      - lf-provide-maven-settings:
+          global-settings-file: '{global-settings-file}'
+          settings-file: '{settings-file}'
+      - lf-infra-create-netrc:
+          server-id: opendaylight-staging
+      - inject:
+          properties-content: |
+              STAGING_PROFILE_ID={staging-profile-id}
+      - shell: !include-raw-escape:
+          - ../global-jjb/shell/lftools-install.sh
+          - ../global-jjb/shell/maven-stage.sh
+
+- job-template:
+    name: 'opflex-release-{stream}'
+
+    node: centos7-java-builder-2c-8g
+    jdk: '{jdk}'
+
+    ######################
+    # Default parameters #
+    ######################
+
+    build-timeout: 30
+    java-version: openjdk8
+    mvn-opts: ''
+    mvn-params: ''
+    mvn-version: mvn33
+    stream: master
+
+    properties:
+      - opendaylight-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - opendaylight-infra-parameters:
+          os-cloud: '{os-cloud}'
+          project: '{project}'
+          branch: '{branch}'
+          refspec: 'refs/heads/{branch}'
+          artifacts: ''
+      - lf-infra-maven-parameters:
+          mvn-opts: '{mvn-opts}'
+          mvn-params: '{mvn-params}'
+          mvn-version: '{mvn-version}'
+          staging-profile-id: '{staging-profile-id}'
+
+    scm:
+      - gerrit-trigger-scm:
+          refspec: ''
+          choosing-strategy: 'default'
+
+    wrappers:
+      - opendaylight-infra-wrappers:
+          build-timeout: '{build-timeout}'
+
+    builders:
+      - opflex-build:
+          mvn33: '{mvn-version}'
+          stream: '{stream}'
+      # todo: replace the builder with generic version in global-jjb
+      - opflex-deploy-maven-file:
+          global-settings-file: '{global-settings-file}'
+          settings-file: '{settings-file}'
+          mvn-version: '{mvn-version}'
+          repo-id: '{staging-profile-id}'
+          group-id: '{group-id}'
+          upload-files-dir: '{upload-files-dir}'
+      - lf-infra-create-netrc:
+          server-id: opendaylight-staging
+      # todo: replace the builder with generic version in global-jjb
+      - opflex-maven-stage:
+          global-settings-file: '{global-settings-file}'
+          settings-file: '{settings-file}'
+          staging-profile-id: '{staging-profile-id}'
+      - lf-provide-maven-settings-cleanup
+
+    publishers:
+      - email-notification:
+          email-recipients: '{email-recipients}'
+          email-prefix: '[opflex]'
+      - lf-infra-publish