Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align RPM pipelines' groovy code #458

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions theforeman.org/pipelines/lib/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -481,17 +481,12 @@ def rsync_debian(user, ssh_key, suite, component, deb_paths) {
}
}

def rsync_to_yum_stage(collection, version) {
def ssh_key = '/home/jenkins/workspace/staging_key/rsync_yumrepostage_key'
def rsync_to_yum_stage() {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false

if (!fileExists('upload_stage_rpms')) {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
}
sh "./generate_stage_repository"

sh """
export RSYNC_RSH="ssh -i ${ssh_key}"
export VERSION=${version}
export PROJECT=${collection}
./upload_stage_rpms
"""
sshagent(['yum-stage']) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sh "./upload_stage_rpms"
}
}
36 changes: 15 additions & 21 deletions theforeman.org/pipelines/release/pipelines/candlepin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,29 @@ pipeline {
ansiColor('xterm')
}

stages {
stage('staging-build-repository') {
when {
expression { candlepin_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
environment {
PROJECT = 'candlepin'
}

script {
candlepin_distros.each { distro ->
sh "./build_stage_repository candlepin ${candlepin_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
script {
env.VERSION = candlepin_version
}
Comment on lines +15 to +17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find a good way to set the environment variable as a script. Perhaps this needs to be

Suggested change
script {
env.VERSION = candlepin_version
}
env.VERSION = candlepin_version


stages {
stage('staging-repository') {
when {
expression { candlepin_version == 'nightly' }
expression { env.VERSION == 'nightly' }
}
steps {
script {
rsync_to_yum_stage('candlepin', candlepin_version)
rsync_to_yum_stage
}
}
}
stage('staging-repoclosure') {
steps {
script {
parallel repoclosures('candlepin', candlepin_distros, candlepin_version)
parallel repoclosures(env.PROJECT, candlepin_distros, env.VERSION)
}
}
post {
Expand All @@ -50,7 +44,7 @@ pipeline {

steps {
script {
runDuffyPipeline('candlepin-rpm', candlepin_version)
runDuffyPipeline("${env.PROJECT}-rpm", env.VERSION)
}
}
}
Expand All @@ -60,15 +54,15 @@ pipeline {
steps {
script {
candlepin_distros.each { distro ->
push_foreman_staging_rpms('candlepin', candlepin_version, distro)
push_foreman_staging_rpms(env.PROJECT, env.VERSION, distro)
}
}
}
}
}
post {
failure {
notifyDiscourse(env, "Candlepin ${candlepin_version} RPM pipeline failed:", currentBuild.description)
notifyDiscourse(env, "${env.PROJECT} ${env.VERSION} RPM pipeline failed:", currentBuild.description)
}
}
}
32 changes: 13 additions & 19 deletions theforeman.org/pipelines/release/pipelines/client.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,29 @@ pipeline {
ansiColor('xterm')
}

stages {
stage('staging-build-repository') {
when {
expression { foreman_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
environment {
PROJECT = 'client'
}

script {
foreman_client_distros.each { distro ->
sh "./build_stage_repository client ${foreman_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
script {
env.VERSION = foreman_version
}

stages {
stage('staging-repository') {
when {
expression { foreman_version == 'nightly' }
expression { env.VERSION == 'nightly' }
}
steps {
script {
rsync_to_yum_stage('client', foreman_version)
rsync_to_yum_stage
}
}
}
stage('staging-repoclosure') {
steps {
script {
parallel repoclosures('foreman-client-staging', foreman_client_distros, foreman_version)
parallel repoclosures("foreman-${env.PROJECT}-staging", foreman_client_distros, env.VERSION)
}
}
post {
Expand All @@ -51,7 +45,7 @@ pipeline {
steps {
script {
foreman_client_distros.each { distro ->
push_foreman_staging_rpms('client', foreman_version, distro)
push_foreman_staging_rpms(env.PROJECT, env.VERSION, distro)
}
}
}
Expand Down
36 changes: 15 additions & 21 deletions theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,29 @@ pipeline {
ansiColor('xterm')
}

stages {
stage('staging-build-repository') {
when {
expression { foreman_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
environment {
PROJECT = 'foreman'
}

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository foreman ${foreman_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
script {
env.VERSION = foreman_version
}

stages {
stage('staging-repository') {
when {
expression { foreman_version == 'nightly' }
expression { env.VERSION == 'nightly' }
}
steps {
script {
rsync_to_yum_stage('foreman', foreman_version)
rsync_to_yum_stage
}
}
}
stage('staging-repoclosure') {
steps {
script {
parallel repoclosures('foreman-staging', foreman_el_releases, foreman_version)
parallel repoclosures("${env.PROJECT}-staging", foreman_el_releases, env.VERSION)
}
}
post {
Expand All @@ -50,7 +44,7 @@ pipeline {

steps {
script {
runDuffyPipeline('foreman-rpm', foreman_version)
runDuffyPipeline("${env.PROJECT}-rpm", env.VERSION)
}
}
}
Expand All @@ -60,15 +54,15 @@ pipeline {
steps {
script {
foreman_el_releases.each { distro ->
push_foreman_staging_rpms('foreman', foreman_version, distro)
push_foreman_staging_rpms(env.PROJECT, env.VERSION, distro)
}
}
}
}
}
post {
failure {
notifyDiscourse(env, 'Foreman RPM nightly pipeline failed:', currentBuild.description)
notifyDiscourse(env, "${env.PROJECT} ${env.VERSION} RPM pipeline failed:", currentBuild.description)
}
}
}
34 changes: 14 additions & 20 deletions theforeman.org/pipelines/release/pipelines/katello.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,22 @@ pipeline {
ansiColor('xterm')
}

stages {
stage('staging-build-repository') {
when {
expression { katello_version == 'nightly' }
}
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
environment {
PROJECT = 'katello'
}

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository katello ${katello_version} ${distro} ${foreman_version}"
}
}
}
}
stage('staging-copy-repository') {
script {
env.VERSION = katello_version
}

stages {
stage('staging-repository') {
when {
expression { katello_version == 'nightly' }
expression { env.VERSION == 'nightly' }
}
steps {
script {
rsync_to_yum_stage('katello', katello_version)
rsync_to_yum_stage
}
}
}
Expand All @@ -50,7 +44,7 @@ pipeline {

steps {
script {
runDuffyPipeline('katello-rpm', katello_version)
runDuffyPipeline("${env.PROJECT}-rpm", env.VERSION)
}
}
}
Expand All @@ -60,15 +54,15 @@ pipeline {
steps {
script {
foreman_el_releases.each { distro ->
push_foreman_staging_rpms('katello', katello_version, distro)
push_foreman_staging_rpms(env.PROJECT, env.VERSION, distro)
}
}
}
}
}
post {
failure {
notifyDiscourse(env, "Katello ${katello_version} pipeline failed:", currentBuild.description)
notifyDiscourse(env, "${env.PROJECT} ${env.VERSION} RPM pipeline failed:", currentBuild.description)
}
}
}
29 changes: 13 additions & 16 deletions theforeman.org/pipelines/release/pipelines/plugins.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,26 @@ pipeline {
ansiColor('xterm')
}

stages {
stage('staging-build-repository') {
steps {
git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false
environment {
PROJECT = 'plugins'
}

script {
foreman_el_releases.each { distro ->
sh "./build_stage_repository plugins ${foreman_version} ${distro}"
}
}
}
}
stage('staging-copy-repository') {
script {
env.VERSION = foreman_version
}

stages {
stage('staging-repository') {
steps {
script {
rsync_to_yum_stage('plugins', foreman_version)
rsync_to_yum_stage
}
}
}
stage('staging-repoclosure') {
steps {
script {
parallel repoclosures('plugins-staging', foreman_el_releases, foreman_version)
parallel repoclosures("${env.PROJECT}-staging", foreman_el_releases, env.VERSION)
}
}
post {
Expand All @@ -45,15 +42,15 @@ pipeline {
steps {
script {
foreman_el_releases.each { distro ->
push_foreman_staging_rpms('plugins', foreman_version, distro)
push_foreman_staging_rpms(env.PROJECT, env.VERSION, distro)
}
}
}
}
}
post {
failure {
notifyDiscourse(env, "Plugins ${foreman_version} pipeline failed:", currentBuild.description)
notifyDiscourse(env, "${env.PROJECT} ${env.VERSION} RPM pipeline failed:", currentBuild.description)
}
}
}
Loading
Loading