Skip to content

Commit

Permalink
Add packaging release job for Copr
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Aug 11, 2023
1 parent a80191c commit 36c372c
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
def packages_to_build

pipeline {
agent { label 'rpmbuild' }

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

stages {
stage('Clone Packaging') {
steps {
script {
foreman_branch = foreman_version == 'nightly' ? "rpm/develop" : "rpm/${foreman_version}"
}

checkout([
$class : 'GitSCM',
branches : [[name: "*/${foreman_branch}"]],
extensions: [[$class: 'CleanCheckout']],
userRemoteConfigs: [
[url: 'https://github.com/theforeman/foreman-packaging']
]
])

}
}
stage('Find packages') {
steps {
copyArtifacts(projectName: env.JOB_NAME, optional: true)

script {

if (fileExists('commit')) {

commit = readFile(file: 'commit').trim()
packages_to_build = find_changed_packages("${commit}..HEAD")

} else {

packages_to_build = []

}
}
}
}
stage('Release Build Packages') {
when {
expression { packages_to_build != [] }
}
steps {

setup_obal()

withCredentials([file(credentialsId: 'theforeman-bot-copr', variable: 'copr_config')]) {
obal(
action: "release",
extraVars: [
'build_package_build_system': 'copr',
'build_package_copr_config': copr_config,
],
packages: packages_to_build
)
}

}
}
}

post {
success {
archive_git_hash()
}
failure {
notifyDiscourse(
env,
"${env.JOB_NAME} failed for ${packages_to_build.join(',')}",
"Foreman RPM packaging release job failed: ${env.BUILD_URL}"
)
}
cleanup {
deleteDir()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,31 @@
empty: ''
version:
- 'nightly'

- job-template:
name: 'foreman-packaging-rpm-copr-{version}-release'
project-type: pipeline
sandbox: true
concurrent: false
properties:
- github:
url: https://github.com/theforeman/foreman-packaging
triggers:
- github
dsl:
!include-raw:
- 'pipelines/vars/foreman/{version}.groovy'
- 'pipelines/release/foreman_packaging_rpm_copr_release.groovy{empty}'
- 'pipelines/lib/git.groovy{empty}'
- 'pipelines/lib/ansible.groovy{empty}'
- 'pipelines/lib/obal.groovy{empty}'
- 'pipelines/lib/packaging.groovy{empty}'
- 'pipelines/lib/foreman_infra.groovy{empty}'

- project:
name: foreman-packaging-rpm-copr-nightly
jobs:
- 'foreman-packaging-rpm-copr-{version}-release'
empty: ''
version:
- 'nightly'

0 comments on commit 36c372c

Please sign in to comment.