X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=jjb%2Flf-python-jobs.yaml;h=c3206e5992b1b230ad3aba6924befef6e6811d01;hb=a41a1b60a457a33fbb51bebdabb603a8a51d5c2f;hp=7cae5b8aa5fc262dcaeb0d1920cfa8738ffcf3d7;hpb=0f5407d52cb7483a04426c49defca6553ac01aaf;p=releng%2Fglobal-jjb.git diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index 7cae5b8a..c3206e59 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -10,34 +10,6 @@ properties-content: "CLM_PROJECT_NAME={clm-project-name}" - shell: !include-raw-escape: ../shell/nexus-iq-cli.sh -- builder: - name: lf-infra-pypi-tag-release - builders: - - config-file-provider: - files: - - file-id: sigul-config - variable: SIGUL_CONFIG - - file-id: sigul-password - variable: SIGUL_PASSWORD - - file-id: sigul-pki - variable: SIGUL_PKI - - file-id: signing-pubkey - variable: SIGNING_PUBKEY - - shell: !include-raw: ../shell/sigul-configuration.sh - - shell: !include-raw: ../shell/sigul-install.sh - - shell: !include-raw: ../shell/pypi-tag-release.sh - -- builder: - name: lf-infra-pypi-upload - builders: - - config-file-provider: - files: - - file-id: pypirc - target: "$HOME/.pypirc" - - inject: - properties-content: "REPOSITORY={pypi-repo}" - - shell: !include-raw-escape: ../shell/pypi-upload.sh - - builder: name: lf-infra-tox-install builders: @@ -111,14 +83,14 @@ java-version: openjdk8 nexus-iq-cli-version: 1.44.0-01 nexus-iq-namespace: "" # Recommend a trailing dash when set. Example: odl- - pre-build-script: "# pre-build script goes here" + pre-build-script: " # pre-build script goes here" stream: master submodule-recursive: true submodule-timeout: 10 submodule-disable: false gerrit_trigger_file_paths: - - compare-type: ANT + - compare-type: REG_EXP pattern: ".*" # github_included_regions MUST match gerrit_trigger_file_paths @@ -158,7 +130,6 @@ name: "{project-name}-python-clm-{stream}" id: gerrit-python-xc-clm <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_python_xc_clm ###################### @@ -207,7 +178,6 @@ name: "{project-name}-python-clm-{stream}" id: github-python-xc-clm <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_python_xc_clm properties: @@ -245,7 +215,7 @@ ######################### - lf_tox_sonar: &lf_tox_sonar - name: lf-tox_sonar + name: lf-tox-sonar ###################### # Default parameters # @@ -261,16 +231,24 @@ java-version: openjdk8 mvn-global-settings: global-settings mvn-goals: validate + mvn-opts: "" + mvn-params: "" mvn-settings: "{mvn-settings}" mvn-version: mvn35 parallel: true pre-build-script: "# pre-build script goes here" python-version: python3 sonar-mvn-goal: "sonar:sonar" + sonarcloud: false + sonarcloud-project-key: "" + sonarcloud-project-organization: "" + sonarcloud-api-token: "" stream: master submodule-recursive: true submodule-timeout: 10 submodule-disable: false + tox-dir: "." + tox-envs: "" gerrit_trigger_file_paths: - compare-type: REG_EXP @@ -291,6 +269,13 @@ project: "{project}" branch: "{branch}" stream: "{stream}" + - lf-infra-maven-parameters: + mvn-opts: "{mvn-opts}" + mvn-params: "{mvn-params}" + mvn-version: "{mvn-version}" + - lf-infra-tox-parameters: + tox-dir: "{tox-dir}" + tox-envs: "{tox-envs}" - string: name: ARCHIVE_ARTIFACTS default: "{archive-artifacts}" @@ -320,11 +305,34 @@ - lf-provide-maven-settings: global-settings-file: "{mvn-global-settings}" settings-file: "{mvn-settings}" - - lf-infra-maven-sonar: - java-version: "{java-version}" - mvn-goals: "{mvn-goals}" - mvn-settings: "{mvn-settings}" - mvn-version: "{mvn-version}" + # With SonarCloud + - conditional-step: + condition-kind: boolean-expression + condition-expression: "{sonarcloud}" + steps: + - shell: echo 'Using SonarCloud' + - lf-infra-maven-sonarcloud: + java-version: "{java-version}" + mvn-goals: "{mvn-goals}" + mvn-settings: "{mvn-settings}" + mvn-version: "{mvn-version}" + sonarcloud-project-key: "{sonarcloud-project-key}" + # yamllint disable-line rule:line-length + sonarcloud-project-organization: "{sonarcloud-project-organization}" + sonarcloud-api-token: "{sonarcloud-api-token}" + # With SonarQube + - conditional-step: + condition-kind: not + condition-operand: + condition-kind: boolean-expression + condition-expression: "{sonarcloud}" + steps: + - shell: echo 'Using SonarQube' + - lf-infra-maven-sonar: + java-version: "{java-version}" + mvn-goals: "{mvn-goals}" + mvn-settings: "{mvn-settings}" + mvn-version: "{mvn-version}" publishers: - lf-infra-publish @@ -333,7 +341,6 @@ name: "{project-name}-tox-sonar" id: gerrit-tox-sonar <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_tox_sonar ###################### @@ -381,7 +388,6 @@ name: "{project-name}-tox-sonar" id: github-tox-sonar <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_tox_sonar properties: @@ -412,6 +418,153 @@ - "{branch}" included-regions: "{obj:github_included_regions}" +################# +# Tox SonarQube # +################# + +- lf_tox_sonarqube: &lf_tox_sonarqube + name: lf-tox-sonarqube + + ###################### + # Default parameters # + ###################### + + archive-artifacts: > + **/*.log + branch: master # Sonar should always be run on master branch + build-days-to-keep: 7 + build-timeout: 15 + cron: "@weekly" + disable-job: false + git-url: "$GIT_URL/$PROJECT" + github-url: "https://github.com" + parallel: false + pre-build-script: "# pre-build script goes here" + python-version: python3 + stream: master + submodule-recursive: true + submodule-timeout: 10 + submodule-disable: false + tox-dir: "." + tox-envs: "" + # Sonar properties + sonar-additional-args: "" + sonar-java-opts: "" + sonar-project-file: "sonar-project.properties" + sonar-properties: "" + sonar-task: "" + + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: "{build-node}" + disabled: "{disable-job}" + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + + wrappers: + - lf-infra-wrappers: + build-timeout: "{build-timeout}" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + + parameters: + - lf-infra-parameters: + project: "{project}" + branch: "{branch}" + stream: "{stream}" + - lf-infra-tox-parameters: + tox-dir: "{tox-dir}" + tox-envs: "{tox-envs}" + - string: + name: ARCHIVE_ARTIFACTS + default: "{archive-artifacts}" + description: Artifacts to archive to the logs server. + + builders: + - lf-infra-pre-build + - lf-infra-tox-install: + python-version: "{python-version}" + - shell: "{pre-build-script}" + - lf-infra-tox-run: + parallel: "{parallel}" + - lf-infra-sonar: + sonar-task: "{sonar-task}" + sonar-project-file: "{sonar-project-file}" + sonar-properties: "{sonar-properties}" + sonar-java-opts: "{sonar-java-opts}" + sonar-additional-args: "{sonar-additional-args}" + + publishers: + - lf-infra-publish + +- job-template: + name: "{project-name}-tox-sonarqube" + id: gerrit-tox-sonarqube + concurrent: false + <<: *lf_tox_sonarqube + + ###################### + # Default parameters # + ###################### + + gerrit_sonar_triggers: + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+run-sonar\s*$' + + scm: + - lf-infra-gerrit-scm: + branch: "$GERRIT_BRANCH" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + git-url: "{git-url}" + refspec: "$GERRIT_REFSPEC" + 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_sonar_triggers}" + projects: + - project-compare-type: "ANT" + project-pattern: "{project}" + branches: + - branch-compare-type: "ANT" + branch-pattern: "**/{branch}" + +- job-template: + name: "{project-name}-tox-sonarqube" + id: github-tox-sonarqube + concurrent: false + <<: *lf_tox_sonarqube + + scm: + - lf-infra-github-scm: + branch: "$sha1" + jenkins-ssh-credential: "{jenkins-ssh-credential}" + url: "{git-clone-url}{github-org}/{project}" + refspec: "+refs/pull/*:refs/remotes/origin/pr/*" + submodule-recursive: "{submodule-recursive}" + submodule-timeout: "{submodule-timeout}" + submodule-disable: "{submodule-disable}" + choosing-strategy: default + + triggers: + - github-pull-request: + trigger-phrase: "^run-sonar$" + only-trigger-phrase: false + status-context: "Tox Sonarqube" + permit-all: true + github-hooks: true + white-list-target-branches: + - "{branch}" + ############## # Tox Common # ############## @@ -599,7 +752,8 @@ submodule-recursive: "{submodule-recursive}" submodule-timeout: "{submodule-timeout}" submodule-disable: "{submodule-disable}" - choosing-strategy: gerrit + # merge jobs always build from tip + choosing-strategy: default triggers: - gerrit: @@ -662,6 +816,8 @@ # Default parameters # ###################### + archive-artifacts: > + **/*.log branch: master build-days-to-keep: 7 build-timeout: 15 @@ -673,22 +829,32 @@ pre-build-script: "# pre-build script goes here" python-version: python3 stream: master + submodule-disable: false submodule-recursive: true submodule-timeout: 10 - submodule-disable: false tox-dir: "." tox-envs: "" - disabled: "{disable-job}" - gerrit_trigger_file_paths: - - compare-type: ANT + - compare-type: REG_EXP pattern: ".*" # github_included_regions MUST match gerrit_trigger_file_paths github_included_regions: - ".*" + ##################### + # Job Configuration # + ##################### + + project-type: freestyle + node: "{build-node}" + disabled: "{disable-job}" + + properties: + - lf-infra-properties: + build-days-to-keep: "{build-days-to-keep}" + parameters: - lf-infra-parameters: project: "{project}" @@ -700,41 +866,22 @@ - bool: name: BUILD_BDIST_WHEEL default: "{dist-binary}" - description: "Set to True to build a wheel" + description: "Set to True (checked) to build a binary distribution" - bool: name: DRY_RUN default: false - description: | - If DRY_RUN is enabled artifacts are not published. + description: "Set to True (checked) to skip uploading artifacts" -- lf_pypi_verify_builders: &lf_pypi_verify_builders - name: lf-pypi-verify-builders - - builders: - - lf-infra-pre-build - - lf-infra-tox-install: - python-version: "{python-version}" - - shell: "{pre-build-script}" - - lf-infra-tox-run: - parallel: "{parallel}" - - shell: !include-raw-escape: ../shell/pypi-dist-build.sh - -- lf_pypi_merge_builders: &lf_pypi_merge_builders - name: lf-pypi-merge-builders + wrappers: + - lf-infra-wrappers: + build-timeout: "{build-timeout}" + jenkins-ssh-credential: "{jenkins-ssh-credential}" - builders: - - lf-infra-pre-build - - lf-infra-tox-install: - python-version: "{python-version}" - - shell: "{pre-build-script}" - - lf-infra-tox-run: - parallel: "{parallel}" - - shell: !include-raw-escape: ../shell/pypi-dist-build.sh - - lf-infra-pypi-upload: - pypi-repo: "{pypi-repo}" + publishers: + - lf-infra-publish -- lf_pypi_release_verify_builders: &lf_pypi_release_verify_builders - name: lf-pypi-release-verify-builders +- lf_pypi_verify_builders: &lf_pypi_verify_builders + name: lf-pypi-verify-builders builders: - lf-infra-pre-build @@ -744,10 +891,9 @@ - lf-infra-tox-run: parallel: "{parallel}" - shell: !include-raw-escape: ../shell/pypi-dist-build.sh - - lf-infra-pypi-tag-release -- lf_pypi_release_merge_builders: &lf_pypi_release_merge_builders - name: lf-pypi-release-merge-builders +- lf_pypi_publish_builders: &lf_pypi_publish_builders + name: lf-pypi-publish-builders builders: - lf-infra-pre-build @@ -757,27 +903,20 @@ - lf-infra-tox-run: parallel: "{parallel}" - shell: !include-raw-escape: ../shell/pypi-dist-build.sh - - lf-infra-pypi-tag-release - - lf-infra-pypi-upload: - pypi-repo: "{pypi-repo}" + - config-file-provider: + files: + - file-id: pypirc + target: "$HOME/.pypirc" + - inject: + properties-content: "REPOSITORY={pypi-repo}" + - shell: !include-raw-escape: ../shell/pypi-upload.sh - job-template: name: "{project-name}-pypi-verify-{stream}" id: gerrit-pypi-verify - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_pypi_common <<: *lf_pypi_verify_builders - 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}" @@ -792,7 +931,15 @@ triggers: - gerrit: server-name: "{gerrit-server-name}" - trigger-on: "{obj:gerrit_verify_triggers}" + trigger-on: + - patchset-created-event: + exclude-drafts: true + exclude-trivial-rebase: false + exclude-no-code-change: false + - draft-published-event + - comment-added-contains-event: + # yamllint disable-line rule:line-length + comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' projects: - project-compare-type: ANT project-pattern: "{project}" @@ -804,8 +951,6 @@ - job-template: name: "{project-name}-pypi-verify-{stream}" id: github-pypi-verify - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_pypi_common <<: *lf_pypi_verify_builders @@ -838,19 +983,12 @@ - job-template: name: "{project-name}-pypi-merge-{stream}" id: gerrit-pypi-merge - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_pypi_common - <<: *lf_pypi_merge_builders + <<: *lf_pypi_publish_builders - cron: "" + cron: "" # avoid for pypi which rejects duplicates pypi-repo: pypi-test - 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}" @@ -860,13 +998,17 @@ submodule-recursive: "{submodule-recursive}" submodule-timeout: "{submodule-timeout}" submodule-disable: "{submodule-disable}" - choosing-strategy: gerrit + # merge jobs always build from tip + choosing-strategy: default triggers: - timed: "{obj:cron}" - gerrit: server-name: "{gerrit-server-name}" - trigger-on: "{obj:gerrit_merge_triggers}" + trigger-on: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: '^Patch Set\s+\d+:\s+remerge\s*$' projects: - project-compare-type: ANT project-pattern: "{project}" @@ -878,10 +1020,8 @@ - job-template: name: "{project-name}-pypi-merge-{stream}" id: github-pypi-merge - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates <<: *lf_pypi_common - <<: *lf_pypi_merge_builders + <<: *lf_pypi_publish_builders cron: "" pypi-repo: pypi-test @@ -917,66 +1057,18 @@ - "{branch}" included-regions: "{obj:github_included_regions}" -- lf_pypi_release_common: &lf_pypi_release_common - name: lf-pypi-release-common - - dist-binary: true - pypi-repo: pypi - use-release-file: true - - # define once and use twice; jobs MUST NOT override - gerrit_release_trigger_file_paths: - - compare-type: REG_EXP - pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)' - - # github_release_included_regions MUST match gerrit_release_trigger_file_paths - github_release_included_regions: - - 'releases\/.*\.yaml' - - '.releases\/.*\.yaml' - - parameters: - - lf-infra-parameters: - project: "{project}" - branch: "{branch}" - stream: "{stream}" - - lf-infra-tox-parameters: - tox-dir: "{tox-dir}" - tox-envs: "{tox-envs}" - - bool: - name: BUILD_BDIST_WHEEL - default: "{dist-binary}" - description: "Set to True to build a wheel" - - string: - name: VERSION - default: "" - description: "This is the version, example: 1.0.0" - - bool: - name: USE_RELEASE_FILE - default: "{use-release-file}" - description: "Set to False for job built with parameters" - - bool: - name: DRY_RUN - default: false - description: | - If DRY_RUN is enabled artifacts are not published. - - job-template: - name: "{project-name}-pypi-release-verify-{stream}" - id: gerrit-pypi-release-verify - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates + name: "{project-name}-pypi-stage-{stream}" + id: gerrit-pypi-stage <<: *lf_pypi_common - <<: *lf_pypi_release_common - <<: *lf_pypi_release_verify_builders + <<: *lf_pypi_publish_builders - gerrit_verify_triggers: - - patchset-created-event: - exclude-drafts: true - exclude-trivial-rebase: false - exclude-no-code-change: false - - draft-published-event + cron: "" + pypi-repo: pypi-test + + gerrit_stage_triggers: - comment-added-contains-event: - comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify)\s*$' + comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\s*$' scm: - lf-infra-gerrit-scm: @@ -987,98 +1079,30 @@ submodule-recursive: "{submodule-recursive}" submodule-timeout: "{submodule-timeout}" submodule-disable: "{submodule-disable}" - 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_release_trigger_file_paths}" - -- job-template: - name: "{project-name}-pypi-release-verify-{stream}" - id: github-pypi-release-verify - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates - <<: *lf_pypi_common - <<: *lf_pypi_release_common - <<: *lf_pypi_release_verify_builders - - properties: - - 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}" - submodule-disable: "{submodule-disable}" + # stage jobs always build from tip choosing-strategy: default - jenkins-ssh-credential: "{jenkins-ssh-credential}" - - triggers: - - github-pull-request: - trigger-phrase: "^(recheck|reverify)$" - only-trigger-phrase: false - status-context: "PyPI Release Verify" - permit-all: true - github-hooks: true - white-list-target-branches: - - "{branch}" - included-regions: "{obj:github_release_included_regions}" - -- job-template: - name: "{project-name}-pypi-release-merge-{stream}" - id: gerrit-pypi-release-merge - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates - <<: *lf_pypi_common - <<: *lf_pypi_release_common - <<: *lf_pypi_release_merge_builders - - gerrit_release_triggers: - - change-merged-event - - 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: gerrit triggers: + - timed: "{obj:cron}" - gerrit: server-name: "{gerrit-server-name}" - trigger-on: "{obj:gerrit_release_triggers}" + trigger-on: "{obj:gerrit_stage_triggers}" projects: - - project-compare-type: "ANT" + - project-compare-type: ANT project-pattern: "{project}" branches: - branch-compare-type: ANT branch-pattern: "**/{branch}" - file-paths: "{obj:gerrit_release_trigger_file_paths}" + file-paths: "{obj:gerrit_trigger_file_paths}" - job-template: - name: "{project-name}-pypi-release-merge-{stream}" - id: github-pypi-release-merge - <<: *lf_python_common - # yamllint disable-line rule:key-duplicates + name: "{project-name}-pypi-stage-{stream}" + id: github-pypi-stage <<: *lf_pypi_common - <<: *lf_pypi_release_common - <<: *lf_pypi_release_merge_builders + <<: *lf_pypi_publish_builders + + cron: "" + pypi-repo: pypi-test properties: - github: @@ -1096,12 +1120,13 @@ jenkins-ssh-credential: "{jenkins-ssh-credential}" triggers: + - timed: "{obj:cron}" - github-pull-request: - trigger-phrase: "^(remerge)$" - only-trigger-phrase: false - status-context: "PyPI Release Merge" + trigger-phrase: "^stage-release$" + only-trigger-phrase: true + status-context: "Release" permit-all: true github-hooks: true white-list-target-branches: - "{branch}" - included-regions: "{obj:github_release_included_regions}" + included-regions: "{obj:github_included_regions}"