From 588af6bf9b51a0099193b8d5671533c07adcd376 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Thu, 5 Oct 2023 21:09:50 -0400 Subject: [PATCH] Add Candlepin pipeline --- theforeman.org/pipelines/lib/packaging.groovy | 10 ++- theforeman.org/pipelines/lib/release.groovy | 2 - .../release/pipelines/candlepin.groovy | 67 +++++++++++++++++++ .../pipelines/vars/candlepin/4.3.groovy | 8 +++ .../pipelines/vars/candlepin/nightly.groovy | 8 +++ .../yaml/includes/candlepin_versions.yaml.inc | 2 + .../pipeline/candlepin-release-pipelines.yaml | 24 +++++++ 7 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 theforeman.org/pipelines/release/pipelines/candlepin.groovy create mode 100644 theforeman.org/pipelines/vars/candlepin/4.3.groovy create mode 100644 theforeman.org/pipelines/vars/candlepin/nightly.groovy create mode 100644 theforeman.org/yaml/includes/candlepin_versions.yaml.inc create mode 100644 theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml diff --git a/theforeman.org/pipelines/lib/packaging.groovy b/theforeman.org/pipelines/lib/packaging.groovy index 62d985b6..0ba59ee2 100644 --- a/theforeman.org/pipelines/lib/packaging.groovy +++ b/theforeman.org/pipelines/lib/packaging.groovy @@ -96,7 +96,15 @@ def query_rpmspec(specfile, queryformat) { def repoclosure(repo, dist, version) { version = version == 'nightly' ? 'develop' : version - git_repo = repo.contains('pulpcore') ? 'pulpcore-packaging' : 'foreman-packaging' + + if (repo.contains('pulpcore')) { + git_repo = 'pulpcore-packaging' + } else if (repo.contains('candlepin')) { + git_repo = 'candlepin-packaging' + } else { + git_repo = 'foreman-packaging' + } + ws(dist) { dir('packaging') { git url: "https://github.com/theforeman/${git_repo}", branch: "rpm/${version}", poll: false diff --git a/theforeman.org/pipelines/lib/release.groovy b/theforeman.org/pipelines/lib/release.groovy index 24e0834a..6bbbf31a 100644 --- a/theforeman.org/pipelines/lib/release.groovy +++ b/theforeman.org/pipelines/lib/release.groovy @@ -46,8 +46,6 @@ void push_staging_rpms(repo_src, repo_dest, version, distro, keep_old_files = fa destination = "releases/${version}/${distro}" } else if (repo_dest == 'katello') { destination = "katello/${version}/katello/${distro}" - } else if (repo_dest == 'candlepin') { - destination = "katello/${version}/candlepin/${distro}" } else { destination = "${repo_dest}/${version}/${distro}" } diff --git a/theforeman.org/pipelines/release/pipelines/candlepin.groovy b/theforeman.org/pipelines/release/pipelines/candlepin.groovy new file mode 100644 index 00000000..7e404d74 --- /dev/null +++ b/theforeman.org/pipelines/release/pipelines/candlepin.groovy @@ -0,0 +1,67 @@ +pipeline { + agent { label 'el8' } + + options { + timestamps() + timeout(time: 2, unit: 'HOURS') + disableConcurrentBuilds() + ansiColor('xterm') + } + + stages { + stage('staging-build-repository') { + when { + expression { candlepin_version == 'nightly' } + } + steps { + git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false + + script { + candlepin_distros.each { distro -> + sh "./build_stage_repository candlepin ${candlepin_version} ${distro}" + } + } + } + } + stage('staging-copy-repository') { + when { + expression { candlepin_version == 'nightly' } + } + steps { + script { + dir('tmp') { + rsync_to_yum_stage('candlepin', 'candlepin', candlepin_version) + } + } + } + } + stage('staging-repoclosure') { + steps { + script { + parallel repoclosures('candlepin', candlepin_distros, candlepin_version) + } + } + post { + always { + deleteDir() + } + } + } + stage('staging-push-rpms') { + agent { label 'admin && sshkey' } + + steps { + script { + candlepin_distros.each { distro -> + push_foreman_staging_rpms('candlepin', candlepin_version, distro) + } + } + } + } + } + post { + failure { + notifyDiscourse(env, "Candlepin ${candlepin_version} RPM pipeline failed:", currentBuild.description) + } + } +} diff --git a/theforeman.org/pipelines/vars/candlepin/4.3.groovy b/theforeman.org/pipelines/vars/candlepin/4.3.groovy new file mode 100644 index 00000000..62559de5 --- /dev/null +++ b/theforeman.org/pipelines/vars/candlepin/4.3.groovy @@ -0,0 +1,8 @@ +def candlepin_version = '4.3' +def candlepin_distros = ['el8'] +def packaging_branch = 'rpm/4.3' +def pipelines = [ + 'candlepin': [ + 'centos8-stream' + ] +] diff --git a/theforeman.org/pipelines/vars/candlepin/nightly.groovy b/theforeman.org/pipelines/vars/candlepin/nightly.groovy new file mode 100644 index 00000000..a7208746 --- /dev/null +++ b/theforeman.org/pipelines/vars/candlepin/nightly.groovy @@ -0,0 +1,8 @@ +def candlepin_version = 'nightly' +def candlepin_distros = ['el8'] +def packaging_branch = 'rpm/develop' +def pipelines = [ + 'candlepin': [ + 'centos8-stream' + ] +] diff --git a/theforeman.org/yaml/includes/candlepin_versions.yaml.inc b/theforeman.org/yaml/includes/candlepin_versions.yaml.inc new file mode 100644 index 00000000..54c3a01f --- /dev/null +++ b/theforeman.org/yaml/includes/candlepin_versions.yaml.inc @@ -0,0 +1,2 @@ +- 'nightly' +- '4.3' diff --git a/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml b/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml new file mode 100644 index 00000000..5c247add --- /dev/null +++ b/theforeman.org/yaml/jobs/pipeline/candlepin-release-pipelines.yaml @@ -0,0 +1,24 @@ +- job-template: + name: 'candlepin-{version}-rpm-pipeline' + project-type: pipeline + sandbox: true + triggers: + - timed: 'H 21 * * *' + dsl: + !include-raw: + - 'pipelines/vars/candlepin/{version}.groovy' + - 'pipelines/release/pipelines/candlepin.groovy{empty}' + - 'pipelines/lib/rvm.groovy{empty}' + - 'pipelines/lib/ansible.groovy{empty}' + - 'pipelines/lib/obal.groovy{empty}' + - 'pipelines/lib/packaging.groovy{empty}' + - 'pipelines/lib/release.groovy{empty}' + - 'pipelines/lib/foreman_infra.groovy{empty}' + +- project: + name: candlepin + jobs: + - 'candlepin-{version}-rpm-pipeline' + empty: '' + version: + !include: ../../includes/candlepin_versions.yaml.inc