Merge "Define maven + docker verify, merge and stage jobs" v0.37.0
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 1 May 2019 03:47:36 +0000 (03:47 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Wed, 1 May 2019 03:47:36 +0000 (03:47 +0000)
1  2 
docs/jjb/lf-maven-jobs.rst
jjb/lf-maven-jobs.yaml

@@@ -71,10 -71,11 +71,10 @@@ Conditionally calls Maven versions plug
      :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
      :mvn-version: Version of Maven to execute Sonar with.
      :mvn-pom: Location of pom.xml.
 -    :maven-versions-plugin-set-version: Version number to upgrade to.
      :mvn-settings: Maven settings.xml file containing credentials to use.
  
  lf-maven-stage
- ---------------
+ --------------
  
  Calls the maven stage script to push artifacts to a Nexus staging repository.
  
@@@ -292,11 -293,37 +292,37 @@@ This job uses the following strategy t
          (default: true)
      :submodule-timeout: Timeout (in minutes) for checkout operation.
          (default: 10)
      :gerrit_merge_triggers: Override Gerrit Triggers.
      :gerrit_trigger_file_paths: Override file paths which can be used to
          filter which file modifications will trigger a build.
  
+ Maven Merge for Docker
+ ----------------------
+ Produces a snapshot docker image in a Nexus registry. Appropriate for
+ Java projects that do not need to deploy any POM or JAR files.
+ Similar to Maven Merge as described above but logs in to Docker
+ registries first and skips the lf-maven-deploy builder. The project
+ POM file should invoke a plugin to build and push a Docker image. The
+ base image should be pulled from the registry in the environment
+ variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
+ registry in the environment variable CONTAINER_PUSH_REGISTRY.
+ :Template Names:
+     - {project-name}-maven-docker-merge-{stream}
+     - gerrit-maven-docker-merge
+     - github-maven-docker-merge
+ :Required parameters:
+     :container-public-registry: Docker registry source with base images.
+     :container-snapshot-registry: Docker registry target for the deploy action.
+ All other required and optional parameters are identical to the Maven Merge job
+ described above.
  Maven Stage
  -----------
  
@@@ -345,6 -372,7 +371,6 @@@ directory is then used later to deploy 
      :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: mvn35)
 -    :maven-versions-plugin-set-version: New version to use in Maven versions plugin. (default: '')
      :ossrh-profile-id: Profile ID for project as provided by OSSRH.
          (default: '')
      :sign-artifacts: Sign artifacts with Sigul. (default: false)
  
      :gerrit_release_triggers: Override Gerrit Triggers.
  
+ Maven Stage for Docker
+ ----------------------
+ Produces a release candidate docker image in a Nexus registry.
+ Appropriate for Java projects that do not need to deploy any POM or
+ JAR files.
+ Similar to Maven Stage as described above but logs in to Docker
+ registries first and skips the lf-maven-deploy builder. The project
+ POM file should invoke a plugin to build and push a Docker image. The
+ base image should be pulled from the registry in the environment
+ variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
+ registry in the environment variable CONTAINER_PUSH_REGISTRY.
+ :Template Names:
+     - {project-name}-maven-docker-stage-{stream}
+     - gerrit-maven-docker-stage
+     - github-maven-docker-stage
+ :Required parameters:
+     :container-public-registry: Docker registry source with base images.
+     :container-staging-registry: Docker registry target for the deploy action.
+ All other required and optional parameters are identical to the Maven Stage job
+ described above.
  .. _maven-sonar:
  
  Maven Sonar
@@@ -464,7 -520,28 +518,28 @@@ Verify job which runs mvn clean instal
      :gerrit_trigger_file_paths: Override file paths which can be used to
          filter which file modifications will trigger a build.
  
- Maven Verify /w Dependencies
+ Maven Verify for Docker
+ -----------------------
+ Similar to Maven Verify as described above but logs in to Docker
+ registries first. The project POM file should invoke a plugin to build
+ a Docker image. The base image should be pulled from the registry in
+ the environment variable CONTAINER_PULL_REGISTRY.
+ :Template Names:
+     - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
+     - gerrit-maven-docker-verify
+     - github-maven-docker-verify
+ :Required parameters:
+     :container-public-registry: Docker registry source with base images.
+ All other required and optional parameters are identical to the Maven Verify job
+ described above.
+ Maven Verify w/ Dependencies
  ----------------------------
  
  Verify job which runs mvn clean install to test a project build /w deps
