From: Thanh Ha Date: Fri, 8 Jun 2018 03:58:39 +0000 (+0000) Subject: Merge "Document lf-infra-push-gerrit-patch macro in RTD" X-Git-Tag: v0.21.0~18 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=961ef4327102f60f1d81e91b73027f032e144d6e;hp=801f8ef4dc01ad762bfb16f60accd75f0ed5be17;p=releng%2Fglobal-jjb.git Merge "Document lf-infra-push-gerrit-patch macro in RTD" --- diff --git a/docs/configuration.rst b/docs/configuration.rst index b15c19ff..4c597cc6 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -65,7 +65,7 @@ Example Gerrit Infra: name: global # lf-infra defaults - jenkins-ssh-credential: opendaylight-jenkins-ssh + jenkins-ssh-credential: jenkins-ssh gerrit-server-name: OpenDaylight lftools-version: '<1.0.0' mvn-site-id: opendaylight-site diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index de81269f..e510d7c3 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -192,6 +192,8 @@ OpenStack Cloud plugin version supported: * 2.30 * 2.31 * 2.32 +* 2.33 +* 2.34 Cloud configuration are managed via a directory structure in ci-management as follows: diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index ef5cbd76..ba419c69 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -289,9 +289,8 @@ name: PROJECT default: '{project}' description: | - Parameter to identify a Gerrit project. This is typically the - project repo path as exists in Gerrit. - For example: ofextensions/circuitsw + Parameter to identify a SCM project to build. This is typically + the project repo path. For example: ofextensions/circuitsw - string: name: STREAM default: '{stream}' @@ -303,28 +302,40 @@ name: GERRIT_PROJECT default: '{project}' description: | - Parameter to identify Gerrit project. This is typically the - project repo path as exists in Gerrit. - For example: ofextensions/circuitsw + Gerrit Trigger provided parameter to identify Gerrit project that + triggered the build. This is typically the project repo path as + exists in Gerrit. For example: ofextensions/circuitsw - Note that Gerrit will override this parameter automatically if a - job is triggered by Gerrit. + If using Gerrit, in a manual build this should match the PROJECT + parameter above. - string: name: GERRIT_BRANCH default: '{branch}' description: | - Parameter to identify a Gerrit branch. + Gerrit Trigger provided parameter to identify a Gerrit branch. - Note that Gerrit will override this parameter automatically if a - job is triggered by Gerrit. + If using Gerrit, in a manual build override with the branch to + build against. - string: name: GERRIT_REFSPEC default: 'refs/heads/{branch}' description: | - Parameter to identify a refspec when pulling from Gerrit. + Gerrit Trigger provided parameter to identify a refspec to fetch + from Gerrit. - Note that Gerrit will override this parameter automatically if a - job is triggered by Gerrit. + If using Gerrit, in a manual build override with a refspec. + https://git-scm.com/book/en/v2/Git-Internals-The-Refspec + For example: 'refs/heads/master' + - string: + name: sha1 + default: 'origin/{branch}' + description: | + GitHub PR Trigger provided parameter for specifying the commit + to checkout. + + If using GitHub, in a manual build override with a branch path or + sha1 hash to a specific commit. For example: 'origin/master' + # Tools - string: name: LFTOOLS_VERSION default: '{lftools-version}' diff --git a/shell/create-netrc.sh b/shell/create-netrc.sh index 52f239d3..a123be8d 100644 --- a/shell/create-netrc.sh +++ b/shell/create-netrc.sh @@ -10,25 +10,32 @@ ############################################################################## echo "---> create-netrc.sh" -# Ensure we fail the job if any steps fail. -set -eu -o pipefail - -ALT_NEXUS_URL="${ALT_NEXUS_URL:-}" - -if [ -z "$ALT_NEXUS_URL" ] -then +if [ -z "$ALT_NEXUS_URL" ]; then NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}" else NEXUS_URL="${ALT_NEXUS_URL}" fi - CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \ -v x:username -o ":" -v x:password \ "$SETTINGS_FILE") +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + +# Handle when a project chooses to not archive logs to a log server +# in other cases if CREDENTIAL is not found then fail the build. +if [ -z "$CREDENTIAL" ] && [ "$SERVER_ID" == "logs" ]; then + echo "WARN: Log server credential not found." + exit 0 +elif [ -z "$CREDENTIAL" ]; then + echo "ERROR: Credential not found." + exit 1 +fi + machine=$(echo "$NEXUS_URL" | awk -F/ '{print $3}') user=$(echo "$CREDENTIAL" | cut -f1 -d:) pass=$(echo "$CREDENTIAL" | cut -f2 -d:) +set +x # Disable `set -x` to prevent printing passwords echo "machine ${machine%:*} login $user password $pass" > ~/.netrc diff --git a/shell/jenkins-configure-clouds.sh b/shell/jenkins-configure-clouds.sh index cd50da09..3f7dd6a5 100644 --- a/shell/jenkins-configure-clouds.sh +++ b/shell/jenkins-configure-clouds.sh @@ -158,7 +158,7 @@ get_minion_options() { security_groups=$(get_cfg "$cfg_file" SECURITY_GROUPS "default") availability_zone=$(get_cfg "$cfg_file" AVAILABILITY_ZONE "") start_timeout=$(get_cfg "$cfg_file" START_TIMEOUT "600000") - key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "jenkins") + key_pair_name=$(get_cfg "$cfg_file" KEY_PAIR_NAME "jenkins-ssh") num_executors=$(get_cfg "$cfg_file" NUM_EXECUTORS "1") jvm_options=$(get_cfg "$cfg_file" JVM_OPTIONS "") fs_root=$(get_cfg "$cfg_file" FS_ROOT "/w") @@ -181,7 +181,7 @@ get_minion_options() { echo " $num_executors," echo " \"$jvm_options\"," echo " \"$fs_root\"," - echo " new LauncherFactory.SSH(\"jenkins\", \"\")," + echo " new LauncherFactory.SSH(\"$key_pair_name\", \"\")," echo " $retention_time" } diff --git a/shell/jenkins-configure-global-vars.sh b/shell/jenkins-configure-global-vars.sh index 6e640232..af36d100 100644 --- a/shell/jenkins-configure-global-vars.sh +++ b/shell/jenkins-configure-global-vars.sh @@ -27,6 +27,13 @@ silos="${jenkins_silos:-jenkins}" set -eu -o pipefail for silo in $silos; do + if [ ! -f "$WORKSPACE/jenkins-config/global-vars-$silo.sh" ]; then + echo "WARN: jenkins-config/global-vars-$silo.sh does not exist. Skipping cloud management..." + echo "We highly recommend setting up global-vars-$silo.sh to manage the Jenkins global variables." + echo "Refer to https://docs.releng.linuxfoundation.org/projects/global-jjb/en/latest/jjb/lf-ci-jobs.html#global-environment-variables for details." + continue + fi + set +x # Ensure that no other scripts add `set -x` and print passwords echo "Configuring $silo" diff --git a/shell/logs-clear-credentials.sh b/shell/logs-clear-credentials.sh index 74dbae36..a4a8cdda 100644 --- a/shell/logs-clear-credentials.sh +++ b/shell/logs-clear-credentials.sh @@ -10,5 +10,5 @@ ############################################################################## # Clear log credential files -rm "$SETTINGS_FILE" -rm ~/.netrc +rm -f "$SETTINGS_FILE" +rm -f ~/.netrc