Skip to content

Commit

Permalink
Update check.yml
Browse files Browse the repository at this point in the history
Signed-off-by: qiaofeng1227 <76487013@qq.com>
  • Loading branch information
qiaofeng1227 authored Oct 22, 2024
1 parent daa03d7 commit 7e3c47b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,23 @@ jobs:
TIMEOUT_DURATION=5
IMAGE_NAME=docker.rainbond.cc/library/mysql:5.6
# Pull the image with timeout and measure the time
START_TIME=$(date +%s)
timeout $TIMEOUT_DURATION docker pull $IMAGE_NAME 2>&1 | tee pull_output.log || echo "Docker pull timed out or failed"
END_TIME=$(date +%s)
# Start pulling the image in the background
(
docker pull $IMAGE_NAME 2>&1 &
echo $! > pull_pid.txt
) | tee pull_output.log &
PULL_PID=$(cat pull_pid.txt)
# Wait for the specified duration
sleep $TIMEOUT_DURATION
# Kill the docker pull process after the timeout
kill $PULL_PID
# Calculate the duration
START_TIME=$(date +%s -r pull_output.log)
END_TIME=$(date +%s)
DURATION=$((END_TIME - START_TIME))
# Parse the output to find the downloaded size
Expand Down

0 comments on commit 7e3c47b

Please sign in to comment.