Skip to content

Commit

Permalink
Fix waiting period, and log more info.
Browse files Browse the repository at this point in the history
  • Loading branch information
rasben committed Oct 19, 2023
1 parent f34eaa3 commit a95c2bf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,30 @@ runs:
fi
DETECTION_TRIES=0
TOTAL_TRIES=0
TRIES=0
SUCCESS=0
DELAY_BETWEEN_ATTEMPTS=5;
MAX_DETECTION_SECONDS=${{ inputs.PSH_DETECTION_WAIT }};
MAX_DETECTION_TRIES=$(( MAX_DETECTION_SECONDS / DELAY_BETWEEN_ATTEMPTS ));
MAX_TRIES=$(( 600 / DELAY_BETWEEN_ATTEMPTS ));
MAX_WAIT_SECONDS=900;
echo "We will wait for a maximum of $MAX_DETECTION_SECONDS for PSH to detect a deploy, and a max of $MAX_WAIT_SECONDS for the deployment to finish."
MAX_TRIES=$(( 900 / DELAY_BETWEEN_ATTEMPTS ));
while [ $DETECTION_TRIES -le $MAX_DETECTION_TRIES ] && [ $TOTAL_TRIES -le $MAX_TRIES ]; do \
while [ $DETECTION_TRIES -le $MAX_DETECTION_TRIES ] && [ $TRIES -le $MAX_TRIES ]; do \
DETECTION_TRIES=$((DETECTION_TRIES+1)); \
TOTAL_TRIES=$((TOTAL_TRIES+1)); \
TRIES=$((TRIES+1)); \
ACTS=$(~/.platformsh/bin/platform activities --columns=id,state --incomplete --no-header --no-interaction --type=${{ inputs.ACTIVITY_TYPES }} 2>&1 || true); \
if [[ "$ACTS" =~ "pending" || "$ACTS" =~ "in progress" ]]; then TOTAL_TRIES=0; fi; \
if [[ "$ACTS" =~ "pending" || "$ACTS" =~ "in progress" ]]; then DETECTION_TRIES=0; fi; \
if [[ "$ACTS" =~ "No activities found" ]]; then SUCCESS=1; break; fi; \
echo ""; \
echo "Current deploy state(s):"; \
echo "$ACTS"; \
echo "-----------------"; \
echo "detect tries: $DETECTION_TRIES / $MAX_DETECTION_TRIES"; \
echo "total tries: $TRIES / $MAX_TRIES"; \
echo "--------------------------"; \
sleep $DELAY_BETWEEN_ATTEMPTS; \
done \
Expand Down

0 comments on commit a95c2bf

Please sign in to comment.