Skip to content

Commit

Permalink
fix: use skipRemainingStages variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood committed Mar 26, 2024
1 parent f930f3e commit 1f630e9
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
def skipRemainingStages = false

pipeline {
agent { label 'lagoon' }
environment {
Expand Down Expand Up @@ -29,8 +31,8 @@ pipeline {
}
steps {
script {
currentBuild.result = 'SUCCESS'
error("Docs only update, no build needed.")
skipRemainingStages = true
echo "Docs only update, no build needed."
}
}
}
Expand All @@ -42,12 +44,20 @@ pipeline {
stage ('clean docker image cache') {
when {
buildingTag()
expression {
!skipRemainingStages
}
}
steps {
sh script: "docker image prune -af", label: "Pruning images"
}
}
stage ('build and push images') {
when {
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
}
Expand All @@ -60,11 +70,21 @@ pipeline {
}
}
stage ('show trivy scan results') {
when {
expression {
!skipRemainingStages
}
}
steps {
sh script: "cat scan.txt", label: "Display scan results"
}
}
stage ('setup test cluster') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('0: setup test cluster') {
steps {
Expand All @@ -86,6 +106,11 @@ pipeline {
}
}
stage ('run first test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('1: run first test suite') {
steps {
Expand Down Expand Up @@ -120,6 +145,11 @@ pipeline {
}
}
stage ('run second test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('2: run second test suite') {
steps {
Expand All @@ -140,6 +170,11 @@ pipeline {
}
}
stage ('run third test suite') {
when {
expression {
!skipRemainingStages
}
}
parallel {
stage ('3: run third test suite') {
steps {
Expand All @@ -160,11 +195,14 @@ pipeline {
}
}
stage ('push images to testlagoon/* with :latest tag') {
when {
when {
branch 'main'
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
Expand All @@ -180,6 +218,9 @@ pipeline {
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
TOKEN = credentials('git-amazeeio-helmfile-ci-trigger')
Expand All @@ -194,6 +235,9 @@ pipeline {
not {
environment name: 'SKIP_IMAGE_PUBLISH', value: 'true'
}
expression {
!skipRemainingStages
}
}
environment {
PASSWORD = credentials('amazeeiojenkins-dockerhub-password')
Expand All @@ -209,6 +253,9 @@ pipeline {
branch 'testing/scans'
buildingTag()
}
expression {
!skipRemainingStages
}
}
steps {
sh script: 'make scan-images', label: "perform scan routines"
Expand Down

0 comments on commit 1f630e9

Please sign in to comment.