Created
September 24, 2019 19:28
-
-
Save luizrobertofreitas/0cb6347385ae39fa7d7441edb46f066a to your computer and use it in GitHub Desktop.
Openshift DSL imagestreamtag exists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
environment { | |
def imageStreamTagExists = false | |
} | |
stages { | |
stage('Image stream tag') { | |
steps { | |
script { | |
openshift.withCluster() { | |
openshift.withProject("project") { | |
imageStreamTagExists = openshift.selector("imagestreamtag", "appname:1.0.0").exists() | |
echo "Image Stream Tag exists? ${imageStreamTagExists}" | |
} | |
} | |
} | |
} | |
} | |
stage('Testing') { | |
when { | |
expression { | |
!imageStreamTagExists | |
} | |
} | |
steps { | |
script { | |
echo "Do not exist" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment