Skip to content

Commit

Permalink
Rely on theforeman-rel-eng projects to upload staging
Browse files Browse the repository at this point in the history
This introduces simple wrappers around theforeman-rel-eng scripts to do
the heavy lifting. The biggest benefit is that more configuration is
removed from this repository and pushed into theforeman-rel-eng where it
was already anyway.
  • Loading branch information
ekohl committed Mar 25, 2024
1 parent 8d73ce8 commit 49df252
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 119 deletions.
25 changes: 11 additions & 14 deletions theforeman.org/pipelines/lib/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -481,22 +481,19 @@ def rsync_debian(user, ssh_key, suite, component, deb_paths) {
}
}

def rsync_to_yum_stage(collection, target, version) {
def user = 'yumrepostage'
def ssh_key = '/home/jenkins/workspace/staging_key/rsync_yumrepostage_key'

rsync_yum(user, ssh_key, collection, target, version)
// Scripts that wrap https://github.com/theforeman/theforeman-rel-eng
def rel_eng_clone() {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
}

def rsync_yum(user, ssh_key, collection, target, version) {
def hosts = ["web01.osuosl.theforeman.org"]

for(host in hosts) {
def target_path = "${user}@${host}:rsync_cache/${target}/${version}/"
def rel_eng_build_stage() {
script {
sh "./generate_stage_repository"
}
}

sh """
export RSYNC_RSH="ssh -i ${ssh_key}"
/usr/bin/rsync --checksum --times --perms --recursive --links --verbose --partial --one-file-system --delete-after ${collection}/${version}/ ${target_path}
"""
def rel_eng_upload_stage() {
script {
sh "./upload_stage_rpms"
}
}
25 changes: 7 additions & 18 deletions theforeman.org/pipelines/release/pipelines/candlepin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,15 @@ pipeline {
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' }
environment {
PROJECT = 'candlepin'
VERSION = candlepin_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
steps {
script {
dir('tmp') {
rsync_to_yum_stage('candlepin', 'candlepin', candlepin_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down
25 changes: 7 additions & 18 deletions theforeman.org/pipelines/release/pipelines/client.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,15 @@ pipeline {
when {
expression { foreman_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

script {
foreman_client_distros.each { distro ->
sh "./build_stage_repository client ${foreman_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
when {
expression { foreman_version == 'nightly' }
environment {
PROJECT = 'client'
VERSION = foreman_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
steps {
script {
dir('tmp') {
rsync_to_yum_stage('client', 'client', foreman_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down
25 changes: 7 additions & 18 deletions theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,15 @@ pipeline {
when {
expression { foreman_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository foreman ${foreman_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
when {
expression { foreman_version == 'nightly' }
environment {
PROJECT = 'foreman'
VERSION = foreman_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
steps {
script {
dir('tmp') {
rsync_to_yum_stage('foreman', 'foreman', foreman_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down
25 changes: 7 additions & 18 deletions theforeman.org/pipelines/release/pipelines/katello.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,15 @@ pipeline {
when {
expression { katello_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository katello ${katello_version} ${distro} ${foreman_version}"
}
}
}
}
stage('staging-copy-repository') {
when {
expression { katello_version == 'nightly' }
environment {
PROJECT = 'katello'
VERSION = katello_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
steps {
script {
dir('tmp') {
rsync_to_yum_stage('katello', 'katello', katello_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down
22 changes: 7 additions & 15 deletions theforeman.org/pipelines/release/pipelines/plugins.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@ pipeline {
agent { label 'el8' }
stages {
stage('staging-build-repository') {
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository plugins ${foreman_version} ${distro}"
}
}
environment {
PROJECT = 'plugins'
VERSION = foreman_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
}
stage('staging-copy-repository') {
steps {
script {
dir('tmp') {
rsync_to_yum_stage('plugins', 'plugins', foreman_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down
25 changes: 7 additions & 18 deletions theforeman.org/pipelines/release/pipelines/pulpcore.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,15 @@ pipeline {
when {
expression { pulpcore_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

script {
pulpcore_distros.each { distro ->
sh "./build_stage_repository pulpcore ${pulpcore_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
when {
expression { pulpcore_version == 'nightly' }
environment {
PROJECT = 'pulpcore'
VERSION = pulpcore_version
RSYNC_RSH = "ssh -i ${ssh_key}"
}
steps {
script {
dir('tmp') {
rsync_to_yum_stage('pulpcore', 'pulpcore', pulpcore_version)
}
}
rel_eng_clone()
rel_eng_build_stage()
rel_eng_upload_stage()
}
}
stage('staging-repoclosure') {
Expand Down

0 comments on commit 49df252

Please sign in to comment.