Add PyPI stage templates
[releng/global-jjb.git] / jjb / lf-python-jobs.yaml
index 9f91a6f..c3206e5 100644 (file)
           parallel: "{parallel}"
       - shell: !include-raw-escape: ../shell/pypi-dist-build.sh
 
-- lf_pypi_merge_builders: &lf_pypi_merge_builders
-    name: lf-pypi-merge-builders
+- lf_pypi_publish_builders: &lf_pypi_publish_builders
+    name: lf-pypi-publish-builders
 
     builders:
       - lf-infra-pre-build
     name: "{project-name}-pypi-merge-{stream}"
     id: gerrit-pypi-merge
     <<: *lf_pypi_common
-    <<: *lf_pypi_merge_builders
+    <<: *lf_pypi_publish_builders
 
-    cron: ""
+    cron: "" # avoid for pypi which rejects duplicates
     pypi-repo: pypi-test
 
     scm:
     name: "{project-name}-pypi-merge-{stream}"
     id: github-pypi-merge
     <<: *lf_pypi_common
-    <<: *lf_pypi_merge_builders
+    <<: *lf_pypi_publish_builders
 
     cron: ""
     pypi-repo: pypi-test
           white-list-target-branches:
             - "{branch}"
           included-regions: "{obj:github_included_regions}"
+
+- job-template:
+    name: "{project-name}-pypi-stage-{stream}"
+    id: gerrit-pypi-stage
+    <<: *lf_pypi_common
+    <<: *lf_pypi_publish_builders
+
+    cron: ""
+    pypi-repo: pypi-test
+
+    gerrit_stage_triggers:
+      - comment-added-contains-event:
+          comment-contains-value: '^Patch Set\s+\d+:\s+stage-release\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}"
+          # stage jobs always build from tip
+          choosing-strategy: default
+
+    triggers:
+      - timed: "{obj:cron}"
+      - gerrit:
+          server-name: "{gerrit-server-name}"
+          trigger-on: "{obj:gerrit_stage_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}-pypi-stage-{stream}"
+    id: github-pypi-stage
+    <<: *lf_pypi_common
+    <<: *lf_pypi_publish_builders
+
+    cron: ""
+    pypi-repo: pypi-test
+
+    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}"
+          choosing-strategy: default
+          jenkins-ssh-credential: "{jenkins-ssh-credential}"
+
+    triggers:
+      - timed: "{obj:cron}"
+      - github-pull-request:
+          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_included_regions}"