mirror of
				https://github.com/honestbee/drone-kubernetes.git
				synced 2025-11-04 14:28:08 +00:00 
			
		
		
		
	Merge 3c5a88eaab into b71e43dc6d
				
					
				
			This commit is contained in:
		
						commit
						bd89327ba7
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		
							
								
								
									
										12
									
								
								update.sh
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								update.sh
									
										
									
									
									
								
							| 
						 | 
					@ -34,7 +34,19 @@ IFS=',' read -r -a CONTAINERS <<< "${PLUGIN_CONTAINER}"
 | 
				
			||||||
for DEPLOY in ${DEPLOYMENTS[@]}; do
 | 
					for DEPLOY in ${DEPLOYMENTS[@]}; do
 | 
				
			||||||
  echo Deploying to $KUBERNETES_SERVER
 | 
					  echo Deploying to $KUBERNETES_SERVER
 | 
				
			||||||
  for CONTAINER in ${CONTAINERS[@]}; do
 | 
					  for CONTAINER in ${CONTAINERS[@]}; do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Collect the last revision number so we can track the next one
 | 
				
			||||||
 | 
					    local LAST=$(kubectl -n ${PLUGIN_NAMESPACE} rollout history deployment/${DEPLOY} |grep -v '$^' |tail -n1 | awk '{print $1}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Initiate the rolloout by modifying the image
 | 
				
			||||||
    kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
 | 
					    kubectl -n ${PLUGIN_NAMESPACE} set image deployment/${DEPLOY} \
 | 
				
			||||||
      ${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} --record
 | 
					      ${CONTAINER}=${PLUGIN_REPO}:${PLUGIN_TAG} --record
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Wait for the rollout to complete
 | 
				
			||||||
 | 
					    kubectl -n ${PLUGIN_NAMESPACE} rollout status -r $((++LAST)) --watch
 | 
				
			||||||
 | 
					    if [ $? -ne 0  ]; then
 | 
				
			||||||
 | 
					       echo "rollout of [${PLUGIN_NAMESPACE}]:deployment/${DEPLOY}/${CONTAINER} failed"
 | 
				
			||||||
 | 
					       exit 1
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue