Merge "Branch discovery and build polling"
authorAric Gardner <agardner@linuxfoundation.org>
Thu, 30 Jan 2020 19:13:59 +0000 (19:13 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Thu, 30 Jan 2020 19:13:59 +0000 (19:13 +0000)
14 files changed:
jjb/lf-release-jobs.yaml
jjb/lf-whitesource-jobs.yaml
releasenotes/notes/fix-configure-clouds-e71e71c12c614de0.yaml [new file with mode: 0644]
releasenotes/notes/fix-floating-ip-pool-0d2122df77d463e9.yaml [new file with mode: 0644]
releasenotes/notes/python-pip-versions-8435879c369a9d9c.yaml [new file with mode: 0644]
releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml [new file with mode: 0644]
releasenotes/notes/release-merge-gerrit-choosing-strategy-8d9b631b8fec525a.yaml [new file with mode: 0644]
shell/jenkins-configure-clouds.sh
shell/jjb-install.sh
shell/job-cost.sh
shell/node-install.sh
shell/python-tools-install.sh
shell/release-job.sh
shell/tox-install.sh

index f53a2d9..b95ffe8 100644 (file)
           submodule-disable: true
           submodule-recursive: false
           submodule-timeout: 10
-          choosing-strategy: default
+          choosing-strategy: gerrit
 
     triggers:
       - gerrit:
           submodule-disable: true
           submodule-recursive: false
           submodule-timeout: 10
-          choosing-strategy: default
+          choosing-strategy: gerrit
 
     triggers:
       - gerrit:
index f0adbc4..46cdf3a 100644 (file)
     submodule-timeout: 10
     submodule-disable: false
     wss-unified-agent-opts: ""
-    wss-unified-agent-version: 19.8.1
+    wss-unified-agent-version: 19.12.2
 
     gerrit_trigger_file_paths:
       - compare-type: ANT
diff --git a/releasenotes/notes/fix-configure-clouds-e71e71c12c614de0.yaml b/releasenotes/notes/fix-configure-clouds-e71e71c12c614de0.yaml
new file mode 100644 (file)
index 0000000..1a68667
--- /dev/null
@@ -0,0 +1,9 @@
+---
+fixes:
+  - |
+    Call "lftools jenkins" after credentials are set to fix failures due to the
+    call being made without credentials being set first. The previous method
+    did not require credentials, so the failure was introduced when we switched
+    to using lftools. The os_plugin_version variable is not needed before the
+    JENKINS_USER and JENKINS_PASSWORD are set, so no other changes
+    are necessary.
diff --git a/releasenotes/notes/fix-floating-ip-pool-0d2122df77d463e9.yaml b/releasenotes/notes/fix-floating-ip-pool-0d2122df77d463e9.yaml
new file mode 100644 (file)
index 0000000..56257eb
--- /dev/null
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    A recent change has made the "null" string a bad value for FLOATING_IP_POOL.
+    By making it an empty string, we recreate the old functionality of having
+    the default floating IP pool set to "No value".
diff --git a/releasenotes/notes/python-pip-versions-8435879c369a9d9c.yaml b/releasenotes/notes/python-pip-versions-8435879c369a9d9c.yaml
new file mode 100644 (file)
index 0000000..97b3633
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Extend shell scripts that invoke pip freeze to show
+    python and pip versions also
diff --git a/releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml b/releasenotes/notes/release-job-check-distr-type-7c81e313676816c9.yaml
new file mode 100644 (file)
index 0000000..6c26c8b
--- /dev/null
@@ -0,0 +1,7 @@
+---
+fixes:
+  - |
+    Extend release-job.sh to detect if distribution_type is missing
+    from the release yaml file and show a meaningful error.  The
+    shell option pipefile causes the script to halt silently if
+    niet fails to find that key, which utterly baffles users.
diff --git a/releasenotes/notes/release-merge-gerrit-choosing-strategy-8d9b631b8fec525a.yaml b/releasenotes/notes/release-merge-gerrit-choosing-strategy-8d9b631b8fec525a.yaml
new file mode 100644 (file)
index 0000000..af5a823
--- /dev/null
@@ -0,0 +1,11 @@
+---
+fixes:
+  - |
+    Use choosing strategy Gerrit Trigger in container/jar and
+    package cloud release merge jobs. This retains the current
+    behavior in the simple merge case, and ensures that a job
+    triggered by a "remerge" comment uses the release file at
+    that commit.  The previous choosing strategy, default, uses
+    the tip of the target branch.  That does not allow recovery
+    from merge job failure if the target branch has advanced past
+    the commit with the release file.
index 405eced..5d394ad 100644 (file)
@@ -46,9 +46,6 @@ silos="${jenkins_silos:-jenkins}"
 
 set -eu -o pipefail
 
-os_plugin_version="$(lftools jenkins plugins list \
-  | grep -i 'OpenStack Cloud Plugin')"
-
 testversion() {
     local current_val="$1" operator="$2" test_value="$3"
     awk -vv1="$current_val" -vv2="$test_value" 'BEGIN {
@@ -207,7 +204,7 @@ get_minion_options() {
         instance_cap=$(get_cfg "$cfg_file" INSTANCE_CAP "null")
     fi
 
-    floating_ip_pool=$(get_cfg "$cfg_file" FLOATING_IP_POOL "null")
+    floating_ip_pool=$(get_cfg "$cfg_file" FLOATING_IP_POOL "")
     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")
@@ -319,6 +316,11 @@ for silo in $silos; do
     export JENKINS_USER
     export JENKINS_PASSWORD
 
+    # JENKINS_{URL,USER,PASSWORD} env vars are required for the "lftools jenkins
+    # plugins list" call
+    os_plugin_version="$(lftools jenkins plugins list \
+      | grep -i 'OpenStack Cloud Plugin')"
+
     echo "-----> Groovy script $script_file"
     for cloud in "${clouds[@]}"; do
         cfg_dir="${cloud}"
index baaa5d7..d0c0e4a 100644 (file)
@@ -24,5 +24,7 @@ echo "JJB_VENV=$JJB_VENV" > "$WORKSPACE/.jjb.properties"
 source "$JJB_VENV/bin/activate"
 python -m pip install --quiet --upgrade "jenkins-job-builder==$JJB_VERSION"
 
-echo "----> pip freeze"
+# installs are silent, show version details in log
+python --version
+pip --version
 pip freeze
index 5bd61be..34ab5e7 100644 (file)
@@ -8,13 +8,19 @@
 # which accompanies this distribution, and is available at
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
-echo "---> build-cost.sh"
+echo "---> job-cost.sh"
 
 set -euf -o pipefail
 
 # shellcheck disable=SC1090
 source ~/lf-env.sh
 
+# AWS job cost not supported, exit
+if grep -qi amazon /sys/devices/virtual/dmi/id/bios_vendor ; then
+  echo "INFO: Not able to calculate job cost on AWS"
+  exit 0
+fi
+
 lf-activate-venv python-openstackclient
 
 if [[ -z ${JOB_NAME:-} ]]; then
@@ -43,14 +49,24 @@ uptime=$(awk '{print $1}' /proc/uptime)
 # Convert to integer by truncating fractional part' and round up by one
 ((uptime=${uptime%\.*}+1))
 
+# EC2 and OpenStack have simiar instace metadata APIs at this IP
+# AWS docs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
+# Nova docs: https://docs.openstack.org/nova/latest/user/metadata.html
 instance_type=$(curl -s http://169.254.169.254/latest/meta-data/instance-type)
 
 echo "INFO: Retrieving Pricing Info for: $instance_type"
 url="https://pricing.vexxhost.net/v1/pricing/$instance_type/cost?seconds=$uptime"
 json_block=$(curl -s "$url")
 
-cost=$(jq .cost <<< "$json_block")
-resource=$(jq .resource <<< "$json_block" | tr -d '"')
+# check if JSON returned and can be parsed
+if jq <<< "$json_block"; then
+    cost=$(jq .cost <<< "$json_block")
+    resource=$(jq .resource <<< "$json_block" | tr -d '"')
+else
+    echo "ERROR: Pricing API returned invalid json"
+    cost=0
+    resource=0
+fi
 
 # Archive the cost date
 mkdir -p "$WORKSPACE/archives/cost"
@@ -64,4 +80,3 @@ date=$(TZ=GMT date +'%Y-%m-%d %H:%M:%S')
 cat << EOF > "$WORKSPACE/archives/cost.csv"
 $JOB_NAME,$BUILD_NUMBER,$date,$resource,$uptime,$cost,$stack_cost
 EOF
-
index da6cfe4..7200ea3 100644 (file)
@@ -20,5 +20,7 @@ source "/tmp/v/python/bin/activate"
 pip install --quiet --upgrade "pip==9.0.3" setuptools
 pip install --quiet --upgrade nodeenv
 
-echo "----> pip freeze"
+# installs are silent, show version details in log
+python --version
+pip --version
 pip freeze
index 2b2b0f8..3a852d3 100644 (file)
@@ -38,6 +38,8 @@ EOF
     python3 -m pip install --user --quiet --no-warn-script-location --upgrade setuptools
     python3 -m pip install --user --quiet --no-warn-script-location --upgrade --upgrade-strategy eager -r "$requirements_file"
     # installs are silent, show version details in log
+    python3 --version
+    python3 -m pip --version
     python3 -m pip freeze
     rm -rf "$requirements_file"
     touch /tmp/pre-build-complete
index ee5ab70..b10ffb1 100644 (file)
@@ -17,6 +17,9 @@ PATH=/tmp/venv/bin:$PATH
 pipup="python -m pip install -q --upgrade pip lftools jsonschema niet twine yq"
 echo "INFO: $pipup"
 $pipup
+# show installed versions
+python -m pip --version
+python -m pip freeze
 
 #Functions.
 
@@ -44,9 +47,14 @@ set_variables_common(){
     fi
 
     # Jenkins parameter drop-down defaults DISTRIBUTION_TYPE to None
+    # in the contain/maven release job; get value from release yaml.
+    # Packagecloud and PyPI jobs set the appropriate value.
     DISTRIBUTION_TYPE="${DISTRIBUTION_TYPE:-None}"
     if [[ $DISTRIBUTION_TYPE == "None" ]]; then
-        DISTRIBUTION_TYPE=$(niet ".distribution_type" "$release_file")
+        if ! DISTRIBUTION_TYPE=$(niet ".distribution_type" "$release_file"); then
+            echo "ERROR: Failed to get distribution_type from $release_file"
+            exit 1
+        fi
     fi
 
     PATCH_DIR=$(mktemp -d)
index f8472cc..cc815cc 100644 (file)
@@ -16,12 +16,13 @@ set -eux -o pipefail
 
 # Tox version is pulled in through detox to mitigate version conflict
 
-
 if [[ $PYTHON == "python2" ]]; then
     $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv more-itertools~=5.0.0
 else
     $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv
 fi
 
-
+# installs are silent, show version details in log
+$PYTHON --version
+$PYTHON -m pip --version
 $PYTHON -m pip freeze