From: Thanh Ha Date: Thu, 3 May 2018 14:07:34 +0000 (-0400) Subject: Remove maven_metadata_validate function X-Git-Tag: v0.20.0~12^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F10394%2F1;p=releng%2Fglobal-jjb.git Remove maven_metadata_validate function This function was originally added to detect a bug with Maven 3.5.1 and earlier. At the time the OpenDaylight community was not yet ready to migrate to 3.5.2 from 3.3.9 so we implemented this function as a way to detect the metadata issues. This function ended up causing some edge case issues and is not worth maintaining. Remove the function and recommend all projects use Maven 3.5.2 as a minimum. The specific issue in Maven was that sometimes the deploy phase would generate an off by one timestamp mismatch between the metadata and the filename of the artifacts. This causes invalid metadata and then builds against affected artifacts fail. Issue: RELENG-927 Change-Id: I65f4f6dc73382b91940620aba587f5fe56259eb1 Signed-off-by: Thanh Ha --- diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index 939aaf8b..2fe043d7 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -109,7 +109,7 @@ Produces a CLM scan of the code into Nexus IQ Server. Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -151,7 +151,7 @@ Expects javadocs to be available in $WORKSPACE/target/site/apidocs Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -190,7 +190,7 @@ Expects javadocs to be available in $WORKSPACE/target/site/apidocs Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -247,7 +247,7 @@ This job uses the following strategy to deploy jobs to Nexus: Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`. :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) @@ -298,7 +298,7 @@ directory can then be reused later to deploy to Nexus. Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -342,7 +342,7 @@ interest in that kind of support. Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -379,7 +379,7 @@ Verify job which runs mvn clean install to test a project build.. Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. @@ -423,7 +423,7 @@ via comment trigger. Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. diff --git a/docs/jjb/lf-python-jobs.rst b/docs/jjb/lf-python-jobs.rst index 980e8678..14f4274d 100644 --- a/docs/jjb/lf-python-jobs.rst +++ b/docs/jjb/lf-python-jobs.rst @@ -131,7 +131,7 @@ https://docs.sonarqube.org/display/PLUG/Python+Coverage+Results+Import :java-version: Version of Java to use for the build. (default: openjdk8) :mvn-global-settings: The name of the Maven global settings to use for Maven configuration. (default: global-settings) - :mvn-version: Version of maven to use. (default: mvn33) + :mvn-version: Version of maven to use. (default: mvn35) :stream: Keyword used to represent a release code-name. Often the same as the branch. (default: master) :submodule-recursive: Whether to checkout submodules recursively. diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index b2482c12..ca948234 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -166,7 +166,7 @@ mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 staging-profile-id: '' # Unused in this job stream: master submodule-recursive: true @@ -281,7 +281,7 @@ mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 staging-profile-id: '' # Unused by the javadoc jobs stream: master submodule-recursive: true @@ -396,7 +396,7 @@ mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 staging-profile-id: '' # Unused by the javadoc jobs stream: master submodule-recursive: true @@ -510,7 +510,7 @@ mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dmerge' - mvn-version: mvn33 + mvn-version: mvn35 nexus-cut-dirs: 6 # Number of dirs in the Nexus path to remove for wget -r. staging-profile-id: '' # Unused by this job. stream: master @@ -643,7 +643,7 @@ mvn-goals: clean deploy mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 stream: master submodule-recursive: true @@ -756,7 +756,7 @@ mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 sonar-mvn-goal: 'sonar:sonar' staging-profile-id: '' # Unused in this job stream: master @@ -910,7 +910,7 @@ mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dstream=$STREAM' - mvn-version: mvn33 + mvn-version: mvn35 staging-profile-id: '' # Unused in this job stream: master submodule-recursive: true @@ -1034,7 +1034,7 @@ mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dstream=$STREAM' - mvn-version: mvn33 + mvn-version: mvn35 staging-profile-id: '' # Unused by this job stream: master submodule-recursive: true diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index be66e059..3a494957 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -211,7 +211,7 @@ python-version: python2 mvn-global-settings: global-settings mvn-settings: '{mvn-settings}' - mvn-version: mvn33 + mvn-version: mvn35 sonar-mvn-goal: 'sonar:sonar' stream: master submodule-recursive: true diff --git a/shell/common-variables.sh b/shell/common-variables.sh index deb10589..6a5d2fb0 100644 --- a/shell/common-variables.sh +++ b/shell/common-variables.sh @@ -29,63 +29,3 @@ 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 -} diff --git a/shell/maven-deploy.sh b/shell/maven-deploy.sh index 4f6f5846..0ab5c6c4 100644 --- a/shell/maven-deploy.sh +++ b/shell/maven-deploy.sh @@ -40,7 +40,6 @@ fi set -u # Re-enable. find "$m2repo_dir" -type d -empty -delete -maven_metadata_validate "$m2repo_dir" echo "-----> Upload files to Nexus" lftools deploy nexus -s "$nexus_repo_url" "$m2repo_dir"