Correct the description of the bridge used by daisy
[releng.git] / jjb / global / releng-macros.yml
index 7647a35..92199d6 100644 (file)
@@ -1,4 +1,15 @@
-# OLD Releng macros
+# Releng macros
+#
+# NOTE: make sure macros are listed in execution ordered.
+#
+# 1. parameters/properties
+# 2. scm
+# 3. triggers
+# 4. wrappers
+# 5. prebuilders (maven only, configured like Builders)
+# 6. builders (maven, freestyle, matrix, etc..)
+# 7. postbuilders (maven only, configured like Builders)
+# 8. publishers/reporters/notifications
 
 - parameter:
     name: project-parameter
             name: GS_BASE_PROXY
             default: build.opnfv.org/artifacts.opnfv.org/$PROJECT
             description: "URL to Google Storage proxy"
-
-- parameter:
-    name: gerrit-parameter
-    parameters:
+        - string:
+            name: BRANCH
+            default: '{branch}'
+            description: "JJB configured BRANCH parameter (e.g. master, stable/danube)"
         - string:
             name: GERRIT_BRANCH
             default: '{branch}'
-            description: "JJB configured GERRIT_BRANCH parameter"
+            description: "JJB configured GERRIT_BRANCH parameter (deprecated)"
 
-- wrapper:
-    name: ssh-agent-wrapper
-    wrappers:
-        - ssh-agent-credentials:
-            users:
-                - 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
+- property:
+    name: logrotate-default
+    properties:
+        - build-discarder:
+            days-to-keep: 60
+            num-to-keep: 200
+            artifact-days-to-keep: 60
+            artifact-num-to-keep: 200
 
 - scm:
     name: git-scm
@@ -38,7 +51,7 @@
             credentials-id: '$SSH_CREDENTIAL_ID'
             url: '$GIT_BASE'
             branches:
-                - 'origin/$GERRIT_BRANCH'
+                - 'origin/$BRANCH'
             timeout: 15
 
 - scm:
             choosing-strategy: 'gerrit'
             refspec: '$GERRIT_REFSPEC'
             <<: *git-scm-defaults
-
+- scm:
+    name: git-scm-with-submodules
+    scm:
+        - git:
+            credentials-id: '$SSH_CREDENTIAL_ID'
+            url: '$GIT_BASE'
+            refspec: ''
+            branches:
+                - 'refs/heads/{branch}'
+            skip-tag: true
+            wipe-workspace: true
+            submodule:
+                recursive: true
+                timeout: 20
 - trigger:
     name: 'daily-trigger-disabled'
     triggers:
@@ -60,7 +86,7 @@
         - timed: ''
 
 - trigger:
-    name: gerrit-trigger-patch-submitted
+    name: gerrit-trigger-patchset-created
     triggers:
         - gerrit:
             server-name: 'gerrit.opnfv.org'
                 - draft-published-event
                 - comment-added-contains-event:
                     comment-contains-value: 'recheck'
+                - comment-added-contains-event:
+                    comment-contains-value: 'reverify'
             projects:
               - project-compare-type: 'ANT'
-                project-pattern: '{name}'
+                project-pattern: '{project}'
                 branches:
                   - branch-compare-type: 'ANT'
                     branch-pattern: '**/{branch}'
+                file-paths:
+                  - compare-type: 'ANT'
+                    pattern: '{files}'
+            skip-vote:
+                successful: false
+                failed: false
+                unstable: false
+                notbuilt: false
 
 - trigger:
-    name: gerrit-trigger-patch-merged
+    name: gerrit-trigger-change-merged
     triggers:
         - gerrit:
             server-name: 'gerrit.opnfv.org'
                     comment-contains-value: 'remerge'
             projects:
               - project-compare-type: 'ANT'
-                project-pattern: '{name}'
+                project-pattern: '{project}'
                 branches:
                   - branch-compare-type: 'ANT'
                     branch-pattern: '**/{branch}'
+                file-paths:
+                  - compare-type: 'ANT'
+                    pattern: '{files}'
 
