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

Skip all stages on first build (before we know parameters) #100

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

stages {
stage('Plan') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('packaging') {
sh 'utils/release.sh --showPackagingPlan'
Expand All @@ -107,6 +114,9 @@ pipeline {
stage('Validate') {
when {
environment name: 'VALIDATION_ENABLED', value: 'true'
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeInput true
}

Expand All @@ -122,6 +132,12 @@ pipeline {

}
stage('Get GPG key') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('azure-cli') {
Expand All @@ -146,6 +162,12 @@ pipeline {
}

stage('Get Code Signing Certificate') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('azure-cli') {
Expand All @@ -160,6 +182,13 @@ pipeline {
}

stage('Download WAR archive to package'){
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps{
container('packaging'){
sh '''
Expand All @@ -173,6 +202,13 @@ pipeline {
}
}
stage('Package'){
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

failFast false
parallel {
stage('WAR') {
Expand Down Expand Up @@ -326,6 +362,12 @@ pipeline {
}
}
stage('Promote'){
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}
failFast true
parallel {
stage('Maven Repository') {
Expand Down Expand Up @@ -361,6 +403,12 @@ pipeline {
}
// Force mirror synchronization
stage('Synchronize mirror'){
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}
steps{
container('packaging'){
sshagent(['pkgserver']) {
Expand All @@ -372,6 +420,12 @@ pipeline {
}
}
stage('Invalidate Fastly Cache'){
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}
environment {
FASTLY_API_TOKEN = credentials('fastly-api-token')
FASTLY_SERVICE_ID = credentials('fastly_pkgserver_service_id')
Expand Down
70 changes: 70 additions & 0 deletions Jenkinsfile.d/core/release
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ pipeline {

stages {
stage('Clone Release Git Repository') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('jnlp') {
sshagent(['release-key']) {
Expand All @@ -72,20 +79,41 @@ pipeline {
}
}
stage('Clean Release') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('maven') {
sh 'utils/release.sh --cleanRelease'
}
}
}
stage('Plan') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('maven') {
sh 'utils/release.sh --showReleasePlan'
}
}
}
stage('Validate') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

when {
environment name: 'VALIDATION_ENABLED', value: 'true'
beforeInput true
Expand All @@ -102,6 +130,13 @@ pipeline {
}
}
stage('Get Code Signing Certificate') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('azure-cli') {
sh '''
Expand All @@ -112,6 +147,13 @@ pipeline {
}
}
stage('Get GPG key') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('azure-cli') {
sh '''
Expand All @@ -121,6 +163,13 @@ pipeline {
}
}
stage('Prepare Release') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('maven') {
// Maven Release requires gpg key with password password and a certificate key with password
Expand All @@ -138,6 +187,13 @@ pipeline {
}
}
stage('Push Commits') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

// environment {
// GIT_SSH = 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $RELEASE_SSH_KEY'
// }
Expand All @@ -162,6 +218,13 @@ pipeline {
}
}
stage('Stage Release') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('maven') {
sh '''
Expand All @@ -171,6 +234,13 @@ pipeline {
}
}
stage('Verify artifacts') {
when {
not {
environment name: 'BUILD_NUMBER', value: '1'
}
beforeAgent true
}

steps {
container('maven') {
sh '''
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ The security release follows the same process as the stable one except that arti
.. `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
. 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
.. Trigger the first build to scan the script and wait until it finishes; it will skip all actual work.
.. Trigger a job with the correct parameters
... `RELEASE_PROFILE` set to `security`
... `RELEASE_GIT_BRANCH` set to `unused` as we already define it in the release profile file, which overrides the job parameter
Expand Down