@@@ -478,7 -555,7 +553,7 @@@ via comment trigger
      - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
      - gerrit-maven-verify-dependencies
  
- :Comment Trigger: recheck: SPACE_SEPERATED_LIST_OF_PATCHES
+ :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
  
  :Required parameters:
  
diff --combined jjb/lf-maven-jobs.yaml
@@@ -35,7 -35,7 +35,7 @@@
                  pom: '{mvn-pom}'
                  goals: 'versions:set versions:update-child-modules versions:commit -B'
                  properties:
 -                  - 'newVersion=${{maven-versions-plugin-set-version}}'
 +                  - 'newVersion=${{release_version}}'
                  settings: '{mvn-settings}'
                  settings-type: cfp
                  global-settings: 'global-settings'
              - '{branch}'
            included-regions: '{obj:github_included_regions}'
  
+ ##########################
+ # Maven Merge for Docker #
+ ##########################
+ - lf_maven_docker_merge: &lf_maven_docker_merge
+     name: lf-maven-docker-merge
+     builders:
+       - lf-infra-pre-build
+       - lf-jacoco-nojava-workaround
+       - lf-maven-install:
+           mvn-version: '{mvn-version}'
+       - lf-infra-docker-login:
+           global-settings-file: '{mvn-global-settings}'
+           settings-file: '{mvn-settings}'
+       - lf-update-java-alternatives:
+           java-version: '{java-version}'
+       # must provide maven settings AFTER docker due to its cleanup
+       - 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}
+               CONTAINER_PULL_REGISTRY={container-public-registry}
+               CONTAINER_PUSH_REGISTRY={container-snapshot-registry}
+       - shell: !include-raw-escape: ../shell/maven-fetch-metadata.sh
+       - lf-maven-build:
+           mvn-goals: '{mvn-goals}'
+       # NO lf-maven-deploy
+       - lf-provide-maven-settings-cleanup
+ - job-template:
+     name: '{project-name}-maven-docker-merge-{stream}'
+     id: gerrit-maven-docker-merge
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_merge
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_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}'
+           submodule-timeout: '{submodule-timeout}'
+           choosing-strategy: default
+     triggers:
+       - 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-docker-merge-{stream}'
+     id: github-maven-docker-merge
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_merge
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_merge
+     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: ''
+           branch: 'refs/heads/{branch}'
+           submodule-recursive: '{submodule-recursive}'
+           submodule-timeout: '{submodule-timeout}'
+           choosing-strategy: default
+           jenkins-ssh-credential: '{jenkins-ssh-credential}'
+     triggers:
+       - github
+       - pollscm:
+           cron: ''
+       - github-pull-request:
+           trigger-phrase: '^remerge$'
+           only-trigger-phrase: true
+           status-context: 'Maven Docker Merge'
+           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}'
+           included-regions: '{obj:github_included_regions}'
  ###############
  # Maven Stage #
  ###############
      github-url: 'https://github.com'
      java-version: openjdk8
      maven-versions-plugin: false
 -    maven-versions-plugin-set-version: ''
      mvn-central: false
      mvn-global-settings: global-settings
      mvn-goals: clean deploy
            maven-versions-plugin: '{maven-versions-plugin}'
            mvn-version: '{mvn-version}'
            mvn-pom: '{mvn-pom}'
 -          maven-versions-plugin-set-version: '{maven-versions-plugin-set-version}'
            mvn-settings: '{mvn-settings}'
        - shell: !include-raw-escape: ../shell/maven-patch-release.sh
        - lf-maven-build:
            white-list-target-branches:
              - '{branch}'
  
