From 15ca162dfa0f9acbb14c296f1cc74ca6c4f980ba Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 14 Apr 2020 15:55:55 +0200 Subject: [PATCH] Fix SCM macro usage of refspec, branches - fix ignored refspec SCM parameter (hardcoded to empty string): s/refspec: ''/refspec: '$GERRIT_REFSPEC'/g - fix IEC SCM configuration regression (broken in previous commit): s/branches: '$GERRIT_BRANCH'/branch: 'GERRIT_BRANCH'/g - add missing lf-infra-parameters macro to bluval job; - use lf-infra-gerrit-scm macro in IEC templates (now that submodule recursive cloning parametrization is supported); - retire 'validation-job-parameters' parameters macro, which is only an alias for 'lf-infra-parameters'; - rework validation SCM handling for refs/tags/...; JIRA: VAL-103 Change-Id: I94957fb02afdfe8a01330e768dc5fde15f5ea05d Signed-off-by: Alexandru Avadanii --- jjb/akraino-templates/akraino-iec-templates.yaml | 17 ++-- jjb/akraino-templates/akraino-jjb-docker.yaml | 8 +- jjb/akraino-templates/akraino-jjb-templates.yaml | 4 +- .../akraino-validation-macros.yaml | 34 +------- .../akraino-validation-templates.yaml | 94 +++++----------------- jjb/validation/validation-docker.yaml | 2 - 6 files changed, 37 insertions(+), 122 deletions(-) diff --git a/jjb/akraino-templates/akraino-iec-templates.yaml b/jjb/akraino-templates/akraino-iec-templates.yaml index c60e915..8690514 100644 --- a/jjb/akraino-templates/akraino-iec-templates.yaml +++ b/jjb/akraino-templates/akraino-iec-templates.yaml @@ -126,17 +126,14 @@ name: '$BUILD_NUMBER - Scenario: $DEPLOY_SCENARIO $IEC_TYPE' scm: &scm - - git: - credentials-id: '{jenkins-ssh-credential}' - url: '{git-url}/{project}.git' + - lf-infra-gerrit-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + git-url: '{git-url}/{project}.git' refspec: '$GERRIT_REFSPEC' - branches: '$GERRIT_BRANCH' - skip-tag: true - wipe-workspace: true - submodule: - disable: true - recursive: false - timeout: '{submodule-timeout}' + branch: '$GERRIT_BRANCH' + submodule-recursive: false + submodule-timeout: '{submodule-timeout}' + submodule-disable: true choosing-strategy: default builders: diff --git a/jjb/akraino-templates/akraino-jjb-docker.yaml b/jjb/akraino-templates/akraino-jjb-docker.yaml index 340659a..597b0fb 100644 --- a/jjb/akraino-templates/akraino-jjb-docker.yaml +++ b/jjb/akraino-templates/akraino-jjb-docker.yaml @@ -31,8 +31,8 @@ - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' git-url: '{git-url}/{project}.git' - refspec: '' - branch: '{branch}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' submodule-recursive: '{submodule-recursive}' submodule-timeout: '{submodule-timeout}' submodule-disable: false @@ -74,8 +74,8 @@ - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' git-url: '{git-url}/{project}.git' - refspec: '' - branch: '{branch}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' submodule-recursive: '{submodule-recursive}' submodule-timeout: '{submodule-timeout}' submodule-disable: false diff --git a/jjb/akraino-templates/akraino-jjb-templates.yaml b/jjb/akraino-templates/akraino-jjb-templates.yaml index 82d34dd..52d4901 100644 --- a/jjb/akraino-templates/akraino-jjb-templates.yaml +++ b/jjb/akraino-templates/akraino-jjb-templates.yaml @@ -375,8 +375,8 @@ - lf-infra-gerrit-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' git-url: '{git-url}/{project}.git' - refspec: '' - branch: '{branch}' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' submodule-recursive: true submodule-timeout: '{submodule-timeout}' submodule-disable: false diff --git a/jjb/akraino-templates/akraino-validation-macros.yaml b/jjb/akraino-templates/akraino-validation-macros.yaml index c484efd..471d2b9 100644 --- a/jjb/akraino-templates/akraino-validation-macros.yaml +++ b/jjb/akraino-templates/akraino-validation-macros.yaml @@ -1,35 +1,7 @@ --- -####### -# SCM # -####### -- scm: - # Enhanced version of the global-jjb - name: validation-infra-gerrit-scm - scm: - - git: - credentials-id: '{jenkins-ssh-credential}' - url: '{git-url}' - refspec: '{refspec}' - branches: - - 'refs/{refs_tag}/{stream}' - skip-tag: false - wipe-workspace: true - submodule: - recursive: '{submodule-recursive}' - timeout: '{submodule-timeout}' - choosing-strategy: '{choosing-strategy}' - ############## # PARAMETERS # ############## -- parameter: - name: validation-job-parameters - parameters: - - lf-infra-parameters: - project: '{project}' - stream: '{stream}' - branch: '{branch}' - - parameter: name: bluval-defaults parameters: @@ -100,10 +72,8 @@ # settings for jobs run in multijob phases - docker-build-job-settings: &docker-build-job-settings name: docker_build_job_settings - current-parameters: false - git-revision: true + current-parameters: true + git-revision: false node-parameters: false - predefined-parameters: | - GERRIT_REFNAME=$GERRIT_REFNAME kill-phase-on: FAILURE abort-all-jobs: false diff --git a/jjb/akraino-templates/akraino-validation-templates.yaml b/jjb/akraino-templates/akraino-validation-templates.yaml index d2a57f1..8a64fed 100644 --- a/jjb/akraino-templates/akraino-validation-templates.yaml +++ b/jjb/akraino-templates/akraino-validation-templates.yaml @@ -8,7 +8,7 @@ build-timeout: 90 parameters: - - validation-job-parameters: + - lf-infra-parameters: &validation_lf_infra_parameters project: '{project}' branch: '{branch}' stream: '{stream}' @@ -22,17 +22,6 @@ blocking-jobs: - 'validation-docker-.*' block-level: 'NODE' - scm: - - validation-infra-gerrit-scm: - jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}/{project}.git' - refspec: '' - refs_tag: '{refs_tag}' - stream: '{stream}' - submodule-recursive: false - submodule-timeout: '{submodule-timeout}' - submodule-disable: false - choosing-strategy: default triggers: # Build nigtly at 12:10 AM @@ -70,11 +59,7 @@ build-timeout: 75 parameters: - - validation-job-parameters: - project: '{project}' - branch: '{branch}' - stream: '{stream}' - arch_tag: '{arch_tag}' + - lf-infra-parameters: *validation_lf_infra_parameters properties: - build-blocker: @@ -82,13 +67,14 @@ blocking-jobs: - 'validation-docker-build-.*' block-level: 'NODE' - scm: - - validation-infra-gerrit-scm: + scm: &validation_scm + # lf-infra-gerrit-scm hardcodes branch specifier to refs/heads; while + # lf-infra-github-scm does not, allowing us to pass a fully custom '{branch}' + - lf-infra-github-scm: jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}/{project}.git' - refspec: '' - refs_tag: '{refs_tag}' - stream: '{stream}' + url: '{git-url}/{project}.git' + refspec: '$GERRIT_REFSPEC' + branch: '$STREAM' submodule-recursive: false submodule-timeout: '{submodule-timeout}' submodule-disable: false @@ -98,21 +84,10 @@ - lf-infra-docker-login: global-settings-file: global-settings settings-file: '{mvn-settings}' - - conditional-step: - condition-kind: regex-match - regex: '^tags$' - label: '{refs_tag}' - steps: - - shell: | - #!/bin/bash -ex - echo "export TAG_VER=$STREAM" >> tag_version.sh - shell: | #!/bin/bash -ex - if [ -f tag_version.sh ]; then source tag_version.sh; fi + if [ "{branch}" != "{stream}" ]; then export TAG_VER=$STREAM; fi make -k -C docker push-all - rm -f tag_version.sh - - shell: | - #!/bin/bash -ex docker system prune -af - job-template: @@ -122,42 +97,20 @@ build-timeout: 15 parameters: - - validation-job-parameters: - project: '{project}' - branch: '{branch}' - stream: '{stream}' + - lf-infra-parameters: *validation_lf_infra_parameters disabled: '{obj:disabled}' - scm: - - validation-infra-gerrit-scm: - jenkins-ssh-credential: '{jenkins-ssh-credential}' - git-url: '{git-url}/{project}.git' - refspec: '' - refs_tag: '{refs_tag}' - stream: '{stream}' - submodule-recursive: false - submodule-timeout: '{submodule-timeout}' - submodule-disable: false - choosing-strategy: default + scm: *validation_scm builders: - lf-infra-docker-login: global-settings-file: global-settings settings-file: '{mvn-settings}' - - conditional-step: - condition-kind: regex-match - regex: '^tags$' - label: '{refs_tag}' - steps: - - shell: | - #!/bin/bash -ex - echo "export TAG_VER=$STREAM" >> tag_version.sh - shell: | #!/bin/bash -ex - if [ -f tag_version.sh ]; then source tag_version.sh; fi + if [ "{branch}" != "{stream}" ]; then export TAG_VER=$STREAM; fi for sd in docker/*/.; do make -k -C $sd .push_manifest; done - rm -f tag_version.sh - job-template: id: akraino-validation-lab-daily @@ -181,24 +134,21 @@ concurrent: true node: '{build-node}' parameters: + - lf-infra-parameters: *validation_lf_infra_parameters - string: name: DEPLOY_SCENARIO default: '' - {'bluval-defaults'} scm: - - git: - credentials-id: '{jenkins-ssh-credential}' - url: '{git-url}/validation.git' - refspec: '' - branches: - - 'refs/heads/{branch}' - skip-tag: true - wipe-workspace: true - submodule: - disable: true - recursive: false - timeout: '{submodule-timeout}' + - lf-infra-github-scm: + jenkins-ssh-credential: '{jenkins-ssh-credential}' + url: '{git-url}/{project}.git' + refspec: '$GERRIT_REFSPEC' + branch: '$GERRIT_BRANCH' + submodule-recursive: false + submodule-timeout: '{submodule-timeout}' + submodule-disable: true choosing-strategy: default builders: diff --git a/jjb/validation/validation-docker.yaml b/jjb/validation/validation-docker.yaml index 0143422..37ff4ed 100644 --- a/jjb/validation/validation-docker.yaml +++ b/jjb/validation/validation-docker.yaml @@ -6,11 +6,9 @@ stream: - master: branch: '{stream}' - refs_tag: 'heads' disabled: false - 2.0.1: branch: 'master' - refs_tag: 'tags' disabled: true arch_tag: -- 2.16.6