Created
          August 20, 2018 10:35 
        
      - 
      
- 
        Save garethahealy/3327f1fe1d9435e54d35d1dbd70601cf to your computer and use it in GitHub Desktop. 
    openshift deployment via jenkins groovy lib
  
        
  
    
      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
    
  
  
    
  | 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