Merge "Add pip.conf to wrappers"
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 9 Feb 2018 18:13:01 +0000 (18:13 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Fri, 9 Feb 2018 18:13:01 +0000 (18:13 +0000)
README.md
jjb-compare-xml.sh
jjb/lf-ci-jobs.yaml
jjb/lf-maven-jobs.yaml
shell/common-variables.sh
shell/docker-login.sh
shell/maven-deploy.sh

index 9446e68..fa5a914 100644 (file)
--- a/README.md
+++ b/README.md
@@ -71,7 +71,11 @@ versioned git tags.
     # Add the new submodule to ci-management's jjb directory.
     # Note: Perform once per ci-management repo.
     cd jjb/
-    git submodule add https://gerrit.linuxfoundation.org/infra/releng/global-jjb
+
+    # For production deployments:
+    git submodule add https://github.com/lfit/releng-global-jjb global-jjb
+    # For test deployments comment the above and uncomment the below
+    # git submodule add https://gerrit.linuxfoundation.org/infra/releng/global-jjb
 
     # Checkout the version of global-jjb you wish to deploy.
     cd global-jjb
index e29c1fa..740daf3 100755 (executable)
@@ -42,6 +42,16 @@ for xml in "$test_dir"/*; do
     fi
 done
 
+echo "Checking for double curly braces..."
+mapfile -t xml_files < <(find "$test_dir" -type f)
+for xml in "${xml_files[@]}"; do
+    if grep '{{' "$xml"; then
+        echo "ERROR: Double curly braces discovered in output XML."
+        exit 1
+    fi
+done
+echo "No double curly braces found."
+
 # Cleanup
 rm -rf "$test_dir" "$expected_xml_dir"
 
index 6d5d01a..2bff633 100644 (file)
     stream: master
     gerrit_jjb_deploy_job_triggers:
       - comment-added-contains-event:
-          comment-contains-value: jjb-deploy (?!\*+$).+$
+          comment-contains-value: 'jjb-deploy[:]* (?!\*+$).+$'
 
     #####################
     # Job Configuration #
index f127e91..cd3172b 100644 (file)
@@ -71,7 +71,8 @@
 - builder:
     name: lf-maven-stage
     builders:
-      - shell: !include-raw-escape:
+      # include-raw-escape fails due to JJB bug
+      - shell: !include-raw:
           - ../shell/common-variables.sh
           - ../shell/maven-stage.sh
 
index 6a5d2fb..deb1058 100644 (file)
@@ -29,3 +29,63 @@ lftools_activate() {
     source "/tmp/v/lftools/bin/activate"
     set -u  # Restore unbound variable checking
 }
+
+# Check maven-metadata.xml for any unexpected timestamp mismatches
+maven_metadata_validate() {
+    stage_dir="$1"
+
+    if [ -z "$1" ]; then
+        echo "Usage: maven_metadata_validate STAGE_REPO_DIR"
+        exit 1
+    fi
+
+    error_detected=0
+    mapfile -t files < <(find "$stage_dir" -name maven-metadata.xml | grep SNAPSHOT)
+
+    for f in "${files[@]}"; do
+        timestamp=$(xmlstarlet sel \
+            -t -v "/metadata/versioning/snapshot/timestamp" "$f")
+
+        # Scan all snapshot versions but ignore javadoc and source jars
+        mapfile -t ext_timestamps < <(xmlstarlet sel \
+            -t -m "/metadata/versioning/snapshotVersions/snapshotVersion" \
+            -n \
+            --if "classifier='javadoc'" \
+               -o "" \
+            --elif "classifier='sources'" \
+               -o "" \
+            --else \
+               -o "extension:" -v extension \
+               -o " value:" -v value \
+               -o " updated:" -v updated \
+            "$f")
+
+        for t in "${ext_timestamps[@]}"; do
+            # Ignore blank timestamps caused by xmlstarlet ignores
+            if [[ -z "$t" ]]; then
+                continue
+            fi
+
+            timestamp_error=0
+            if [[ $t != *"$timestamp"* ]]; then
+                echo "Metadata $f 'value:$timestamp' mismatch vs '$t'"
+                timestamp_error=1
+            fi
+            # Updated is timestamp without the dot character
+            if [[ $t != *"${timestamp//\./}"* ]]; then
+                echo "Metadata $f 'updated:${timestamp//\./}' mismatch vs '$t'"
+                timestamp_error=1
+            fi
+
+            if [[ $timestamp_error != 0 ]]; then
+                error_detected=1
+                cat "$f"
+            fi
+        done
+    done
+
+    if [ $error_detected -ne 0 ]; then
+        echo "ERROR: Mismatches in maven-metadata discovered. Quitting..."
+        exit 1
+    fi
+}
index 6613118..92da7e0 100644 (file)
@@ -35,6 +35,7 @@ set -eu -o pipefail
 
 # Execute the credential lookup and login to the registry
 do_login() {
+    set +x  # Ensure that no other scripts add `set -x` and print passwords
     echo "$1"
     CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \
         -t -m "/x:settings/x:servers/x:server[starts-with(x:id, '${1}')]" \
index ac0f729..c30963b 100644 (file)
@@ -39,5 +39,5 @@ fi
 set -u  # Re-enable.
 
 find "$m2repo_dir" -type d -empty -delete
-
+maven_metadata_validate "$m2repo_dir"
 lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"