From 6df0883fb085c17d7c53480783034cac21133399 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Tue, 1 Oct 2019 06:37:56 -0400 Subject: [PATCH] Adjust Jenkins triggers in PyPI templates - In the PyPI merge template, add cron parameter to support daily build and push to a staging repo, like the maven merge template. - In PyPI release templates, change name of gerrit and github trigger file patterns parameter. This avoids accidental overriding by jobs that limit their actions to subdirectories. The release file patterns are hardcoded in a shell script. Remove params from doc. - In all PyPI templates, add disabled option and disable-job parameter to be consistent with other python templates. Change-Id: Ib2934728efbb4d957ad622dc84f1ee2a8383a27c Signed-off-by: Lott, Christopher (cl778h) --- docs/jjb/lf-python-jobs.rst | 14 +++++++------- jjb/lf-python-jobs.yaml | 21 ++++++++++++++------- .../repair-pypi-triggers-290e25834dfbc34a.yaml | 11 +++++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/repair-pypi-triggers-290e25834dfbc34a.yaml diff --git a/docs/jjb/lf-python-jobs.rst b/docs/jjb/lf-python-jobs.rst index bea44fc4..e6e86b26 100644 --- a/docs/jjb/lf-python-jobs.rst +++ b/docs/jjb/lf-python-jobs.rst @@ -363,6 +363,7 @@ pyenv variables before running. :branch: The branch to build against. (default: master) :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) :build-timeout: Timeout in minutes before aborting build. (default: 15) + :disable-job: Whether to disable the job (default: false) :dist-binary: Whether to build a binary wheel distribution. (default: true) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :parallel: Boolean indicator for tox to run tests in parallel or series. @@ -451,6 +452,10 @@ directory, an example appears next. :branch: The branch to build against. (default: master) :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) :build-timeout: Timeout in minutes before aborting build. (default: 15) + :cron: Cron schedule when to trigger the job. Supports daily builds. + This parameter also supports multiline input via YAML pipe | character in + cases where one may want to provide more than 1 cron timer. (default: empty) + :disable-job: Whether to disable the job (default: false) :dist-binary: Whether to build a binary wheel distribution. (default: true) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :parallel: Boolean indicator for tox to run tests in parallel or series. @@ -559,6 +564,7 @@ An example of a pypi release file appears below. :branch: The branch to build against. (default: master) :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) :build-timeout: Timeout in minutes before aborting build. (default: 15) + :disable-job: Whether to disable the job (default: false) :dist-binary: Whether to build a binary wheel distribution. (default: true) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :parallel: Boolean indicator for tox to run tests in parallel or series. @@ -584,10 +590,6 @@ An example of a pypi release file appears below. :tox-envs: Tox environments to run. If blank run everything described in tox.ini. (default: '') :use-release-file: Whether to use the release file. (default: true) - :gerrit_trigger_file_paths: Override file paths used to filter which file - modifications trigger a build. Refer to JJB documentation for "file-path" details. - https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit - PyPI Release Merge ------------------ @@ -642,6 +644,7 @@ The special parameters are as follows:: :branch: The branch to build against. (default: master) :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) :build-timeout: Timeout in minutes before aborting build. (default: 15) + :disable-job: Whether to disable the job (default: false) :dist-binary: Whether to build a binary wheel distribution. (default: true) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :parallel: Boolean indicator for tox to run tests in parallel or series. @@ -667,6 +670,3 @@ The special parameters are as follows:: :tox-envs: Tox environments to run. If blank run everything described in tox.ini. (default: '') :use-release-file: Whether to use the release file. (default: true) - :gerrit_trigger_file_paths: Override file paths used to filter which file - modifications trigger a build. Refer to JJB documentation for "file-path" details. - https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index e28bc22b..ead9195c 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -679,6 +679,8 @@ tox-dir: "." tox-envs: "" + disabled: "{disable-job}" + gerrit_trigger_file_paths: - compare-type: ANT pattern: ".*" @@ -836,6 +838,7 @@ <<: *lf_pypi_common <<: *lf_pypi_merge_builders + cron: "" pypi-repo: staging gerrit_merge_triggers: @@ -855,6 +858,7 @@ choosing-strategy: gerrit triggers: + - timed: "{obj:cron}" - gerrit: server-name: "{gerrit-server-name}" trigger-on: "{obj:gerrit_merge_triggers}" @@ -874,6 +878,7 @@ <<: *lf_pypi_common <<: *lf_pypi_merge_builders + cron: "" pypi-repo: staging properties: @@ -892,6 +897,7 @@ jenkins-ssh-credential: "{jenkins-ssh-credential}" triggers: + - timed: "{obj:cron}" - github-pull-request: trigger-phrase: "^remerge$" only-trigger-phrase: false @@ -913,12 +919,13 @@ pypi-repo: pypi use-release-file: true - gerrit_trigger_file_paths: + # define once and use twice; jobs MUST NOT override + gerrit_release_trigger_file_paths: - compare-type: REG_EXP pattern: '(releases\/.*\.yaml|\.releases\/.*\.yaml)' - # github_included_regions MUST match gerrit_trigger_file_paths - github_included_regions: + # github_release_included_regions MUST match gerrit_release_trigger_file_paths + github_release_included_regions: - 'releases\/.*\.yaml' - '.releases\/.*\.yaml' @@ -987,7 +994,7 @@ branches: - branch-compare-type: "ANT" branch-pattern: "**" - file-paths: "{obj:gerrit_trigger_file_paths}" + file-paths: "{obj:gerrit_release_trigger_file_paths}" - job-template: name: "{project-name}-pypi-release-verify-{stream}" @@ -1022,7 +1029,7 @@ github-hooks: true white-list-target-branches: - "{branch}" - included-regions: "{obj:github_included_regions}" + included-regions: "{obj:github_release_included_regions}" - job-template: name: "{project-name}-pypi-release-merge-{stream}" @@ -1057,7 +1064,7 @@ branches: - branch-compare-type: "ANT" branch-pattern: "**" - file-paths: "{obj:gerrit_trigger_file_paths}" + file-paths: "{obj:gerrit_release_trigger_file_paths}" - job-template: name: "{project-name}-pypi-release-merge-{stream}" @@ -1092,4 +1099,4 @@ github-hooks: true white-list-target-branches: - "{branch}" - included-regions: "{obj:github_included_regions}" + included-regions: "{obj:github_release_included_regions}" diff --git a/releasenotes/notes/repair-pypi-triggers-290e25834dfbc34a.yaml b/releasenotes/notes/repair-pypi-triggers-290e25834dfbc34a.yaml new file mode 100644 index 00000000..7ea171d9 --- /dev/null +++ b/releasenotes/notes/repair-pypi-triggers-290e25834dfbc34a.yaml @@ -0,0 +1,11 @@ +--- +fixes: + - | + In the PyPI merge template, add cron parameter to support daily build + and push to a staging repo, like the maven merge template. + In PyPI release templates, change name of gerrit and github trigger + file patterns parameter. This avoids accidental overriding by jobs + that limit their actions to subdirectories. The release file patterns + are hardcoded in a shell script. Remove params from RST doc. + In all PyPI templates, add disabled option and disable-job parameter + to be consistent with other python templates. -- 2.16.6