diff --git a/theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy b/theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy index bf87a412..dbf39d22 100644 --- a/theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy +++ b/theforeman.org/pipelines/release/pipelines/foreman-rpm.groovy @@ -9,51 +9,129 @@ pipeline { } stages { - stage('Mash Koji Repositories') { - agent { label 'sshkey' } - - steps { - mash('foreman', 'nightly') + stage('koji') { + when { + expression { stage_source == 'koji' } } - } - stage('Repoclosure') { - agent { label 'el' } + stages { + stage('koji-mash-repositories') { + agent { label 'sshkey' } + + steps { + mash('foreman', 'nightly') + } + } + stage('koji-repoclosure') { + agent { label 'el' } + + steps { + script { + parallel repoclosures('foreman', foreman_el_releases, foreman_version) + } + } + post { + always { + deleteDir() + } + } + } + stage('koji-install-test') { + agent any - steps { - script { - parallel repoclosures('foreman', foreman_el_releases, foreman_version) + steps { + script { + runDuffyPipeline('foreman-rpm', foreman_version) + } + } + } + stage('koji-push-rpms') { + agent { label 'admin && sshkey' } + steps { + script { + for (release in foreman_el_releases) { + push_rpms_direct("foreman-${foreman_version}/${release}", "${foreman_version}/${release}") + } + } + } } } post { - always { - deleteDir() + failure { + notifyDiscourse(env, 'Foreman RPM nightly pipeline failed:', currentBuild.description) } } } - stage('Install Test') { - agent any + stage('staging') { + agent { label 'el8' } + when { + expression { stage_source == 'stagingyum' } + } + stages { + stage('staging-build-repository') { + steps { + git url: "https://github.com/theforeman/theforeman-rel-eng", poll: false - steps { - script { - runDuffyPipeline('foreman-rpm', foreman_version) + script { + foreman_el_releases.each { distro -> + sh "./build_stage_repository foreman ${foreman_version} ${distro}" + } + } + } } - } - } - stage('Push RPMs') { - agent { label 'admin && sshkey' } - steps { - script { - for (release in foreman_el_releases) { - push_rpms_direct("foreman-${foreman_version}/${release}", "${foreman_version}/${release}") + stage('staging-copy-repository') { + steps { + script { + dir('tmp') { + rsync_to_yum_stage('foreman', 'foreman', foreman_version) + } + } + } + } + stage('staging-repoclosure') { + steps { + script { + def parallelStagesMap = [:] + def name = 'foreman-staging' + foreman_el_releases.each { distro -> + parallelStagesMap[distro] = { repoclosure(name, distro, foreman_version) } + } + parallel parallelStagesMap + } + } + post { + always { + deleteDir() + } + } + } + stage('staging-install-test') { + agent any + + steps { + script { + //runDuffyPipeline('foreman-rpm', foreman_version) + echo "RUN TEST PIPELINE" + } + } + } + stage('staging-push-rpms') { + agent { label 'admin && sshkey' } + + steps { + script { + foreman_el_releases.each { distro -> + //push_foreman_staging_rpms('client', foreman_version, distro) + echo "PUSH TO PROD" + } + } } } } - } - } - post { - failure { - notifyDiscourse(env, 'Foreman RPM nightly pipeline failed:', currentBuild.description) + post { + failure { + echo "staging yum failed" + } + } } } } - diff --git a/theforeman.org/pipelines/release/pipelines/katello-copr.groovy b/theforeman.org/pipelines/release/pipelines/katello-copr.groovy new file mode 100644 index 00000000..f3596dc5 --- /dev/null +++ b/theforeman.org/pipelines/release/pipelines/katello-copr.groovy @@ -0,0 +1,71 @@ +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 { + echo 'Run TEST' + //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) + } + } +} + diff --git a/theforeman.org/pipelines/release/pipelines/katello.groovy b/theforeman.org/pipelines/release/pipelines/katello.groovy index 83dec683..e7fe865f 100644 --- a/theforeman.org/pipelines/release/pipelines/katello.groovy +++ b/theforeman.org/pipelines/release/pipelines/katello.groovy @@ -9,51 +9,130 @@ pipeline { } stages { - stage('Mash Koji Repositories') { - agent { label 'sshkey' } - - steps { - mash("katello", katello_version) + stage('koji') { + when { + expression { stage_source == 'koji' } } - } - stage('Katello Repoclosure') { - agent { label 'el' } + stages { + stage('koji-mash-repositories') { + agent { label 'sshkey' } + + steps { + mash("katello", katello_version) + } + } + stage('koji-repoclosure') { + agent { label 'el' } - steps { - script { - parallel repoclosures('katello', foreman_el_releases, foreman_version) + steps { + script { + parallel repoclosures('katello', foreman_el_releases, foreman_version) + } + } + post { + always { + deleteDir() + } + } + } + stage('koji-install-test') { + agent any + + steps { + script { + runDuffyPipeline('katello-rpm', katello_version) + } + } + } + stage('koji-push-rpms') { + agent { label 'admin && sshkey' } + + steps { + script { + foreman_el_releases.each { distro -> + push_katello_rpms(katello_version, distro) + } + } + } } } post { - always { - deleteDir() + failure { + notifyDiscourse(env, "Katello ${katello_version} pipeline failed:", currentBuild.description) } } } - stage('Test Suites') { - agent any + stage('staging') { + agent { label 'el8' } + when { + expression { stage_source == 'stagingyum' } + } + 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 katello ${foreman_version} ${distro}" + } + } + } + } + stage('staging-copy-repository') { + steps { + script { + dir('tmp') { + rsync_to_yum_stage('katello', 'katello', foreman_version) + } + } + } + } + stage('staging-repoclosure') { + steps { + script { + def parallelStagesMap = [:] + def name = 'katello-staging' + foreman_el_releases.each { distro -> + parallelStagesMap[distro] = { repoclosure(name, distro, foreman_version) } + } + parallel parallelStagesMap + } + } + post { + always { + deleteDir() + } + } + } + stage('staging-install-test') { + agent any - steps { - script { - runDuffyPipeline('katello-rpm', katello_version) + steps { + script { + //runDuffyPipeline('foreman-rpm', foreman_version) + echo "RUN TEST PIPELINE" + } + } } - } - } - stage('Push RPMs') { - agent { label 'admin && sshkey' } + stage('staging-push-rpms') { + agent { label 'admin && sshkey' } - steps { - script { - foreman_el_releases.each { distro -> - push_katello_rpms(katello_version, distro) + steps { + script { + foreman_el_releases.each { distro -> + //push_foreman_staging_rpms('client', foreman_version, distro) + echo "PUSH TO PROD" + } + } } } } - } - } - post { - failure { - notifyDiscourse(env, "Katello ${katello_version} pipeline failed:", currentBuild.description) + post { + failure { + echo "staging yum failed" + } + } } } } diff --git a/theforeman.org/pipelines/vars/foreman/nightly.groovy b/theforeman.org/pipelines/vars/foreman/nightly.groovy index 59c47277..b7e6bbfd 100644 --- a/theforeman.org/pipelines/vars/foreman/nightly.groovy +++ b/theforeman.org/pipelines/vars/foreman/nightly.groovy @@ -1,6 +1,6 @@ def foreman_version = 'nightly' def git_branch = "develop" -def stage_source = 'koji' +def stage_source = 'stagingyum' def foreman_client_distros = [ 'el9', diff --git a/theforeman.org/yaml/jobs/pipeline/katello-nightly-rpm-pipeline.yaml b/theforeman.org/yaml/jobs/pipeline/katello-nightly-rpm-pipeline.yaml index 40374d4a..2c099178 100644 --- a/theforeman.org/yaml/jobs/pipeline/katello-nightly-rpm-pipeline.yaml +++ b/theforeman.org/yaml/jobs/pipeline/katello-nightly-rpm-pipeline.yaml @@ -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