Skip to content

Commit

Permalink
Add Copr nightly test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Aug 29, 2023
1 parent 36c372c commit 7504f47
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 0 deletions.
20 changes: 20 additions & 0 deletions theforeman.org/pipelines/lib/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,23 @@ def rsync_debian(user, ssh_key, suite, component, deb_paths) {
"""
}
}

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

rsync_yum(user, ssh_key, collection, version)
}

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

for(host in hosts) {
def target_path = "${user}@${host}:rsync_cache/${collection}"

sh """
export RSYNC_RSH="ssh -i ${ssh_key}"
/usr/bin/rsync --archive --verbose --partial --one-file-system --delete-after ${collection}/${version} ${target_path}
"""
}
}
68 changes: 68 additions & 0 deletions theforeman.org/pipelines/release/pipelines/foreman-rpm-copr.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
pipeline {
agent { label 'el' }

options {
timestamps()
timeout(time: 4, unit: 'HOURS')
disableConcurrentBuilds()
ansiColor('xterm')
}

stages {
stage('Build stage repository') {
steps {
checkout([
$class : 'GitSCM',
branches : [[name: "*/copr-build-stage-repo"]],
extensions: [[$class: 'CleanCheckout'], [$class: 'CloneOption', depth: 1, noTags: false, reference: '', shallow: true]],
userRemoteConfigs: [
[url: 'https://github.com/ehelms/foreman-packaging']
]
])

script {
sh "./build_stage_repository.py foreman ${foreman_version} el8"
}
}
}
stage('Copy stage repository') {
steps {
script {
dir('tmp') {
rsync_to_yum_stage('foreman', foreman_version)
}
}
}
}
stage('Repoclosure') {
steps {
echo 'Perform repoclosure HERE'
}
}
stage('Install Test') {
agent any

steps {
script {
runDuffyPipeline('foreman-rpm', foreman_version)
}
}
}
stage('Push RPMs') {
agent { label 'admin && sshkey' }

steps {
echo 'Copy RPMs from stagingyum to yum HERE'
}
}
}
post {
always {
deleteDir()
}
failure {
notifyDiscourse(env, "Foreman Copr RPM ${foreman_version} pipeline failed:", currentBuild.description)
}
}
}

70 changes: 70 additions & 0 deletions theforeman.org/pipelines/release/pipelines/katello-copr.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
pipeline {
agent { label 'el' }

options {
timestamps()
timeout(time: 4, unit: 'HOURS')
disableConcurrentBuilds()
ansiColor('xterm')
}

stages {
stage('Build stage repository') {
steps {
checkout([
$class : 'GitSCM',
branches : [[name: "*/copr-build-stage-repo"]],
extensions: [[$class: 'CleanCheckout'], [$class: 'CloneOption', depth: 1, noTags: false, reference: '', shallow: true]],
userRemoteConfigs: [
[url: 'https://github.com/ehelms/foreman-packaging']
]
])

script {
sh "./build_stage_repository.py katello ${katello_version} el8"
sh "./build_stage_repository.py candlepin ${katello_version} el8"
}
}
}
stage('Copy stage repository') {
steps {
script {
dir('tmp') {
rsync_to_yum_stage('katello', katello_version)
rsync_to_yum_stage('candlepin', katello_version)
}
}
}
}
stage('Repoclosure') {
steps {
echo 'Perform repoclosure HERE'
}
}
stage('Install Test') {
agent any

steps {
script {
runDuffyPipeline('katello-rpm-copr', katello_version)
}
}
}
stage('Push RPMs') {
agent { label 'admin && sshkey' }

steps {
echo 'Copy RPMs from stagingyum to yum HERE'
}
}
}
post {
always {
deleteDir()
}
failure {
notifyDiscourse(env, "Foreman Copr RPM ${katello_version} pipeline failed:", currentBuild.description)
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,18 @@
- pipelines/lib/foreman_infra.groovy
- pipelines/lib/packaging.groovy
- pipelines/lib/obal.groovy

- job:
name: foreman-nightly-rpm-copr-pipeline
project-type: pipeline
sandbox: true
dsl:
!include-raw:
- pipelines/vars/foreman/nightly.groovy
- pipelines/release/pipelines/foreman-rpm-copr.groovy
- pipelines/lib/release.groovy
- pipelines/lib/rvm.groovy
- pipelines/lib/ansible.groovy
- pipelines/lib/foreman_infra.groovy
- pipelines/lib/packaging.groovy
- pipelines/lib/obal.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,22 @@
- pipelines/lib/foreman_infra.groovy
- pipelines/lib/packaging.groovy
- pipelines/lib/obal.groovy

- job:
name: katello-nightly-rpm-copr-pipeline
project-type: pipeline
sandbox: true
triggers:
- reverse:
jobs:
- foreman-nightly-rpm-copr-pipeline
result: success
dsl:
!include-raw:
- pipelines/vars/katello/nightly.groovy
- pipelines/release/pipelines/katello-copr.groovy
- pipelines/lib/release.groovy
- pipelines/lib/ansible.groovy
- pipelines/lib/foreman_infra.groovy
- pipelines/lib/packaging.groovy
- pipelines/lib/obal.groovy

0 comments on commit 7504f47

Please sign in to comment.