X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=jjb%2Flf-maven-jobs.yaml;h=c89ba5b1f925523c43fcd09487e9ac1046b8a83e;hb=f4e0e413849367f8f71bc4cb9098e282c0ac206e;hp=736c4e9562043feb996f2e92eeb7096cb8d04f70;hpb=3f633b290b31a5a6fbf38bcd71008df6f3c2c942;p=releng%2Fglobal-jjb.git diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 736c4e95..c89ba5b1 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -1,47 +1,46 @@ --- # This file contains job templates for Maven projects. -- job-group: - name: '{project-name}-maven-jobs' +########## +# Macros # +########## - # This job group contains all the recommended jobs that should be deployed - # for any project ci. - - jobs: - - gerrit-maven-clm - - gerrit-maven-release - - gerrit-maven-verify - -- job-group: - name: '{project-name}-github-maven-jobs' - - # This job group contains all the recommended jobs that should be deployed - # for any project ci that is using github. - - jobs: - - github-maven-clm - - github-maven-release - - github-maven-verify - -- job-group: - name: '{project-name}-maven-javadoc-jobs' - - # This job group contains all the recommended jobs that should be deployed - # for any project ci. - - jobs: - - gerrit-maven-javadoc-publish - - gerrit-maven-javadoc-verify +- builder: + name: lf-maven-build + builders: + - inject: + properties-content: 'MAVEN_GOALS={mvn-goals}' + - shell: !include-raw-escape: + - ../shell/common-variables.sh + - ../shell/maven-build.sh -- job-group: - name: '{project-name}-github-maven-javadoc-jobs' +- builder: + name: lf-maven-deploy + builders: + - shell: !include-raw: + - ../shell/common-variables.sh + - ../shell/maven-deploy.sh - # This job group contains all the recommended jobs that should be deployed - # for any project ci. +- builder: + name: lf-maven-stage + builders: + # include-raw-escape fails due to JJB bug + - shell: !include-raw: + - ../shell/common-variables.sh + - ../shell/maven-stage.sh - jobs: - - github-maven-javadoc-publish - - github-maven-javadoc-verify +- builder: + name: lf-update-java-alternatives + builders: + - inject: + # Work around inject plugin overriding our GIT_URL variable incorrectly + # https://issues.jenkins-ci.org/browse/JENKINS-49775 + properties-content: | + SET_JDK_VERSION={java-version} + GIT_URL="$GIT_URL" + - shell: !include-raw-escape: ../shell/update-java-alternatives.sh + - inject: + properties-file: '/tmp/java.env' #################### # COMMON FUNCTIONS # @@ -50,9 +49,23 @@ - lf_maven_common: &lf_maven_common name: lf-maven-common + ###################### + # Default parameters # + ###################### + + archive-artifacts: > + **/*.log + **/hs_err_*.log + **/target/**/feature.xml + **/target/failsafe-reports/failsafe-summary.xml + **/target/surefire-reports/*-output.txt + + ##################### + # Job Configuration # + ##################### + project-type: freestyle node: '{build-node}' - jdk: '{java-version}' properties: - lf-infra-properties: @@ -68,8 +81,10 @@ mvn-opts: '{mvn-opts}' mvn-params: '{mvn-params}' mvn-version: '{mvn-version}' - # Staging repos do not make sense for CLM jobs so set it blank. - staging-profile-id: '{staging-profile-id}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. wrappers: - lf-infra-wrappers: @@ -90,47 +105,64 @@ - lf_maven_clm: &lf_maven_clm name: lf-maven-clm - # Produces a CLM scan of the code into Nexus IQ Server. - # - # Required parameters: - # build-node: The node to run build on. - # jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # mvn-settings: The name of settings file containing credentials for - # the project. - # - # Optional parameters: - # mvn-global-settings: The name of the Maven global settings to use for - # Maven configuration. (default: global-settings) - ###################### # Default parameters # ###################### branch: master build-days-to-keep: 30 # 30 days for troubleshooting purposes - build-timeout: 15 + build-timeout: 60 + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 - staging-profile-id: '' # Unused in this job + mvn-version: mvn35 + nexus-iq-stage: 'build' stream: master submodule-recursive: true + nexus_iq_scan_patterns: + - '**/*.ear' + - '**/*.jar' + - '**/*.tar.gz' + - '**/*.war' + - '**/*.zip' + + gerrit_clm_triggers: + - comment-added-contains-event: + comment-contains-value: run-clm$ + + parameters: + - lf-infra-parameters: + project: '{project}' + branch: '{branch}' + stream: '{stream}' + lftools-version: '{lftools-version}' + - lf-infra-maven-parameters: + mvn-opts: '{mvn-opts}' + mvn-params: '{mvn-params}' + mvn-version: '{mvn-version}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + - lf-clm-parameters: + nexus-iq-stage: '{nexus-iq-stage}' + ##################### # Job Configuration # ##################### - triggers: - # Build weekly on Saturdays - - timed: 'H H * * 6' + disabled: '{disable-job}' builders: - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - lf-provide-maven-settings: global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' @@ -139,8 +171,12 @@ - ../shell/sonatype-clm.sh - lf-provide-maven-settings-cleanup - shell: 'find . -regex ".*karaf/target" | xargs rm -rf' - - sonatype-clm: - application-name: '{project-name}' + - nexus-iq-policy-evaluator: + stage: '{nexus-iq-stage}' + application-type: 'manual' + application-id: '{project-name}' + scan-patterns: '{obj:nexus_iq_scan_patterns}' + fail-build-network-error: true - job-template: name: '{project-name}-maven-clm-{stream}' @@ -158,6 +194,24 @@ submodule-recursive: '{submodule-recursive}' choosing-strategy: default + triggers: + # Build weekly on Saturdays + - timed: 'H H * * 6' + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: '{obj:gerrit_clm_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + skip-vote: + successful: true + failed: true + unstable: true + notbuilt: true + - job-template: name: '{project-name}-maven-clm-{stream}' id: github-maven-clm @@ -166,18 +220,36 @@ <<: *lf_maven_clm properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: url: '{git-clone-url}{github-org}/{project}' - refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '{branch}' + refspec: '' + branch: 'refs/heads/{branch}' submodule-recursive: '{submodule-recursive}' choosing-strategy: default jenkins-ssh-credential: '{jenkins-ssh-credential}' + triggers: + # Build weekly on Saturdays + - timed: 'H H * * 6' + - github-pull-request: + trigger-phrase: '^run-clm$' + only-trigger-phrase: true + status-context: 'CLM' + permit-all: true + github-hooks: true + org-list: + - '{github-org}' + white-list: '{obj:github_pr_whitelist}' + admin-list: '{obj:github_pr_admin_list}' + white-list-target-branches: + - '{branch}' + ######################### # Maven Javadoc Publish # ######################### @@ -185,56 +257,25 @@ - lf_maven_javadoc_publish: &lf_maven_javadoc_publish name: lf-maven-javadoc-publish - # Produces and publishes javadocs for a Maven project. - # - # Expects javadocs to be available in $WORKSPACE/target/site/apidocs - # - # Required parameters: - # - # :build-node: The node to run build on. - # :javadoc-path: The path in Nexus to deploy javadoc to. - # :jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # :mvn-settings: The name of settings file containing credentials for - # the project. - # :mvn-site-id: Maven Server ID from settings.xml to pull credentials from. - # (Note: This setting should be configured in defaults.yaml.) - # - # Optional parameters: - # - # :branch: The branch to build against. (default: master) - # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) - # :build-timeout: Timeout in seconds before aborting build. (default: 60) - # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) - # :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-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) - # :submodule-recursive: Whether to checkout submodules recursively. - # (default: true) - # - # :gerrit_javadoc_merge_triggers: Override Gerrit Triggers. - ###################### # Default parameters # ###################### branch: master build-days-to-keep: 30 # 30 days in case a release takes long to get approved. - build-timeout: 30 + build-timeout: 60 + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 - staging-profile-id: '' # Unused by the javadoc jobs + mvn-version: mvn35 stream: master submodule-recursive: true - gerrit_javadoc_merge_triggers: + gerrit_merge_triggers: - change-merged-event - comment-added-contains-event: comment-contains-value: remerge$ @@ -243,9 +284,13 @@ # Job Configuration # ##################### + disabled: '{disable-job}' + builders: - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - lf-provide-maven-settings: global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' @@ -281,7 +326,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: '{obj:gerrit_javadoc_merge_triggers}' + trigger-on: '{obj:gerrit_merge_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -297,8 +342,10 @@ <<: *lf_maven_javadoc_publish properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: @@ -313,15 +360,18 @@ - github - pollscm: cron: '' - - lf-infra-github-pr-trigger: + - github-pull-request: trigger-phrase: '^remerge$' only-trigger-phrase: true - status-context: 'JJB Merge' - permit-all: false + status-context: 'Maven Javadoc Publish' + permit-all: true github-hooks: true - github-org: '{github-org}' - github_pr_whitelist: '{obj:github_pr_whitelist}' - github_pr_admin_list: '{obj:github_pr_admin_list}' + org-list: + - '{github-org}' + white-list: '{obj:github_pr_whitelist}' + admin-list: '{obj:github_pr_admin_list}' + white-list-target-branches: + - '{branch}' ######################## # Maven Javadoc Verify # @@ -330,68 +380,45 @@ - lf_maven_javadoc_verify: &lf_maven_javadoc_verify name: lf-maven-javadoc-verify - # Produces javadocs for a Maven project. - # - # Expects javadocs to be available in $WORKSPACE/target/site/apidocs - # - # Required parameters: - # build-node: The node to run build on. - # jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # mvn-settings: The name of settings file containing credentials for - # the project. - # - # Optional parameters: - # - # :branch: The branch to build against. (default: master) - # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) - # :build-timeout: Timeout in seconds before aborting build. (default: 60) - # :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM) - # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) - # :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-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) - # :submodule-recursive: Whether to checkout submodules recursively. - # (default: true) - # - # :gerrit_javadoc_verify_triggers: Override Gerrit Triggers. - ###################### # Default parameters # ###################### branch: master build-days-to-keep: 30 # 30 days in case a release takes long to get approved. - build-timeout: 30 + build-timeout: 60 + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 - staging-profile-id: '' # Unused by the javadoc jobs + mvn-version: mvn35 stream: master submodule-recursive: true - gerrit_javadoc_verify_triggers: + gerrit_verify_triggers: - patchset-created-event: exclude-drafts: true exclude-trivial-rebase: false exclude-no-code-change: false - draft-published-event - comment-added-contains-event: - comment-contains-value: recheck$ + comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$' ##################### # Job Configuration # ##################### + concurrent: true + disabled: '{disable-job}' + builders: - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - lf-provide-maven-settings: global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' @@ -419,7 +446,7 @@ triggers: - gerrit: server-name: '{gerrit-server-name}' - trigger-on: '{obj:gerrit_javadoc_verify_triggers}' + trigger-on: '{obj:gerrit_verify_triggers}' projects: - project-compare-type: ANT project-pattern: '{project}' @@ -435,8 +462,149 @@ <<: *lf_maven_javadoc_verify properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' + - github: + url: '{github-url}/{github-org}/{project}' + + scm: + - lf-infra-github-scm: + url: '{git-clone-url}{github-org}/{project}' + refspec: '+refs/pull/*:refs/remotes/origin/pr/*' + branch: '$sha1' + submodule-recursive: '{submodule-recursive}' + choosing-strategy: default + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + triggers: + - github-pull-request: + trigger-phrase: ^(recheck|reverify)$ + only-trigger-phrase: false + status-context: 'Maven Javadoc Verify' + permit-all: true + github-hooks: true + white-list-target-branches: + - '{branch}' + +############### +# Maven Merge # +############### + +- lf_maven_merge: &lf_maven_merge + name: lf-maven-merge + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 30 # 30 days in case we need to troubleshoot + build-timeout: 60 + cron: '@daily' + disable-job: false + git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' + java-version: openjdk8 + mvn-global-settings: global-settings + mvn-goals: clean deploy + mvn-opts: '' + mvn-params: '-Dmerge' + mvn-version: mvn35 + nexus-cut-dirs: 6 # Number of dirs in the Nexus path to remove for wget -r. + stream: master + submodule-recursive: true + + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: remerge$ + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: '.*' + + # github_included_regions MUST match gerrit_trigger_file_paths + github_included_regions: + - '.*' + + post_build_trigger: '' + + ##################### + # Job Configuration # + ##################### + + disabled: '{disable-job}' + + builders: + - lf-jacoco-nojava-workaround + - lf-maven-install: + mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' + - lf-provide-maven-settings: + global-settings-file: '{mvn-global-settings}' + settings-file: '{mvn-settings}' + - lf-infra-create-netrc: + server-id: '{mvn-snapshot-id}' + - inject: + properties-content: | + NEXUS_CUT_DIRS={nexus-cut-dirs} + NEXUS_REPO={nexus-snapshot-repo} + - shell: !include-raw-escape: + - ../shell/lftools-install.sh + - ../shell/maven-fetch-metadata.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' + - lf-maven-deploy + - lf-provide-maven-settings-cleanup + + publishers: + - findbugs + - lf-jacoco-report + - lf-infra-publish + - trigger-parameterized-builds: '{obj:post_build_trigger}' + +- job-template: + name: '{project-name}-maven-merge-{stream}' + id: gerrit-maven-merge + <<: *lf_maven_common + # yamllint disable-line rule:key-duplicates + <<: *lf_maven_merge + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: '{submodule-recursive}' + choosing-strategy: default + + triggers: + - timed: '{obj:cron}' + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: '{obj:gerrit_merge_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + file-paths: '{obj:gerrit_trigger_file_paths}' + +- job-template: + name: '{project-name}-maven-merge-{stream}' + id: github-maven-merge + <<: *lf_maven_common + # yamllint disable-line rule:key-duplicates + <<: *lf_maven_merge + + properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: @@ -448,47 +616,30 @@ jenkins-ssh-credential: '{jenkins-ssh-credential}' triggers: - - lf-infra-github-pr-trigger: - trigger-phrase: '^recheck$' + - timed: '{obj:cron}' + - github + - pollscm: + cron: '' + - github-pull-request: + trigger-phrase: '^remerge$' only-trigger-phrase: true - status-context: 'Maven Javadoc' + status-context: 'Maven Merge' permit-all: true github-hooks: true - github-org: '' - github_pr_whitelist: - - '' - github_pr_admin_list: - - '' - -################# -# Maven Release # -################# - -- lf_maven_release: &lf_maven_release - name: lf-maven-release - - # Produces a release candidate by creating a staging repo in Nexus. - # - # Runs a Maven build and deploys to $WORKSPACE/m2repo directory. This - # directory can then be reused later to deploy to Nexus. - # - # Required parameters: - # :build-node: The node to run build on. - # :jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # :mvn-settings: The name of settings file containing credentials for - # the project. - # :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from. - # (Note: This setting should be configured in defaults.yaml.) - # :staging-profile-id: Profile ID of the project's Nexus staging profile. - # - # Optional parameters: - # :gerrit_verify_triggers: Override Gerrit Triggers. - # :mvn-global-settings: The name of the Maven global settings to use for - # Maven configuration. (default: global-settings) - # :cron: Cron schedule when to trigger the job. This parameter also - # supports multiline input via YAML pipe | character in cases where - # one may want to provide more than 1 cron timer. (default: '') + org-list: + - '{github-org}' + white-list: '{obj:github_pr_whitelist}' + admin-list: '{obj:github_pr_admin_list}' + white-list-target-branches: + - '{branch}' + included-regions: '{obj:github_included_regions}' + +############### +# Maven Stage # +############### + +- lf_maven_stage: &lf_maven_stage + name: lf-maven-stage ###################### # Default parameters # @@ -496,29 +647,56 @@ branch: master build-days-to-keep: 30 # 30 days in case a release takes long to get approved. - build-timeout: 30 + build-timeout: 60 + cron: '@daily' + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '' - mvn-version: mvn33 + mvn-version: mvn35 stream: master submodule-recursive: true - cron: '' gerrit_release_triggers: - comment-added-contains-event: - comment-contains-value: build release$ + comment-contains-value: stage-release$ ##################### # Job Configuration # ##################### + disabled: '{disable-job}' + + parameters: + - lf-infra-parameters: + project: '{project}' + branch: '{branch}' + stream: '{stream}' + lftools-version: '{lftools-version}' + - lf-infra-maven-parameters: + mvn-opts: '{mvn-opts}' + mvn-params: '{mvn-params}' + mvn-version: '{mvn-version}' + staging-profile-id: '{staging-profile-id}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + - string: + name: STAGING_PROFILE_ID + default: '{staging-profile-id}' + description: Nexus staging profile ID. + builders: - lf-jacoco-nojava-workaround - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - lf-provide-maven-settings: global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' @@ -526,18 +704,18 @@ server-id: '{mvn-staging-id}' - shell: !include-raw-escape: - ../shell/lftools-install.sh - - ../shell/common-variables.sh - ../shell/maven-patch-release.sh - - ../shell/maven-build.sh - - ../shell/maven-stage.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' + - lf-maven-stage - lf-provide-maven-settings-cleanup - job-template: - name: '{project-name}-maven-release-{stream}' - id: gerrit-maven-release + name: '{project-name}-maven-stage-{stream}' + id: gerrit-maven-stage <<: *lf_maven_common # yamllint disable-line rule:key-duplicates - <<: *lf_maven_release + <<: *lf_maven_stage scm: - lf-infra-gerrit-scm: @@ -561,15 +739,17 @@ branch-pattern: '**/{branch}' - job-template: - name: '{project-name}-maven-release-{stream}' - id: github-maven-release + name: '{project-name}-maven-stage-{stream}' + id: github-maven-stage <<: *lf_maven_common # yamllint disable-line rule:key-duplicates - <<: *lf_maven_release + <<: *lf_maven_stage properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: @@ -582,17 +762,14 @@ triggers: - timed: '{obj:cron}' - - lf-infra-github-pr-trigger: + - github-pull-request: trigger-phrase: '^build release$' only-trigger-phrase: true status-context: 'Maven Release' permit-all: true github-hooks: true - github-org: '' - github_pr_whitelist: - - '' - github_pr_admin_list: - - '' + white-list-target-branches: + - '{branch}' ############### # Maven Sonar # @@ -601,50 +778,23 @@ - lf_maven_sonar: &lf_maven_sonar name: lf-maven-sonar - # Sonar job which runs mvn clean install then publishes to Sonar. - # - # This job purposely only runs on the master branch as there are Additional - # configuration needed to support multiple branches and there's not much - # interest in that kind of support. - # - # Required parameters: - # - # :build-node: The node to run build on. - # :jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # :mvn-settings: The name of settings file containing credentials for - # the project. - # - # Optional parameters: - # - # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) - # :build-timeout: Timeout in seconds before aborting build. (default: 60) - # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) - # :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-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) - # :submodule-recursive: Whether to checkout submodules recursively. - # (default: true) - # - # :gerrit_sonar_triggers: Override Gerrit Triggers. - ###################### # Default parameters # ###################### branch: master # Sonar should always be run on master branch build-days-to-keep: 7 - build-timeout: 30 + build-timeout: 60 + cron: 'H H * * 6' # run weekly + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings mvn-opts: '' mvn-params: '' - mvn-version: mvn33 - staging-profile-id: '' # Unused in this job + mvn-version: mvn35 + sonar-mvn-goal: 'sonar:sonar' stream: master submodule-recursive: true @@ -656,8 +806,32 @@ # Job Configuration # ##################### + disabled: '{disable-job}' + + parameters: + - lf-infra-parameters: + project: '{project}' + branch: '{branch}' + stream: '{stream}' + lftools-version: '{lftools-version}' + - lf-infra-maven-parameters: + mvn-opts: '{mvn-opts}' + mvn-params: '{mvn-params}' + mvn-version: '{mvn-version}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. + - string: + name: SONAR_MAVEN_GOAL + default: '{sonar-mvn-goal}' + description: | + Maven goals to pass to the Sonar call. Typically sonar:sonar + however to use a specific version of the sonar-maven-plugin we + can call "org.codehaus.mojo:sonar-maven-plugin:3.3.0.603:sonar". + triggers: - - timed: 'H H * * 6' + - timed: '{obj:cron}' - gerrit: server-name: '{gerrit-server-name}' trigger-on: '{obj:gerrit_sonar_triggers}' @@ -675,6 +849,7 @@ builders: - lf-infra-maven-sonar: + java-version: '{java-version}' mvn-settings: '{mvn-settings}' mvn-version: '{mvn-version}' @@ -689,11 +864,11 @@ builders: - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - inject: # Switch this to the sonar wrapper when JJB 2.0 is available - properties-content: | - SONAR_HOST_URL=$SONAR_URL - SONAR_MAVEN_GOAL=sonar:sonar + properties-content: SONAR_HOST_URL=$SONAR_URL - lf-provide-maven-settings: global-settings-file: global-settings settings-file: '{mvn-settings}' @@ -726,30 +901,29 @@ <<: *lf_maven_sonar properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: url: '{git-clone-url}{github-org}/{project}' refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '{branch}' + branch: '$sha1' submodule-recursive: '{submodule-recursive}' choosing-strategy: default jenkins-ssh-credential: '{jenkins-ssh-credential}' triggers: - - lf-infra-github-pr-trigger: - trigger-phrase: '^recheck$' + - github-pull-request: + trigger-phrase: '^run-sonar$' only-trigger-phrase: false - status-context: 'Maven Verify' + status-context: 'Maven Sonar' permit-all: true github-hooks: true - github-org: '' - github_pr_whitelist: - - '' - github_pr_admin_list: - - '' + white-list-target-branches: + - '{branch}' ################ # Maven Verify # @@ -758,37 +932,6 @@ - lf_maven_verify: &lf_maven_verify name: lf-maven-verify - # Verify job which runs mvn clean install to test a project build.. - # - # Required parameters: - # - # :build-node: The node to run build on. - # :jenkins-ssh-credential: Credential to use for SSH. (Generally should - # be configured in defaults.yaml) - # :mvn-settings: The name of settings file containing credentials for - # the project. - # - # Optional parameters: - # - # :branch: Git branch to fetch for the build. (default: master) - # :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) - # :build-timeout: Timeout in seconds before aborting build. (default: 60) - # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) - # :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-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) - # :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. - # (default: true) - # - # :gerrit_verify_triggers: Override Gerrit Triggers. - # :gerrit_trigger_file_paths: Override file paths which can be used to - # filter which file modifications will trigger a build. - ###################### # Default parameters # ###################### @@ -796,13 +939,15 @@ branch: master build-days-to-keep: 7 build-timeout: 60 + disable-job: false git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' java-version: openjdk8 mvn-global-settings: global-settings + mvn-goals: clean deploy mvn-opts: '' mvn-params: '-Dstream=$STREAM' - mvn-version: mvn33 - staging-profile-id: '' # Unused in this job + mvn-version: mvn35 stream: master submodule-recursive: true @@ -813,28 +958,36 @@ exclude-no-code-change: false - draft-published-event - comment-added-contains-event: - comment-contains-value: recheck$ + comment-contains-value: '^Patch Set[ ]+[0-9]+:([ ]+|[\n]+)(recheck|reverify)$' + gerrit_trigger_file_paths: - - compare-type: ANT - pattern: '**' + - compare-type: REG_EXP + pattern: '.*' + + # github_included_regions MUST match gerrit_trigger_file_paths + github_included_regions: + - '.*' ##################### # Job Configuration # ##################### concurrent: true + disabled: '{disable-job}' builders: - lf-jacoco-nojava-workaround - lf-maven-install: mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' - lf-provide-maven-settings: global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' - shell: !include-raw-escape: - ../shell/lftools-install.sh - - ../shell/common-variables.sh - - ../shell/maven-build.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' - lf-provide-maven-settings-cleanup publishers: @@ -878,27 +1031,117 @@ <<: *lf_maven_verify properties: + - lf-infra-properties: + build-days-to-keep: '{build-days-to-keep}' - github: - url: '{git-url}/{github-org}/{project}' + url: '{github-url}/{github-org}/{project}' scm: - lf-infra-github-scm: url: '{git-clone-url}{github-org}/{project}' refspec: '+refs/pull/*:refs/remotes/origin/pr/*' - branch: '{branch}' + branch: '$sha1' submodule-recursive: '{submodule-recursive}' choosing-strategy: default jenkins-ssh-credential: '{jenkins-ssh-credential}' triggers: - - lf-infra-github-pr-trigger: - trigger-phrase: '^recheck$' + - github-pull-request: + trigger-phrase: '^(recheck|reverify)$' only-trigger-phrase: false status-context: 'Maven Verify' permit-all: true github-hooks: true - github-org: '' - github_pr_whitelist: - - '' - github_pr_admin_list: - - '' + white-list-target-branches: + - '{branch}' + included-regions: '{obj:github_included_regions}' + +############################# +# Maven Verify Dependencies # +############################# + +- lf_maven_verify_dependencies: &lf_maven_verify_dependencies + name: lf-maven-verify-dependencies + + ###################### + # Default parameters # + ###################### + + branch: master + build-days-to-keep: 7 + build-timeout: 60 + disable-job: false + git-url: '$GIT_URL/$PROJECT' + github-url: 'https://github.com' + java-version: openjdk8 + mvn-global-settings: global-settings + mvn-goals: clean deploy + mvn-opts: '' + mvn-params: '-Dstream=$STREAM' + mvn-version: mvn35 + stream: master + submodule-recursive: true + + gerrit_verify_triggers: + - comment-added-contains-event: + comment-contains-value: 'recheck: [0-9 ]+' + gerrit_trigger_file_paths: + - compare-type: ANT + pattern: '**' + + ##################### + # Job Configuration # + ##################### + + concurrent: true + disabled: '{disable-job}' + + builders: + - lf-jacoco-nojava-workaround + - lf-maven-install: + mvn-version: '{mvn-version}' + - lf-update-java-alternatives: + java-version: '{java-version}' + - lf-provide-maven-settings: + global-settings-file: '{mvn-global-settings}' + settings-file: '{mvn-settings}' + - lf-fetch-dependent-patches + - shell: !include-raw-escape: + - ../shell/common-variables.sh + - ../shell/maven-build-deps.sh + - lf-maven-build: + mvn-goals: '{mvn-goals}' + - lf-provide-maven-settings-cleanup + + publishers: + - findbugs + - lf-jacoco-report + - lf-infra-publish + +- job-template: + name: '{project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}' + id: gerrit-maven-verify-dependencies + <<: *lf_maven_common + # yamllint disable-line rule:key-duplicates + <<: *lf_maven_verify_dependencies + + scm: + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: '{submodule-recursive}' + choosing-strategy: gerrit + + triggers: + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: '{obj:gerrit_verify_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + file-paths: '{obj:gerrit_trigger_file_paths}'