+ ##########################
+ # Maven Stage for Docker #
+ ##########################
+ - lf_maven_docker_stage: &lf_maven_docker_stage
+     name: lf-maven-docker-stage
+     builders:
+       - lf-infra-pre-build
+       - lf-jacoco-nojava-workaround
+       - lf-maven-install:
+           mvn-version: '{mvn-version}'
+       - lf-update-java-alternatives:
+           java-version: '{java-version}'
+       - lf-infra-docker-login:
+           global-settings-file: '{mvn-global-settings}'
+           settings-file: '{mvn-settings}'
+       # must provide maven settings AFTER docker-login due to its cleanup
+       - lf-provide-maven-settings:
+           global-settings-file: '{mvn-global-settings}'
+           settings-file: '{mvn-settings}'
+       - shell: !include-raw-escape: ../shell/maven-patch-release.sh
+       - lf-maven-versions-plugin:
+           maven-versions-plugin: '{maven-versions-plugin}'
+           mvn-version: '{mvn-version}'
+           mvn-pom: '{mvn-pom}'
+           maven-versions-plugin-set-version: '{maven-versions-plugin-set-version}'
+           mvn-settings: '{mvn-settings}'
+       - inject:
+           properties-content: |
+               CONTAINER_PULL_REGISTRY={container-public-registry}
+               CONTAINER_PUSH_REGISTRY={container-staging-registry}
+       - lf-maven-build:
+           mvn-goals: '{mvn-goals}'
+       - lf-sigul-sign-dir:
+           sign-artifacts: '{sign-artifacts}'
+           sign-dir: '$WORKSPACE/m2repo'
+           sign-mode: '{sign-mode}'
+       # NO lf-maven-stage
+       # NO lf-maven-central
+       - lf-provide-maven-settings-cleanup
+ - job-template:
+     name: '{project-name}-maven-docker-stage-{stream}'
+     id: gerrit-maven-docker-stage
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_stage
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_stage
+     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}'
+           submodule-timeout: '{submodule-timeout}'
+           choosing-strategy: default
+     triggers:
+       - timed: '{obj:cron}'
+       - gerrit:
+           server-name: '{gerrit-server-name}'
+           trigger-on: '{obj:gerrit_release_triggers}'
+           projects:
+             - project-compare-type: ANT
+               project-pattern: '{project}'
+               branches:
+                 - branch-compare-type: ANT
+                   branch-pattern: '**/{branch}'
+ - job-template:
+     name: '{project-name}-maven-docker-stage-{stream}'
+     id: github-maven-docker-stage
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_stage
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_stage
+     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: '{branch}'
+           submodule-recursive: '{submodule-recursive}'
+           submodule-timeout: '{submodule-timeout}'
+           choosing-strategy: default
+           jenkins-ssh-credential: '{jenkins-ssh-credential}'
+     triggers:
+       - timed: '{obj:cron}'
+       - github-pull-request:
+           trigger-phrase: '^build release$'
+           only-trigger-phrase: true
+           status-context: 'Maven Release'
+           permit-all: true
+           github-hooks: true
+           white-list-target-branches:
+             - '{branch}'
  ###############
  # Maven Sonar #
  ###############
              - '{branch}'
            included-regions: '{obj:github_included_regions}'
  
+ ###########################
+ # Maven Verify for Docker #
+ ###########################
+ - lf_maven_docker_verify: &lf_maven_docker_verify
+     name: lf-maven-docker-verify
+     builders:
+       - lf-infra-pre-build
+       - lf-jacoco-nojava-workaround
+       - lf-maven-install:
+           mvn-version: '{mvn-version}'
+       - lf-update-java-alternatives:
+           java-version: '{java-version}'
+       - lf-infra-docker-login:
+           global-settings-file: '{mvn-global-settings}'
+           settings-file: '{mvn-settings}'
+       # must provide maven settings AFTER docker due to its cleanup
+       - lf-provide-maven-settings:
+           global-settings-file: '{mvn-global-settings}'
+           settings-file: '{mvn-settings}'
+       - inject:
+           properties-content: |
+               CONTAINER_PULL_REGISTRY={container-public-registry}
+       - lf-maven-build:
+           mvn-goals: '{mvn-goals}'
+       - lf-provide-maven-settings-cleanup
+ - job-template:
+     name: '{project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}'
+     id: gerrit-maven-docker-verify
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_verify
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_verify
+     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}'
+           submodule-timeout: '{submodule-timeout}'
+           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}'
+ - job-template:
+     name: '{project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}'
+     id: github-maven-docker-verify
+     <<: *lf_maven_common
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_verify
+     # yamllint disable-line rule:key-duplicates
+     <<: *lf_maven_docker_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}'
+           submodule-timeout: '{submodule-timeout}'
+           choosing-strategy: default
+           jenkins-ssh-credential: '{jenkins-ssh-credential}'
+     triggers:
+       - github-pull-request:
+           trigger-phrase: '^(recheck|reverify)$'
+           only-trigger-phrase: false
+           status-context: 'Maven Docker Verify'
+           permit-all: true
+           github-hooks: true
+           white-list-target-branches:
+             - '{branch}'
+           included-regions: '{obj:github_included_regions}'
  #############################
  # Maven Verify Dependencies #
  #############################