X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=jjb%2Flf-ci-jobs.yaml;h=b0d699ac076d7c7c12d30aff3e2eb467d820ddcd;hb=e404e86b3c141d37504a8cdb653b047e939a8d77;hp=37467a55c8c98026eaa95ba799e697f7869e7629;hpb=0f371e4daaf0633d13b9e81876007f8399a9bf80;p=releng%2Fglobal-jjb.git diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 37467a55..b0d699ac 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -8,6 +8,7 @@ jjb-version: 1.6.2 jobs: + - gerrit-jjb-deploy-job - gerrit-jjb-merge - gerrit-jjb-verify @@ -20,6 +21,7 @@ jjb-version: 1.6.2 jobs: + - github-jjb-deploy-job - github-jjb-merge - github-jjb-verify @@ -61,6 +63,28 @@ - file-id: jjbini target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini' +- builder: + name: lf-infra-jjbini-sandbox + # TODO: Consolidate this into jjbini when JJB2.0 is available. + builders: + - config-file-provider: + files: + - file-id: jjbini-sandbox + target: '$HOME/.config/jenkins_jobs/jenkins_jobs.ini' + +- lf_packer_verify_file_paths: &lf_packer_verify_file_paths + name: lf-packer-verify-file-paths + file-paths: + # Common files for all projects + - compare-type: ANT + pattern: 'packer/vars/**.json' + - compare-type: ANT + pattern: 'packer/templates/**.json' + - compare-type: ANT + pattern: 'packer/provision/**.sh' + - compare-type: ANT + pattern: 'packer/provision/lib/**' + - lf_packer_file_paths: &lf_packer_file_paths name: lf-packer-file-paths file-paths: @@ -76,28 +100,47 @@ - lf_packer: &lf_packer_common name: lf-packer-common - # Adds wrappers and parameters sections common to packer jobs. + # Provide configuration common in packer jobs. ###################### # Default parameters # ###################### + branch: master build-timeout: 45 + stream: master + submodule-recursive: true packer-cloud-settings: packer-cloud-env - wrappers: - - lf-infra-wrappers: - build-timeout: '{build-timeout}' - jenkins-ssh-credential: '{jenkins-ssh-credential}' + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: '{build-node}' + + properties: + - lf-infra-properties: + project: '{project}' + build-days-to-keep: 7 parameters: - lf-infra-parameters: project: '{project}' stream: '{stream}' branch: '{branch}' + lftools-version: '{lftools-version}' - lf-infra-packer-parameters: packer-version: '{packer-version}' + wrappers: + - lf-infra-wrappers: + build-timeout: '{build-timeout}' + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + publishers: + - lf-infra-publish + - parameter: name: lf-infra-jjb-parameters parameters: @@ -131,6 +174,8 @@ pattern: '**/*.sh' - compare-type: ANT pattern: '**/*.yaml' + - compare-type: ANT + pattern: '**/global-jjb' ##################### # Job Configuration # @@ -149,6 +194,7 @@ project: '{project}' stream: '{stream}' branch: '{branch}' + lftools-version: '{lftools-version}' - lf-infra-jjb-parameters: jjb-version: '{jjb-version}' @@ -160,6 +206,206 @@ publishers: - lf-infra-publish +###################### +# Gerrit Branch Lock # +###################### + +- job-template: + name: '{project-name}-gerrit-branch-lock-{stream}' + id: gerrit-branch-lock + + ###################### + # Default parameters # + ###################### + + branch: master + git-url: '$GIT_URL/$GERRIT_PROJECT' + stream: master + gerrit_merge_triggers: + - comment-added-contains-event: + comment-contains-value: (un)?lock branch$ + + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: '{build-node}' + + properties: + - lf-infra-properties: + project: '{project}' + build-days-to-keep: 1 + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + lftools-version: '{lftools-version}' + + wrappers: + - lf-infra-wrappers: + build-timeout: 5 + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + scm: + - lf-infra-gerrit-scm: + git-url: '{git-url}' + refspec: '' + branch: '{branch}' + submodule-recursive: false + choosing-strategy: default + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + 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}' + + builders: + - shell: !include-raw-escape: ../shell/gerrit-branch-lock.sh + + + publishers: + - lf-infra-publish + +################## +# JJB DEPLOY JOB # +################## + +- lf_jjb_deploy_job: &lf_jjb_deploy_job + name: lf-jjb-deploy-job + + # Deploy jobs to jenkins-sandbox system via code review comment + # + # This job checks out the current code review patch and then runs a + # `jenkins-jobs update` to push a patch defined by the comment. + # + # Comment Trigger: jjb-deploy JOB_NAME + # + # JOB_NAME can include the * wildcard character to push multiple jobs + # matching the pattern. For example `jjb-deploy builder-jjb-*`` will push + # all builder-jjb-* jobs to the sandbox system. + # + # 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) + # + # Optional parameters: + # + # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) + # :gerrit_jjb_deploy_job_triggers: Override Gerrit Triggers. + + ###################### + # Default parameters # + ###################### + + branch: master + git-url: '$GIT_URL/$GERRIT_PROJECT' + stream: master + gerrit_jjb_deploy_job_triggers: + - comment-added-contains-event: + comment-contains-value: jjb-deploy (?!\*+$).+$ + + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: '{build-node}' + concurrent: true + + properties: + - lf-infra-properties: + project: '{project}' + build-days-to-keep: 1 + + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + lftools-version: '{lftools-version}' + + wrappers: + - lf-infra-wrappers: + build-timeout: 5 + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + builders: + - lf-pip-install: + pip-packages: jenkins-job-builder + - lf-infra-jjbini-sandbox + - shell: !include-raw-escape: ../shell/jjb-deploy-job.sh + + publishers: + - lf-infra-publish + +- job-template: + name: '{project-name}-jjb-deploy-job' + id: gerrit-jjb-deploy-job + <<: *lf_jjb_deploy_job + + scm: + - lf-infra-gerrit-scm: + git-url: '{git-url}' + refspec: 'refs/heads/{branch}' + branch: '{branch}' + submodule-recursive: true + choosing-strategy: default + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + triggers: + - gerrit: + server-name: '{gerrit-server-name}' + trigger-on: '{obj:gerrit_jjb_deploy_job_triggers}' + projects: + - project-compare-type: ANT + project-pattern: '{project}' + branches: + - branch-compare-type: ANT + branch-pattern: '**/{branch}' + +- job-template: + name: '{project-name}-jjb-deploy-job' + id: github-jjb-deploy-job + <<: *lf_jjb_deploy_job + + properties: + - github: + url: '{git-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: true + choosing-strategy: default + jenkins-ssh-credential: '{jenkins-ssh-credential}' + + triggers: + - lf-infra-github-pr-trigger: + trigger-phrase: '^jjb-deploy (?!\*+$).+$' + only-trigger-phrase: true + status-context: 'JJB Deploy Job' + permit-all: true + github-hooks: true + github-org: '' + github_pr_whitelist: + - '' + github_pr_admin_list: + - '' + ############# # JJB Merge # ############# @@ -315,7 +561,7 @@ gerrit_verify_triggers: - patchset-created-event: - exclude-drafts: false + exclude-drafts: true exclude-trivial-rebase: false exclude-no-code-change: false - draft-published-event @@ -404,17 +650,54 @@ # Packer Merge # ################ -- lf_packer_merge_builders: &lf_packer_merge_builders - name: lf-packer-merge-builders +- lf_packer_merge: &lf_packer_merge + name: lf-packer-merge - # Adds builders section common to merge packer jobs. - # {packer-cloud-settings} is passed from the project, defines the managed - # file-id name created in Jenkins - # (default: packer-cloud-env) - # {packer-version}: is global defined in job group level, the version number - # can be updated to install the latest version of packer. - # {platforms}: defines the packer platform file, passed from the project. - # {template}: defines the packer template file, passed from the project. + # Packer Merge job runs `packer build` to build system images in the cloud. + # + # 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. + # :platforms: Platform or distribution to build. Typically json file + # found in the packer/vars directory. (Example: centos) + # :template: System template to build. Typically shell script found in + # the packer/provision directory. (Example: java-builder) + # + # 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: 10) + # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) + # :packer-cloud-settings: Name of settings file containing credentials + # for the cloud that packer will build on. (default: packer-cloud-env) + # :packer-version: Version of packer to install / use in build. (default: 1.0.2) + # :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 defined by lf_jjb_common) + + ###################### + # Default parameters # + ###################### + + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: remerge$ + + ##################### + # Job Configuration # + ##################### builders: - lf-infra-packer-validate: @@ -429,28 +712,12 @@ - job-template: name: '{project-name}-packer-merge-{platforms}-{templates}' id: gerrit-packer-merge - concurrent: true - <<: *lf_jjb_common - # yamllint disable-line rule:key-duplicates <<: *lf_packer_common # yamllint disable-line rule:key-duplicates - <<: *lf_packer_merge_builders - - ###################### - # Default parameters # - ###################### + <<: *lf_packer_merge git-url: '$GIT_URL/$GERRIT_PROJECT' - gerrit_merge_triggers: - - change-merged-event - - comment-added-contains-event: - comment-contains-value: remerge$ - - ##################### - # Job Configuration # - ##################### - scm: - lf-infra-gerrit-scm: git-url: '{git-url}' @@ -476,16 +743,9 @@ - job-template: name: '{project-name}-packer-merge-{platforms}-{templates}' id: github-packer-merge - concurrent: true - <<: *lf_jjb_common - # yamllint disable-line rule:key-duplicates <<: *lf_packer_common # yamllint disable-line rule:key-duplicates - <<: *lf_packer_merge_builders - - ##################### - # Job Configuration # - ##################### + <<: *lf_packer_merge properties: - github: @@ -519,41 +779,47 @@ # Packer Verify # ################# -- lf_packer_verify_builders: &lf_packer_verify_builders - name: lf-packer-verify-builders - - # Adds builders section common to verify packer jobs. - # {packer-cloud-settings} is passed from the project, defines the managed - # file-id name created in Jenkins - # (default: packer-cloud-env) - # {packer-version}: is global defined in job group level, the version number - # can be updated to install the latest version of packer. - - builders: - - lf-infra-packer-validate: - packer-cloud-settings: '{packer-cloud-settings}' - packer-version: '{packer-version}' +- lf_packer_verify: &lf_packer_verify + name: lf-packer-verify -- job-template: - name: '{project-name}-packer-verify' - id: gerrit-packer-verify - concurrent: true - <<: *lf_jjb_common - # yamllint disable-line rule:key-duplicates - <<: *lf_packer_common - # yamllint disable-line rule:key-duplicates - <<: *lf_packer_verify_builders + # Packer Verify job runs `packer validate` to verify packer configuration. + # + # 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: 10) + # :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) + # :packer-cloud-settings: Name of settings file containing credentials + # for the cloud that packer will build on. (default: packer-cloud-env) + # :packer-version: Version of packer to install / use in build. (default: 1.0.2) + # :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 defined by lf_jjb_common) ###################### # Default parameters # ###################### build-timeout: 10 - git-url: '$GIT_URL/$GERRIT_PROJECT' gerrit_verify_triggers: - patchset-created-event: - exclude-drafts: false + exclude-drafts: true exclude-trivial-rebase: false exclude-no-code-change: false - draft-published-event @@ -564,6 +830,22 @@ # Job Configuration # ##################### + concurrent: true + + builders: + - lf-infra-packer-validate: + packer-cloud-settings: '{packer-cloud-settings}' + packer-version: '{packer-version}' + +- job-template: + name: '{project-name}-packer-verify' + id: gerrit-packer-verify + <<: *lf_packer_common + # yamllint disable-line rule:key-duplicates + <<: *lf_packer_verify + + git-url: '$GIT_URL/$GERRIT_PROJECT' + scm: - lf-infra-gerrit-scm: git-url: '{git-url}' @@ -583,27 +865,14 @@ branches: - branch-compare-type: ANT branch-pattern: '**/{branch}' - <<: *lf_packer_file_paths + <<: *lf_packer_verify_file_paths - job-template: name: '{project-name}-packer-verify' id: github-packer-verify - concurrent: true - <<: *lf_jjb_common - # yamllint disable-line rule:key-duplicates <<: *lf_packer_common # yamllint disable-line rule:key-duplicates - <<: *lf_packer_verify_builders - - ###################### - # Default parameters # - ###################### - - build-timeout: 10 - - ##################### - # Job Configuration # - ##################### + <<: *lf_packer_verify properties: - github: