Skip to content

Commit 0943ec9

Browse files
committed
Add pkgServer promotion mechanism
1 parent 1691b55 commit 0943ec9

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

Jenkinsfile.d/core/package

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ pipeline {
317317
}
318318
}
319319
}
320+
320321
stage('Promote'){
321322
failFast true
322323
parallel {
@@ -349,6 +350,18 @@ pipeline {
349350
}
350351
}
351352
}
353+
stage('Pkg Server Data') {
354+
steps {
355+
container('packaging'){
356+
sshagent(['pkgserver']) {
357+
sh '''
358+
./utils/release.sh --promoteMirrorData debian opensuse redhat war windows
359+
./utils/release.sh --promotePkgServerData debian opensuse redhat war windows
360+
'''
361+
}
362+
}
363+
}
364+
}
352365
}
353366
}
354367
// Force mirror synchronization

README.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ The security release follows the same process as the stable one except that arti
345345
.. `JENKINS_VERSION` set to the final release version that will be packaged. If set to 'stable' or 'weekly' then the packaging job will try to guess the version based on what was pushed to the maven repository. cfr settings.
346346
.. `PACKAGING_GIT_BRANCH` set to the appropriated jenkinsci/packaging branch
347347
.. `MAVEN_REPOSITORY_NAME` set to the maven repository name where we are going to publish staging maven artifacts. This is also the source location used by the packaging job to build distribution packages
348+
<<<<<<< HEAD
348349
. Trigger the generic Release link:https://release.ci.jenkins.io/job/core/job/release/[job] from the appropriated branch like `security-stable-2.235`
349350
.. Force repository scan
350351
.. Trigger the first build to have access to job parameter and immediately abort it
@@ -362,6 +363,10 @@ The security release follows the same process as the stable one except that arti
362363
... `MAVEN_STAGING_REPOSITORY_PROMOTION_ENABLED` set to true
363364
... `GIT_STAGING_REPOSITORY_PROMOTION_ENABLED` set to false as we prefer to do it manually once everything is done
364365
... `VALIDATION_ENABLED` set to true
366+
=======
367+
.. `RELEASELINE` set the releaseline '-stable' for stable releases and nothing for weekly
368+
. Trigger the security link:https://release.ci.jenkins.io/blue/organizations/jenkins/core%2Fsecurity%2Frelease/branches/[job]
369+
>>>>>>> Add pkgServer promotion mechanism
365370
366371
[NOTE]
367372
====

utils/release.sh

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ source ""$(dirname "$(dirname "$0")")"/profile.d/$RELEASE_PROFILE"
4444
: "${RELEASE_GIT_PRODUCTION_REPOSITORY:=$RELEASE_GIT_REPOSITORY }"
4545
: "${RELEASE_GIT_PRODUCTION_BRANCH:=$RELEASE_GIT_BRANCH}"
4646

47+
48+
PKGSERVER_SSH_OPTS=($PKGSERVER_SSH_OPTS)
49+
4750
export JENKINS_VERSION
4851
export JENKINS_DOWNLOAD_URL
4952
export MAVEN_REPOSITORY_USERNAME
@@ -384,6 +387,50 @@ function promoteStagingGitRepository(){
384387
385388
}
386389
390+
function promotePkgServerData(){
391+
392+
for DISTRIBUTION in "$@"; do
393+
394+
STAGING_DIRECTORY="/var/www/pkg.jenkins.io.staging/$DISTRIBUTION$RELEASELINE/"
395+
PRODUCTION_DIRECTORY="/var/www/pkg.jenkins.io.staging/$DISTRIBUTION$RELEASELINE/"
396+
397+
echo "Promoting pkg server data from Staging to Production for $DISTRIBUTION"
398+
rsync \
399+
--archive \
400+
--compress \
401+
--verbose \
402+
--ignore-existing \
403+
--progress \
404+
-e "ssh ${PKGSERVER_SSH_OPTS[*]}" \
405+
--omit-dir-times \
406+
--exclude=.htaccess \
407+
--exclude=\*.key \
408+
--exclude=jenkins.repo \
409+
"$PKGSERVER:$STAGING_DIRECTORY" "$PKGSERVER:$PRODUCTION_DIRECTORY"
410+
done;
411+
}
412+
413+
function promoteDistributionPackages(){
414+
415+
416+
for PACKAGE in "$@"; do
417+
418+
STAGING_DIRECTORY="/srv/releases/jenkins.staging/$DISTRIBUTION$RELEASELINE/"
419+
PRODUCTION_DIRECTORY="/srv/releases/jenkins/$DISTRIBUTION$RELEASELINE/"
420+
421+
echo "Promoting pkg server data from Staging to Production for $DISTRIBUTION"
422+
rsync \
423+
--archive \
424+
--compress \
425+
--verbose \
426+
--ignore-existing \
427+
--progress \
428+
-e "ssh ${PKGSERVER_SSH_OPTS[*]}" \
429+
--omit-dir-times \
430+
"$PKGSERVER:$STAGING_DIRECTORY" "$PKGSERVER:$PRODUCTION_DIRECTORY"
431+
done;
432+
}
433+
387434
function pushCommits(){
388435
: "${RELEASE_SCM_TAG:?RELEASE_SCM_TAG not definded}"
389436
@@ -511,7 +558,6 @@ EOF
511558
512559
function syncMirror(){
513560
514-
PKGSERVER_SSH_OPTS=($PKGSERVER_SSH_OPTS)
515561
ssh "${PKGSERVER_SSH_OPTS[@]}" "$PKGSERVER" /srv/releases/sync.sh
516562
}
517563
@@ -549,6 +595,8 @@ function main(){
549595
--showPackagingPlan) echo "Show Packaging Plan" && showPackagingPlan ;;
550596
--promoteStagingMavenArtifacts) echo "Promote Staging Maven Artifacts" && promoteStagingMavenArtifacts ;;
551597
--promoteStagingGitRepository) echo "Promote Staging Git Repository" && promoteStagingGitRepository ;;
598+
--promoteStagingPkgServer) echo "Promote Staging pkg server metadata" && promoteStagingPkgServer "$@";;
599+
--promoteDistributionPackages) echo "Promote Distribution Packages" && promoteDistributionPackages "$@";;
552600
--rollback) echo "Rollback release $RELEASE_SCM_TAG" && rollblack ;;
553601
--stageRelease) echo "Stage Release" && stageRelease ;;
554602
--packaging) echo 'Execute packaging makefile, quote required around Makefile target' && packaging "$2";;

0 commit comments

Comments
 (0)