Merge "CI!: Upgrade maven version to mvn38"
[releng/builder.git] / jjb / integration / distribution / distribution-macros.yaml
index bd835f21f8dc53933f1b6d5131a66f888a898b6c..974382e2f29269c01dc9ae990a76f15db9456c92 100644 (file)
@@ -1,26 +1,5 @@
 # JJB macros specific to Integration/Distribution ODL project
 ---
-
-- builder:
-    name: distribution-deploy-verify
-    # Operation: Deploy ODL with all fetures and check it is not broken.
-    # Required bash variables:
-    #   KARAF_VERSION: 'karaf4' or 'karaf3'.
-    #     Use distribution-karaf-version macro to customize.
-    builders:
-      - integration-detect-variables
-      - shell: !include-raw: distribution-deploy-verify.sh
-
-- builder:
-    name: distribution-deploy-offline
-    # Operation: Deploys ODL on the current system, with no external repo configuration, check it works.
-    # Required bash variables:
-    #   KARAF_VERSION: 'karaf4' or 'karaf3'.
-    #     Use distribution-karaf-version macro to customize.
-    builders:
-      - integration-detect-variables
-      - shell: !include-raw: distribution-deploy-offline.sh
-
 - builder:
     name: distribution-check-wipe
     # Step zero: Wipe file repositories up front.
           rm -rfv /tmp/t
           echo "create n: multithreaded execution might fail at creating it."
           mkdir /tmp/n
+          echo "detecting distribution allowed projects"
+          # Some allowed projects cannot be detected in distribution because they do not produce features.
+          ALLOW_PROJECTS=(yangtools mdsal openflowjava)
+          if [[ "$KARAF_VERSION" == "odl" ]]; then
+          ALLOW_PROJECTS+=(`grep '<groupId>org.opendaylight.' -Rh distribution \
+          | sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
+          | sed -e 's%</groupId>%%' | sort -u`)
+          else
+          # For Managed distro we only look at the features folder
+          ALLOW_PROJECTS+=(`grep '<groupId>org.opendaylight.' -Rh distribution/features \
+          | sed -e 's%^[ \t]*<groupId>org.opendaylight.%%' \
+          | sed -e 's%</groupId>%%' | sort -u`)
+          fi
+          echo "Allowed projects are ${ALLOW_PROJECTS[@]}"
+          echo "ALLOW_PROJECTS=${ALLOW_PROJECTS[@]}" > allowed_projects.txt
 
 - builder:
     name: distribution-check-build-project
     #   pom: Relative path to pom file to use. Typically '$GERRIT_PROJECT/pom.xml'.
     builders:
       - maven-target:
-          maven-version: '{mvn-version}'
-          pom: '{pom}'
+          maven-version: "{mvn-version}"
+          pom: "{pom}"
           goals: |
-              clean deploy
-              dependency:tree -DoutputFile=dependency_tree.txt
-              -Pq
-              -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
-              {mvn-opts}
+            clean deploy
+            dependency:tree -DoutputFile=dependency_tree.txt
+            -Pq
+            -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
+            {mvn-opts}
           java-opts:
-            - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
-          settings: 'integration-settings'
+            - "-Xmx4096m -Dmaven.compile.fork=true"
+          settings: "integration-settings"
           settings-type: cfp
-          global-settings: 'global-settings'
+          global-settings: "global-settings"
           global-settings-type: cfp
 
 - builder:
     #   gerrit-project: Project name as nexus URI part. Typically '$GERRIT_PROJECT'.
     builders:
       - shell: |
+          echo "These are allowed projects: $ALLOW_PROJECTS"
+          echo "These are distribution pulled projects:"
+          EXIT_CODE="0"
+          for PROJECT in `ls /tmp/r/org/opendaylight`; do
+          echo "checking $PROJECT"
+          if [[ "$ALLOW_PROJECTS" != *"$PROJECT"* ]]; then
+          echo "ERROR: Not allowed project $PROJECT pulled"
+          EXIT_CODE="1"
+          fi
+          done
+          exit $EXIT_CODE
+          echo "verify project groupId"
           mkdir -p /tmp/t/org/opendaylight/{gerrit-project}
           mv /tmp/n/org/opendaylight/{gerrit-project}/* /tmp/t/org/opendaylight/{gerrit-project}/
           test -z "`find /tmp/n/ -type f`" || ( echo "ERROR: Mismatched groupId detected (see above)." && false )
     #   dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
     builders:
       - maven-target:
-          maven-version: '{mvn-version}'
-          pom: '{dist-pom}'
+          maven-version: "{mvn-version}"
+          pom: "{dist-pom}"
           goals: |
-              clean install
-              dependency:tree -DoutputFile=dependency_tree.txt
-              -Pq
-              {mvn-opts}
+            clean install
+            dependency:tree -DoutputFile=dependency_tree.txt
+            -Pq
+            {mvn-opts}
           java-opts:
-            - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
-          settings: 'integration-settings'
+            - "-Xmx1024m -Dmaven.compile.fork=true"
+          settings: "integration-settings"
           settings-type: cfp
-          global-settings: 'global-settings'
+          global-settings: "global-settings"
           global-settings-type: cfp
 
 - builder:
       - shell: |
           cp -r /tmp/r /tmp/t
       - maven-target:
-          maven-version: '{mvn-version}'
-          pom: '{pom}'
+          maven-version: "{mvn-version}"
+          pom: "{pom}"
           goals: |
-              clean install
-              dependency:tree -DoutputFile=dependency_tree.txt
-              -s fake_remotes.xml
-              -Pq
-              {mvn-opts}
+            clean install
+            dependency:tree -DoutputFile=dependency_tree.txt
+            -s fake_remotes.xml
+            -Pq
+            {mvn-opts}
           java-opts:
-            - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
+            - "-Xmx4096m -Dmaven.compile.fork=true"
       - shell: |
           rm -rf /tmp/r
           mv /tmp/t /tmp/r
     #   dist-pom: Relative path to pom file to use. 'distribution/pom.xml' is recommended.
     builders:
       - maven-target:
-          maven-version: '{mvn-version}'
-          pom: '{dist-pom}'
+          maven-version: "{mvn-version}"
+          pom: "{dist-pom}"
           goals: |
-              clean install
-              dependency:tree -DoutputFile=dependency_tree.txt
-              -s fake_remotes.xml
-              -Pq
-              -Dsft.heap.max=4g
-              -DskipTests=false
-              {mvn-opts}
+            clean install
+            dependency:tree -DoutputFile=dependency_tree.txt
+            -s fake_remotes.xml
+            -Pq
+            -Dsft.heap.max=4g
+            -DskipTests=false
+            {mvn-opts}
           java-opts:
-            - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
+            - "-Xmx1024m -Dmaven.compile.fork=true"
 
 - builder:
     name: distribution-check-warn-9191