Skip to content

Instantly share code, notes, and snippets.

@garethahealy
Created August 20, 2018 10:35
Show Gist options
  • Save garethahealy/3327f1fe1d9435e54d35d1dbd70601cf to your computer and use it in GitHub Desktop.
Save garethahealy/3327f1fe1d9435e54d35d1dbd70601cf to your computer and use it in GitHub Desktop.
openshift deployment via jenkins groovy lib
def progressingCondition = dcObject?.status?.conditions.find { condition -> condition.type == "Progressing" }
if (progressingCondition == null) {
//maybe this is because there isnt an active dc?
return false
}
if (progressingCondition.status == "Unknown") {
//Deployment already in-progress due to oc apply - deployer pod not ready yet
isRolloutRequired = false
} else if (progressingCondition.status == "True" && progressingCondition.reason == "ReplicationControllerUpdated") {
//Deployment already in-progress due to oc apply - deployer pod up and ready
isRolloutRequired = false
} else if (progressingCondition.status == "True" && progressingCondition.reason == "NewReplicationControllerAvailable") {
//Deployment not in-progress - this is probably from the previous deployment condition
isRolloutRequired = true
} else if (progressingCondition.status == "False" && progressingCondition.reason == "ProgressDeadlineExceeded") {
//Deployment not in-progress - the previous deployment failed
isRolloutRequired = true
} else {
steps.error "Missing condition check: $progressingCondition"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment