From f77c9f6c2d265bc4f9050d6593de5b295cb32f19 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Fri, 8 Nov 2019 13:39:36 -0500 Subject: [PATCH] Refactor ORAN build-by-shell job templates Add common block with default parameters etc. Rename verify template to oran-shell-verify. Add merge template oran-shell-merge. Update pti/rtp job for renamed verify template. Signed-off-by: Lott, Christopher (cl778h) Change-Id: If34617e6a838433928a4993622908fe48026bf6a --- jjb/oran-jjb/oran-shell-jobs.yaml | 123 ++++++++++++++++++++++++++++---------- jjb/pti-rtp/pti-rtp.yaml | 2 +- 2 files changed, 92 insertions(+), 33 deletions(-) diff --git a/jjb/oran-jjb/oran-shell-jobs.yaml b/jjb/oran-jjb/oran-shell-jobs.yaml index 5a5b861f..3b688536 100644 --- a/jjb/oran-jjb/oran-shell-jobs.yaml +++ b/jjb/oran-jjb/oran-shell-jobs.yaml @@ -12,47 +12,31 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -# -# Template for verifying gerrit changeset by shell script. -# Runs on changeset branch to verify new commits; can also run on master. -# -# Required parameters: -# build-node: label (flavor) of jenkins build minion -# project: git repository -# project-name: Jenkins job name prefix -# script: shell script to execute -# Optional parameters: -# branch: git branch, defaults to master -# stream: friendly stream name (often same as branch), defaults to master -- job-template: - name: '{project-name}-verify-shell-{stream}' - id: oran-verify-shell +- oran_shell_common: &oran_shell_common + name: oran-shell-common ###################### # Default parameters # ###################### + archive-artifacts: > + **/*.log branch: master build-days-to-keep: 7 build-timeout: 15 + cron: '' + concurrent: false disable-job: false - gerrit_trigger_file_paths: - - compare-type: REG_EXP - pattern: '.*' gerrit-skip-vote: false - 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: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' - git-url: '$GIT_URL/$PROJECT' + git-url: '$GIT_URL/$GERRIT_PROJECT' stream: master + submodule-disable: false submodule-recursive: true submodule-timeout: 10 - submodule-disable: false + + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: '.*' ##################### # Job Configuration # @@ -71,12 +55,47 @@ project: '{project}' branch: '{branch}' stream: '{stream}' + - string: + name: ARCHIVE_ARTIFACTS + default: '{archive-artifacts}' + description: Artifacts to archive to the logs server. wrappers: - lf-infra-wrappers: build-timeout: '{build-timeout}' jenkins-ssh-credential: '{jenkins-ssh-credential}' + builders: + - shell: '{script}' + + publishers: + - lf-infra-publish + +# Verify gerrit changeset by shell script. +# Runs on changeset branch to verify new commits; can be run on any branch. +# +# Required parameters: +# build-node: label (flavor) of jenkins build minion +# project: git repository +# project-name: Jenkins job name prefix +# script: shell script to execute +# Optional parameters: +# branch: git branch pattern, defaults to master +# stream: friendly stream name (often same as branch), defaults to master +- job-template: + name: '{project-name}-shell-verify-{stream}' + id: oran-shell-verify + <<: *oran_shell_common + + 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: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' + scm: - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' @@ -89,6 +108,7 @@ choosing-strategy: gerrit triggers: + - timed: '{obj:cron}' - gerrit: server-name: '{gerrit-server-name}' trigger-on: '{obj:gerrit_verify_triggers}' @@ -105,8 +125,47 @@ unstable: '{gerrit-skip-vote}' notbuilt: '{gerrit-skip-vote}' - builders: - - shell: '{script}' +# Build from gerrit by shell script. +# Triggered automatically by merge; can be run on any branch. +# +# Required parameters: +# build-node: label (flavor) of jenkins build minion +# project: git repository +# project-name: Jenkins job name prefix +# script: shell script to execute +# Optional parameters: +# branch: git branch pattern, defaults to master +# stream: friendly stream name (often same as branch), defaults to master +- job-template: + name: '{project-name}-shell-merge-{stream}' + id: oran-shell-merge + <<: *oran_shell_common - publishers: - - lf-infra-publish + gerrit_merge_triggers: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$' + + 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}' + submodule-disable: '{submodule-disable}' + 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}' diff --git a/jjb/pti-rtp/pti-rtp.yaml b/jjb/pti-rtp/pti-rtp.yaml index 240d58cc..14f231e6 100644 --- a/jjb/pti-rtp/pti-rtp.yaml +++ b/jjb/pti-rtp/pti-rtp.yaml @@ -23,4 +23,4 @@ build-timeout: 60 script: !include-raw-escape: verify-pti-rtp-centos.sh jobs: - - oran-verify-shell + - oran-shell-verify -- 2.16.6