-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flink 34569][e2e] fail fast if AWS cli container fails to start #24491
Changes from all commits
793ca0d
92354f8
ca05028
4b233a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,23 @@ | |
# AWSCLI_CONTAINER_ID | ||
################################### | ||
function aws_cli_start() { | ||
export AWSCLI_CONTAINER_ID=$(docker run -d \ | ||
local CONTAINER_ID | ||
CONTAINER_ID=$(docker run -d \ | ||
--network host \ | ||
--mount type=bind,source="$TEST_INFRA_DIR",target=/hostdir \ | ||
-e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \ | ||
--entrypoint python \ | ||
-it banst/awscli) | ||
if [ $? -ne 0 ]; then | ||
echo "running aws cli container failed" | ||
if [ -n "$CONTAINER_ID" ] | ||
then | ||
docker kill "$CONTAINER_ID" | ||
docker rm "$CONTAINER_ID" | ||
fi | ||
return 1 | ||
fi | ||
export AWSCLI_CONTAINER_ID="$CONTAINER_ID" | ||
|
||
while [[ "$(docker inspect -f {{.State.Running}} "$AWSCLI_CONTAINER_ID")" -ne "true" ]]; do | ||
sleep 0.1 | ||
|
@@ -58,7 +69,11 @@ function aws_cli_stop() { | |
if [[ $AWSCLI_CONTAINER_ID ]]; then | ||
aws_cli_stop | ||
fi | ||
aws_cli_start | ||
aws_cli_start || aws_cli_start | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will simple retry like this let the script be executed multiple times without proper cleanup of previous container, given the aws_cli_start is not Idempotent, afaiu. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming that Happy to remove the retry, getting the test to fail faster with a more obvious cause is an improvement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added in a failsafe to kill/remove if |
||
if [ $? -ne 0 ]; then | ||
echo "running the aws cli container failed" | ||
exit 1 | ||
fi | ||
|
||
################################### | ||
# Runs an aws command on the previously started container. | ||
|
@@ -135,7 +150,7 @@ function s3_get_number_of_lines_by_prefix() { | |
|
||
# find all files that have the given prefix | ||
parts=$(aws_cli s3api list-objects --bucket "$IT_CASE_S3_BUCKET" --prefix "$1" | | ||
docker run -i stedolan/jq -r '[.Contents[].Key] | join(" ")') | ||
docker run -i --rm stedolan/jq -r '[.Contents[].Key] | join(" ")') | ||
|
||
# in parallel (N tasks), query the number of lines, store result in a file named lines | ||
N=10 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see https://www.shellcheck.net/wiki/SC2155