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
* 2.30
* 2.31
* 2.32
+* 2.33
+* 2.34
Cloud configuration are managed via a directory structure in ci-management as
follows:
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}'
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}'
##############################################################################
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
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")
echo " $num_executors,"
echo " \"$jvm_options\","
echo " \"$fs_root\","
- echo " new LauncherFactory.SSH(\"jenkins\", \"\"),"
+ echo " new LauncherFactory.SSH(\"$key_pair_name\", \"\"),"
echo " $retention_time"
}
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"
##############################################################################
# Clear log credential files
-rm "$SETTINGS_FILE"
-rm ~/.netrc
+rm -f "$SETTINGS_FILE"
+rm -f ~/.netrc