mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-30 18:47:51 +00:00 
			
		
		
		
	chore: refactor deploy check gh action (#9018)
* chore: refactor deploy check action
    Refactor deployment check gh action to account for the initial setup time required for heroku review apps
    Process /api response via jq only if http.status_code is 200
			
			
This commit is contained in:
		
							
								
								
									
										22
									
								
								.github/workflows/deploy_check.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/deploy_check.yml
									
									
									
									
										vendored
									
									
								
							| @@ -20,15 +20,23 @@ jobs: | ||||
|           max_attempts=10 | ||||
|           attempt=1 | ||||
|           status_code=0 | ||||
|           echo "Waiting for review app to be deployed/redeployed, trying in  10 minutes..." | ||||
|           sleep 600 | ||||
|           while [ $attempt -le $max_attempts ]; do | ||||
|             response=$(curl -s  https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) | ||||
|             status_code=$(echo "$response" | jq -r 'if .version and .timestamp and .queue_services and .data_services then 200 else 400 end') | ||||
|             if [ $status_code -eq  200 ]; then | ||||
|               echo "Deployment successful" | ||||
|               exit  0 | ||||
|             response=$(curl -s -o /dev/null -w "%{http_code}" https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) | ||||
|             status_code=$(echo $response | head -n   1) | ||||
|             if [ $status_code -eq   200 ]; then | ||||
|               body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api) | ||||
|               if echo "$body" | jq -e '.version and .timestamp and .queue_services == "ok" and .data_services == "ok"' > /dev/null; then | ||||
|                 echo "Deployment successful" | ||||
|                 exit 0 | ||||
|               else | ||||
|                 echo "Deployment status unknown, retrying in   3 minutes..." | ||||
|                 sleep 180 | ||||
|               fi | ||||
|             else | ||||
|               echo "Deployment status unknown, retrying in  3 minutes..." | ||||
|               sleep  180 | ||||
|               echo "Waiting for review app to be ready, retrying in  3 minutes..." | ||||
|               sleep 180 | ||||
|               attempt=$((attempt +  1)) | ||||
|             fi | ||||
|           done | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Vishnu Narayanan
					Vishnu Narayanan