X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=jjb%2Fglobal-macros.yaml;h=92c881fb9a6e1661bf5ec330490ce8749624a4e9;hb=21ac893f606f196626890d9efedb18ae5913dc9b;hp=d5fd41ee87167e3b18f2aa8d0da1f8cb09eb8bdd;hpb=dfbc88c5cd0be065fe7722efeae20c0ff6f42cdd;p=ci-management.git diff --git a/jjb/global-macros.yaml b/jjb/global-macros.yaml index d5fd41ee8..92c881fb9 100644 --- a/jjb/global-macros.yaml +++ b/jjb/global-macros.yaml @@ -25,6 +25,14 @@ default: '{project}' description: "GERRIT_PROJECT parameter if not given by trigger" +- parameter: + name: os-parameter + parameters: + - string: + name: OS + default: '{os}' + description: "OS parameter" + - parameter: name: gerrit-refspec-parameter parameters: @@ -41,6 +49,86 @@ default: '{maven}' description: 'Maven selector to be used by shell scripts' +- parameter: + name: maven-exec + parameters: + - string: + name: MVN + default: '/w/tools/hudson.tasks.Maven_MavenInstallation/{maven-version}/bin/mvn' + description: 'Maven selector to be used by shell scripts' + +- parameter: + name: repo-name-parameter + parameters: + - string: + name: REPO_NAME + default: '{repo-name}' + description: 'Name of repo to which to publish packaging' + +- parameter: + name: compiler-parameter + parameters: + - string: + name: CC + default: '{cc}' + description: "CC parameter, can be gnu or clang" + +- parameter: + name: is-csit-vpp-job-parameter + parameters: + - string: + name: IS_CSIT_VPP_JOB + 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." + +- parameter: + name: topo-parameter + parameters: + - string: + name: TOPO + default: '{topo}' + description: "Topology parameter" + +- parameter: + name: arch-parameter + parameters: + - string: + name: ARCH + default: '{arch}' + description: "Architecture parameter" + +- parameter: + name: gerrit-event-type-parameter + parameters: + - string: + name: GERRIT_EVENT_TYPE + default: '' + description: "GERRIT_EVENT_TYPE parameter not given by trigger" + +- parameter: + name: gerrit-event-comment-text-parameter + parameters: + - string: + name: GERRIT_EVENT_COMMENT_TEXT + default: '' + description: "GERRIT_EVENT_COMMENT_TEXT parameter not given by trigger" + +- parameter: + name: gerrit-csit-refspec-parameter + parameters: + - string: + name: CSIT_REF + default: '' + description: "GERRIT_REFSPEC parameter to override separately cloned CSIT repository, leave empty for autodetection / no override." + # FIXME: Wrap long lines. ##### SCMS - scm: @@ -51,7 +139,7 @@ url: '$GIT_BASE' refspec: '' branches: - - 'origin/${branch}' + - 'origin/{branch}' skip-tag: true wipe-workspace: true @@ -67,6 +155,20 @@ skip-tag: true choosing-strategy: '{choosing-strategy}' +- scm: + name: gerrit-trigger-scm-recursive + scm: + - git: + credentials-id: '{credentials-id}' + url: '$GIT_BASE' + refspec: '{refspec}' + branches: + - 'origin/$GERRIT_BRANCH' + skip-tag: true + choosing-strategy: '{choosing-strategy}' + submodule: + recursive: '{submodule-recursive}' + - scm: name: zuul-trigger-scm scm: @@ -74,7 +176,7 @@ url: '$ZUUL_URL/$ZUUL_PROJECT' refspec: '{refspec}' branches: - - 'origin/$ZUUL_BRANCH' + - '{commit}' skip-tag: true wipe-workspace: true @@ -87,15 +189,51 @@ timeout: 360 fail: true +- wrapper: + # This wrapper is used for all jobs that require no-activity timeouts + name: fdio-infra-wrappers-non-activity-timeout + wrappers: + - timeout: + type: no-activity + timeout: '{build-timeout}' + fail: true + - timestamps + - ssh-agent-credentials: + users: + - 'jenkins-gerrit-credentials' + - jclouds: + single-use: True + - openstack: + single-use: True + +- wrapper: + # This wrapper is required for all jobs as it configures the wrappers + # needed by the fd.io infra. + name: fdio-infra-wrappers + wrappers: + - timeout: + type: absolute + timeout: '{build-timeout}' + timeout-var: 'BUILD_TIMEOUT' + fail: true + - timestamps + - ssh-agent-credentials: + users: + - 'jenkins-gerrit-credentials' + - jclouds: + single-use: True + - openstack: + single-use: True + ###### TRIGGERS - trigger: name: gerrit-trigger-patch-submitted triggers: - gerrit: - server-name: 'Default' + server-name: 'Primary' trigger-on: - patchset-created-event: - exclude-drafts: 'false' + exclude-drafts: 'true' exclude-trivial-rebase: 'false' exclude-no-code-change: 'false' - draft-published-event @@ -110,11 +248,92 @@ - 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: 'true' + exclude-trivial-rebase: 'false' + 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-os-trivial-patch-submitted + triggers: + - gerrit: + server-name: 'Primary' + trigger-on: + - comment-added-contains-event: + comment-contains-value: 'os-check' + - comment-added-contains-event: + comment-contains-value: 'os-verify' + 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: 'true' + exclude-trivial-rebase: 'false' + 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: + - gerrit: + server-name: 'Primary' + trigger-on: + - comment-added-contains-event: + comment-contains-value: '{comment-trigger-value}' + projects: + - project-compare-type: 'ANT' + project-pattern: '{name}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + - trigger: name: gerrit-trigger-patch-merged triggers: - gerrit: - server-name: 'Default' + server-name: 'Primary' trigger-on: - change-merged-event - comment-added-contains-event: @@ -125,6 +344,47 @@ branches: - branch-compare-type: 'ANT' branch-pattern: '**/{branch}' + # Force Jenkins always vote the values it should already have voted + # during the prior verify phase + override-votes: true + gerrit-build-started-verified-value: 1 + gerrit-build-successful-verified-value: 1 + gerrit-build-failed-verified-value: 1 + gerrit-build-unstable-verified-value: 1 + gerrit-build-notbuilt-verified-value: 1 + gerrit-build-started-codereview-value: 0 + gerrit-build-successful-codereview-value: 0 + gerrit-build-failed-codereview-value: 0 + gerrit-build-unstable-codereview-value: 0 + gerrit-build-notbuilt-codereview-value: 0 + +- trigger: + name: gerrit-trigger-os-patch-merged + triggers: + - gerrit: + server-name: 'Primary' + trigger-on: + - comment-added-contains-event: + comment-contains-value: 'os-merge' + projects: + - project-compare-type: 'ANT' + project-pattern: '{name}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + # Force Jenkins always vote the values it should already have voted + # during the prior verify phase + override-votes: true + gerrit-build-started-verified-value: 1 + gerrit-build-successful-verified-value: 1 + gerrit-build-failed-verified-value: 1 + gerrit-build-unstable-verified-value: 1 + gerrit-build-notbuilt-verified-value: 1 + gerrit-build-started-codereview-value: 0 + gerrit-build-successful-codereview-value: 0 + gerrit-build-failed-codereview-value: 0 + gerrit-build-unstable-codereview-value: 0 + gerrit-build-notbuilt-codereview-value: 0 # Publishers - publisher: @@ -141,7 +401,7 @@ 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: | @@ -171,6 +431,50 @@ healthy: 50 unhealthy: 40 +- publisher: + name: robot-report + publishers: + - robot: + 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 @@ -188,3 +492,59 @@ - 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