Merge "Correction in script for building longbow docs"
[ci-management.git] / jjb / global-macros.yaml
index 8601fa8..f4b5780 100644 (file)
             default: '{is-csit-vpp-job}'
             description: "Parameter is True if this is a CSIT vpp job."
 
+- parameter:
+    name: stream-parameter
+    parameters:
+        - string:
+            name: STREAM
+            default: '{stream}'
+            description: "Stream job parameter to be used in shell scripts."
+
 
 ##### SCMS
 - scm:
                     - branch-compare-type: 'ANT'
                       branch-pattern: '**/{branch}'
 
+- trigger:
+    name: gerrit-trigger-trivial-patch-submitted
+    triggers:
+        - gerrit:
+            server-name: 'Primary'
+            trigger-on:
+                - patchset-created-event:
+                    exclude-drafts: 'false'
+                    exclude-trivial-rebase: 'true'
+                    exclude-no-code-change: 'true'
+                - 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}'
+                  branches:
+                    - branch-compare-type: 'ANT'
+                      branch-pattern: '**/{branch}'
+
+- trigger:
+    name: gerrit-trigger-trivial-patch-submitted-skip-vote
+    triggers:
+        - gerrit:
+            server-name: 'Primary'
+            trigger-on:
+                - patchset-created-event:
+                    exclude-drafts: 'false'
+                    exclude-trivial-rebase: 'true'
+                    exclude-no-code-change: 'true'
+                - 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}'
+                  branches:
+                    - branch-compare-type: 'ANT'
+                      branch-pattern: '**/{branch}'
+            skip-vote:
+                successful: true
+                failed: true
+                unstable: true
+                notbuilt: true
+
 - trigger:
     name: gerrit-trigger-manually-triggered
     triggers:
     publishers:
         - email-ext:
             recipients: 'nobody@projectrotterdam.info'
-            reply-to:
+            reply-to: ''
             content-type: default
             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
             body: |
             output-path: '{output-path}'
             other-files: ''
 
+- publisher:
+    name: fdio-infra-shiplogs
+    # To archive things, the job will need to create an "archives" directory in
+    # the workspace and this macro will handle copying the contents of the
+    # archives directory.
+    #
+    # Uses the build parameter ARCHIVE_ARTIFACTS if not empty to find files to
+    # archive. You can pass globstar patterns for example "**/*.xml **/*.log" as
+    # the archive pattern. This is a space separated list of files to archive.
+    #
+    # Also ensure that the workspace is cleaned up at the end of the build.
+    publishers:
+      - postbuildscript:
+          builders:
+            - shell: !include-raw: include-raw-deploy-archives.sh
+            - maven-target:
+                maven-version: '{maven-version}'
+                pom: '.archives/deploy-archives.xml'
+                goals: 'clean deploy -V -B -q -Dmaven.repo.local=/tmp/r'
+                settings: 'jenkins-log-archives-settings'
+                settings-type: cfp
+                global-settings: 'global-settings'
+                global-settings-type: cfp
+            - description-setter:
+                regexp: '^Build logs: .*'
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          mark-unstable-if-failed: true
+      - workspace-cleanup:
+          fail-build: false
+
+- publisher:
+    name: retry-build-on-builder-error
+    publishers:
+      - naginator:
+          max-failed-builds: 1
+
 ###### BUILDERS
 - builder:
     name: ci-management-check-unicode
                   variable: 'GLOBAL_SETTINGS_FILE'
                 - file-id: '{settings-file}'
                   variable: 'SETTINGS_FILE'
+
+- property:
+    name: fdio-infra-properties
+    properties:
+        - build-discarder:
+            days-to-keep: '{build-days-to-keep}'
+            num-to-keep: '{build-num-to-keep}'
+
+
+- builder:
+    name: packer-validate
+    builders:
+        - config-file-provider:
+            files:
+                - file-id: 'packer-cloud-env'
+                  variable: 'CLOUDENV'
+        - shell: |
+            #!/bin/bash
+            cd packer
+            varfiles="../packer/vars/*"
+            templates="../packer/templates/*"
+            provision="../packer/provision/*.sh"
+            for v in $varfiles; do
+                [[ "${v##*/}" =~ ^(cloud-env.*)$ ]] && continue
+                for t in $templates; do
+                    export PACKER_LOG="yes" && \
+                    export PACKER_LOG_PATH="packer-validate-${v##*/}-${t##*/}.log" && \
+                                packer.io validate -var-file=$CLOUDENV \
+                                -var-file=$v $t
+                    if [ $? -ne 0 ]; then
+                        break
+                    fi
+                done
+            done
+            for p in $provision; do
+                /bin/bash -n $p > provision-validate-${p##*/}.log 2>&1
+                if [ $? -ne 0 ]; then
+                    break
+                fi
+            done
+
+
+- builder:
+    name: packer-build
+    builders:
+        - config-file-provider:
+            files:
+                - file-id: 'packer-cloud-env'
+                  variable: 'CLOUDENV'
+        - shell: |
+            #!/bin/bash
+            cd packer
+            export PACKER_LOG="yes" && \
+            export PACKER_LOG_PATH="packer-build.log" && \
+                        packer.io build -var-file=$CLOUDENV \
+                         -var-file=../packer/vars/{platform}.json \
+                         ../packer/templates/{template}.json