-- publisher:
-    name: archive-artifacts
-    publishers:
-        - archive:
-            artifacts: '{artifacts}'
-            allow-empty: true
-            fingerprint: true
-            latest-only: true
+- trigger:
+    name: 'experimental'
+    triggers:
+        - gerrit:
+            server-name: 'gerrit.opnfv.org'
+            trigger-on:
+                - comment-added-contains-event:
+                    comment-contains-value: 'check-experimental'
+            projects:
+                - project-compare-type: 'ANT'
+                  project-pattern: '{project}'
+                  branches:
+                      - branch-compare-type: 'ANT'
+                        branch-pattern: '**/{branch}'
+                  file-paths:
+                      - compare-type: 'ANT'
+                        pattern: 'tests/**'
+            skip-vote:
+                successful: true
+                failed: true
+                unstable: true
+                notbuilt: true
+
+- wrapper:
+    name: ssh-agent-wrapper
+    wrappers:
+        - ssh-agent-credentials:
+            users:
+                - 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
 
-# New Releng macros
+- wrapper:
+    name: fix-workspace-permissions
+    wrappers:
+        - pre-scm-buildstep:
+          - shell: |
+                #!/bin/bash
+                sudo chown -R $USER:$USER $WORKSPACE || exit 1
 
 - builder:
     name: build-html-and-pdf-docs-output
             find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
                 sed -e "s|^$local_path|    http://$gs_path|" >> gerrit_comment.txt
 
+# To take advantage of this macro, have your build write
+# out the file 'gerrit_comment.txt' with information to post
+# back to gerrit and include this macro in the list of builders.
 - builder:
-    name: report-docs-build-result-to-gerrit
+    name: report-build-result-to-gerrit
     builders:
         - shell: |
             #!/bin/bash
     builders:
         - build-html-and-pdf-docs-output
         - upload-under-review-docs-to-opnfv-artifacts
-        - report-docs-build-result-to-gerrit
+        - report-build-result-to-gerrit
 
 - builder:
     name: upload-merged-docs
     builders:
         - build-html-and-pdf-docs-output
         - upload-generated-docs-to-opnfv-artifacts
-        - report-docs-build-result-to-gerrit
+        - report-build-result-to-gerrit
         - remove-old-docs-from-opnfv-artifacts
 
 - builder:
             set -o xtrace
             export PATH=$PATH:/usr/local/bin/
 
+            # install python packages
+            pip install "yamllint==1.6.0"
+
             # generate and upload lint log
             echo "Running yaml code on $PROJECT ..."
 
             # Get number of yaml violations. If none, this will be an
             # empty string: ""
             find . \
-                -path './releng_yamllint' -prune -o \
-                -path './.tox' -prune -o \
                 -type f -name "*.yml" -print \
                 -o -name "*.yaml" -print | \
                 xargs yamllint > yaml-violation.log || true
               sed -r -i '4,$s/^/ /g' lint.log
             fi
 
+- builder:
+    name: clean-workspace-log
+    builders:
+        - shell: |
+            find $WORKSPACE -type f -name '*.log' | xargs rm -f
+
+- publisher:
+    name: archive-artifacts
+    publishers:
+        - archive:
+            artifacts: '{artifacts}'
+            allow-empty: true
+            fingerprint: true
+            latest-only: true
+
+- publisher:
+    name: publish-coverage
+    publishers:
+      - cobertura:
+          report-file: "coverage.xml"
+          only-stable: "true"
+          health-auto-update: "false"
+          stability-auto-update: "false"
+          zoom-coverage-chart: "true"
+          targets:
+            - files:
+                healthy: 10
+                unhealthy: 20
+                failing: 30
+            - method:
+                healthy: 50
+                unhealthy: 40
+                failing: 30
+
+# The majority of the email-ext plugin options are set to the default
+# for this macro so they can be managed through Jenkins' global
+# settings.
+- publisher:
+    name: email-jenkins-admins-on-failure
+    publishers:
+      - email-ext:
+          content-type: text
+          attach-build-log: true
+          compress-log: true
+          always: false
+          failure: true
+          send-to:
+            - recipients