diff --git a/docs/images/automated-debian-jobs.uml b/docs/images/automated-debian-jobs.uml --- a/docs/images/automated-debian-jobs.uml +++ b/docs/images/automated-debian-jobs.uml @@ -71,7 +71,9 @@ GBP -> REPO : push packages to unstable-swh create ABP + GBP -> ABP : when automatic backport enabled activate ABP + ABP -> GBP : acknowledge start deactivate GBP hnote over ABP : merge pushed tag diff --git a/jobs/templates/debian/gbp-buildpackage.groovy b/jobs/templates/debian/gbp-buildpackage.groovy --- a/jobs/templates/debian/gbp-buildpackage.groovy +++ b/jobs/templates/debian/gbp-buildpackage.groovy @@ -240,6 +240,33 @@ }} }} }} + stage('Prepare backport') {{ + when {{ + beforeAgent true + expression {{ changelog_distribution != 'UNRELEASED' }} + expression {{ params.BACKPORT_ON_SUCCESS }} + expression {{ jobExists('/debian/packages/{name}/automatic-backport') }} + }} + steps {{ + script {{ + params.BACKPORT_ON_SUCCESS.split(',').each {{ bpo_pair -> + def (src_suite, dst_suite) = bpo_pair.split('>') + + if (src_suite == changelog_distribution) {{ + build( + job: '/debian/packages/{name}/automatic-backport', + parameters: [ + string(name: 'GIT_TAG', value: params.GIT_REVISION), + string(name: 'SOURCE', value: src_suite), + string(name: 'DESTINATION', value: dst_suite), + ], + wait: false, + ) + }} + }} + }} + }} + }} }} post {{ always {{ diff --git a/jobs/templates/debian/gbp-buildpackage.yaml b/jobs/templates/debian/gbp-buildpackage.yaml --- a/jobs/templates/debian/gbp-buildpackage.yaml +++ b/jobs/templates/debian/gbp-buildpackage.yaml @@ -3,7 +3,8 @@ description: | Build Debian package auth-token: 'ph4br1cat0r' - deb-extra-repositories: + deb-extra-repositories: + deb-backport-on-success: unstable-swh>stretch-swh project-type: pipeline parameters: - string: @@ -44,6 +45,17 @@ name: DO_UPLOAD description: upload the built package default: false + - extended-choice: + name: BACKPORT_ON_SUCCESS + description: If the build is successful, which backports should we perform? + type: checkbox + value: !join: + - ',' + - + - unstable-swh>stretch-swh + - unstable-swh>buster-swh + - buster-swh>stretch-swh + default-value: '{deb-backport-on-success}' dsl: !include-raw: gbp-buildpackage.groovy