From 1b473a840edefb922819c44ba95730f9d9a77f20 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 15 Nov 2023 17:53:19 +0100 Subject: [PATCH] Refactor foreman-packaging-*-release jobs for reuse This introduces a completely reusable foreman-packaging-{packaging_label}-{version}-release job template. Then it instantiates the various versions of it. The design is currently that it creates both koji and copr for nightly, but only a single rpm instance for releases. The branch-foreman script is modified to do the right thing. --- branch-foreman | 2 + .../includes/foreman_versions_copr.yaml.inc | 1 + .../includes/foreman_versions_koji.yaml.inc | 2 + .../foreman-packaging-deb-release.yaml | 36 --------- .../release/foreman-packaging-release.yaml | 80 +++++++++++++++++++ .../foreman-packaging-rpm-release.yaml | 64 --------------- 6 files changed, 85 insertions(+), 100 deletions(-) create mode 100644 theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc create mode 100644 theforeman.org/yaml/includes/foreman_versions_koji.yaml.inc delete mode 100644 theforeman.org/yaml/jobs/release/foreman-packaging-deb-release.yaml create mode 100644 theforeman.org/yaml/jobs/release/foreman-packaging-release.yaml delete mode 100644 theforeman.org/yaml/jobs/release/foreman-packaging-rpm-release.yaml diff --git a/branch-foreman b/branch-foreman index 94cbb80d..9aaf2c55 100755 --- a/branch-foreman +++ b/branch-foreman @@ -21,6 +21,8 @@ sed -i "/nightly/i \ \ \ \ \ \ - '${KATELLO_VERSION}'" centos.org/jobs/katello-p echo "- '${FOREMAN_VERSION}'" >> theforeman.org/yaml/includes/foreman_versions.yaml.inc +echo "- '${FOREMAN_VERSION}'" >> theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc + echo " - '${KATELLO_VERSION}'" >> theforeman.org/yaml/jobs/pipeline/katello-rpm-pipeline.yaml # TODO This should be a templated pipeline diff --git a/theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc b/theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc @@ -0,0 +1 @@ +[] diff --git a/theforeman.org/yaml/includes/foreman_versions_koji.yaml.inc b/theforeman.org/yaml/includes/foreman_versions_koji.yaml.inc new file mode 100644 index 00000000..08e95c39 --- /dev/null +++ b/theforeman.org/yaml/includes/foreman_versions_koji.yaml.inc @@ -0,0 +1,2 @@ +- '3.7' +- '3.8' diff --git a/theforeman.org/yaml/jobs/release/foreman-packaging-deb-release.yaml b/theforeman.org/yaml/jobs/release/foreman-packaging-deb-release.yaml deleted file mode 100644 index 0c76f55c..00000000 --- a/theforeman.org/yaml/jobs/release/foreman-packaging-deb-release.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- job-template: - name: 'foreman-packaging-deb-{version}-release' - project-type: pipeline - sandbox: true - concurrent: false - properties: - - github: - url: https://github.com/theforeman/foreman-packaging - triggers: - - github - dsl: - !include-raw: - - 'pipelines/vars/foreman/{version}.groovy' - - 'pipelines/release/foreman_packaging_deb_release.groovy{empty}' - - 'pipelines/lib/git.groovy{empty}' - - 'pipelines/lib/ansible.groovy{empty}' - - 'pipelines/lib/obal.groovy{empty}' - - 'pipelines/lib/packaging.groovy{empty}' - - 'pipelines/lib/foreman_infra.groovy{empty}' - -- project: - name: foreman-packaging-deb - jobs: - - 'foreman-packaging-deb-{version}-release' - empty: '' - version: - !include: ../../includes/foreman_versions.yaml.inc - -- project: - name: foreman-packaging-deb-nightly - jobs: - - 'foreman-packaging-deb-{version}-release' - empty: '' - version: - - 'nightly' diff --git a/theforeman.org/yaml/jobs/release/foreman-packaging-release.yaml b/theforeman.org/yaml/jobs/release/foreman-packaging-release.yaml new file mode 100644 index 00000000..0134af41 --- /dev/null +++ b/theforeman.org/yaml/jobs/release/foreman-packaging-release.yaml @@ -0,0 +1,80 @@ +--- +- job-template: + name: 'foreman-packaging-{packaging_label}-{version}-release' + project-type: pipeline + sandbox: true + concurrent: false + properties: + - github: + url: https://github.com/theforeman/foreman-packaging + triggers: + - github + dsl: + !include-raw: + - 'pipelines/vars/foreman/{version}.groovy' + - 'pipelines/release/foreman_packaging_{packaging_type}_release.groovy{empty}' + - 'pipelines/lib/git.groovy{empty}' + - 'pipelines/lib/ansible.groovy{empty}' + - 'pipelines/lib/obal.groovy{empty}' + - 'pipelines/lib/packaging.groovy{empty}' + - 'pipelines/lib/foreman_infra.groovy{empty}' + +- project: + name: foreman-packaging-deb + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: deb + packaging_type: deb + version: + !include: ../../includes/foreman_versions.yaml.inc + +- project: + name: foreman-packaging-rpm-koji-release + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: rpm + packaging_type: rpm + version: + !include: ../../includes/foreman_versions_koji.yaml.inc + +- project: + name: foreman-packaging-rpm-copr-release + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: rpm + packaging_type: rpm_copr + version: + !include: ../../includes/foreman_versions_copr.yaml.inc + +- project: + name: foreman-packaging-deb-nightly + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: deb + packaging_type: deb + version: + - 'nightly' + +- project: + name: foreman-packaging-rpm-nightly + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: rpm + packaging_type: rpm + version: + - 'nightly' + +- project: + name: foreman-packaging-nightly-copr + jobs: + - 'foreman-packaging-{packaging_label}-{version}-release' + empty: '' + packaging_label: rpm-copr + packaging_type: rpm_copr + version: + - 'nightly' diff --git a/theforeman.org/yaml/jobs/release/foreman-packaging-rpm-release.yaml b/theforeman.org/yaml/jobs/release/foreman-packaging-rpm-release.yaml deleted file mode 100644 index 42cc9d56..00000000 --- a/theforeman.org/yaml/jobs/release/foreman-packaging-rpm-release.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- job-template: - name: 'foreman-packaging-rpm-{version}-release' - project-type: pipeline - sandbox: true - concurrent: false - properties: - - github: - url: https://github.com/theforeman/foreman-packaging - triggers: - - github - dsl: - !include-raw: - - 'pipelines/vars/foreman/{version}.groovy' - - 'pipelines/release/foreman_packaging_rpm_release.groovy{empty}' - - 'pipelines/lib/git.groovy{empty}' - - 'pipelines/lib/ansible.groovy{empty}' - - 'pipelines/lib/obal.groovy{empty}' - - 'pipelines/lib/packaging.groovy{empty}' - - 'pipelines/lib/foreman_infra.groovy{empty}' - -- project: - name: foreman-packaging-rpm - jobs: - - 'foreman-packaging-rpm-{version}-release' - empty: '' - version: - !include: ../../includes/foreman_versions.yaml.inc - -- project: - name: foreman-packaging-rpm-nightly - jobs: - - 'foreman-packaging-rpm-{version}-release' - empty: '' - version: - - 'nightly' - -- job-template: - name: 'foreman-packaging-rpm-copr-{version}-release' - project-type: pipeline - sandbox: true - concurrent: false - properties: - - github: - url: https://github.com/theforeman/foreman-packaging - triggers: - - github - dsl: - !include-raw: - - 'pipelines/vars/foreman/{version}.groovy' - - 'pipelines/release/foreman_packaging_rpm_copr_release.groovy{empty}' - - 'pipelines/lib/git.groovy{empty}' - - 'pipelines/lib/ansible.groovy{empty}' - - 'pipelines/lib/obal.groovy{empty}' - - 'pipelines/lib/packaging.groovy{empty}' - - 'pipelines/lib/foreman_infra.groovy{empty}' - -- project: - name: foreman-packaging-rpm-copr-nightly - jobs: - - 'foreman-packaging-rpm-copr-{version}-release' - empty: '' - version: - - 'nightly'