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

[WIP][INFRA-1363] Add pkgServer promotion mechanism #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
13 changes: 13 additions & 0 deletions Jenkinsfile.d/core/package
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ pipeline {
}
}
}

stage('Promote'){
failFast true
parallel {
Expand Down Expand Up @@ -349,6 +350,18 @@ pipeline {
}
}
}
stage('Pkg Server Data') {
steps {
container('packaging'){
sshagent(['pkgserver']) {
sh '''
./utils/release.sh --promoteMirrorData debian opensuse redhat war windows
./utils/release.sh --promotePkgServerData debian opensuse redhat war windows
'''
}
}
}
}
}
}
// Force mirror synchronization
Expand Down
5 changes: 5 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ The security release follows the same process as the stable one except that arti
.. `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.
.. `PACKAGING_GIT_BRANCH` set to the appropriated jenkinsci/packaging branch
.. `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
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

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

Improperly resolved merge conflict.

olblak marked this conversation as resolved.
Show resolved Hide resolved
. Trigger the generic Release link:https://release.ci.jenkins.io/job/core/job/release/[job] from the appropriated branch like `security-stable-2.235`
.. Force repository scan
.. Trigger the first build to have access to job parameter and immediately abort it
Expand All @@ -362,6 +363,10 @@ The security release follows the same process as the stable one except that arti
... `MAVEN_STAGING_REPOSITORY_PROMOTION_ENABLED` set to true
... `GIT_STAGING_REPOSITORY_PROMOTION_ENABLED` set to false as we prefer to do it manually once everything is done
... `VALIDATION_ENABLED` set to true
=======
.. `RELEASELINE` set the releaseline '-stable' for stable releases and nothing for weekly
. Trigger the security link:https://release.ci.jenkins.io/blue/organizations/jenkins/core%2Fsecurity%2Frelease/branches/[job]
>>>>>>> Add pkgServer promotion mechanism

[NOTE]
====
Expand Down
50 changes: 49 additions & 1 deletion utils/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ source ""$(dirname "$(dirname "$0")")"/profile.d/$RELEASE_PROFILE"
: "${RELEASE_GIT_PRODUCTION_REPOSITORY:=$RELEASE_GIT_REPOSITORY }"
: "${RELEASE_GIT_PRODUCTION_BRANCH:=$RELEASE_GIT_BRANCH}"


PKGSERVER_SSH_OPTS=($PKGSERVER_SSH_OPTS)

export JENKINS_VERSION
export JENKINS_DOWNLOAD_URL
export MAVEN_REPOSITORY_USERNAME
Expand Down Expand Up @@ -384,6 +387,50 @@ function promoteStagingGitRepository(){

}

function promotePkgServerData(){

for DISTRIBUTION in "$@"; do

STAGING_DIRECTORY="/var/www/pkg.jenkins.io.staging/$DISTRIBUTION$RELEASELINE/"
PRODUCTION_DIRECTORY="/var/www/pkg.jenkins.io/$DISTRIBUTION$RELEASELINE/"

echo "Promoting pkg server data from Staging to Production for $DISTRIBUTION"
rsync \
--archive \
--compress \
--verbose \
--ignore-existing \
--progress \
-e "ssh ${PKGSERVER_SSH_OPTS[*]}" \
--omit-dir-times \
--exclude=.htaccess \
--exclude=\*.key \
--exclude=jenkins.repo \
"$PKGSERVER:$STAGING_DIRECTORY" "$PKGSERVER:$PRODUCTION_DIRECTORY"
done;
}

function promoteDistributionPackages(){


for PACKAGE in "$@"; do

STAGING_DIRECTORY="/srv/releases/jenkins.staging/$DISTRIBUTION$RELEASELINE/"
PRODUCTION_DIRECTORY="/srv/releases/jenkins/$DISTRIBUTION$RELEASELINE/"

echo "Promoting pkg server data from Staging to Production for $DISTRIBUTION"
rsync \
--archive \
--compress \
--verbose \
--ignore-existing \
--progress \
-e "ssh ${PKGSERVER_SSH_OPTS[*]}" \
--omit-dir-times \
"$PKGSERVER:$STAGING_DIRECTORY" "$PKGSERVER:$PRODUCTION_DIRECTORY"
done;
}

function pushCommits(){
: "${RELEASE_SCM_TAG:?RELEASE_SCM_TAG not definded}"

Expand Down Expand Up @@ -511,7 +558,6 @@ EOF

function syncMirror(){

PKGSERVER_SSH_OPTS=($PKGSERVER_SSH_OPTS)
ssh "${PKGSERVER_SSH_OPTS[@]}" "$PKGSERVER" /srv/releases/sync.sh
}

Expand Down Expand Up @@ -549,6 +595,8 @@ function main(){
--showPackagingPlan) echo "Show Packaging Plan" && showPackagingPlan ;;
--promoteStagingMavenArtifacts) echo "Promote Staging Maven Artifacts" && promoteStagingMavenArtifacts ;;
--promoteStagingGitRepository) echo "Promote Staging Git Repository" && promoteStagingGitRepository ;;
--promoteStagingPkgServer) echo "Promote Staging pkg server metadata" && promoteStagingPkgServer "$@";;
--promoteDistributionPackages) echo "Promote Distribution Packages" && promoteDistributionPackages "$@";;
--rollback) echo "Rollback release $RELEASE_SCM_TAG" && rollblack ;;
--stageRelease) echo "Stage Release" && stageRelease ;;
--packaging) echo 'Execute packaging makefile, quote required around Makefile target' && packaging "$2";;
Expand Down