-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] Defensive code in pull-sandbox-image.sh for custom AMI(s) #1648
[WIP] Defensive code in pull-sandbox-image.sh for custom AMI(s) #1648
Conversation
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
region=$(echo "${sandbox_image}" | cut -f4 -d ".") | ||
### skip if we don't find a region in the sandbox image | ||
if [[ -z ${region:-} ]]; then |
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.
just because we parse a non-empty region doesn't mean its valid right?
registry.k8s.io/pause:3.9
is going to parse 9
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.
correct, we need more validation!
@@ -29,7 +40,7 @@ function retry() { | |||
done | |||
} | |||
|
|||
ecr_password=$(retry aws ecr get-login-password --region $region) | |||
ecr_password=$(retry aws ecr get-login-password --region "${region}") |
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.
if we add carter's fix https://github.com/awslabs/amazon-eks-ami/pull/1646/files so that we don't break the whole workflow on this failing, the crictl
calls should be fine even if the ecr_password
is empty but we'd need to remove the explicit exit 1
tested empty
# crictl pull --creds "AWS:" registry.k8s.io/pause:3.9
Image is up to date for sha256:e6f1816883972d4be47bd48879a08919b96afcd344132622e4d444987919323c
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.
agree
@ndbaker1 @cartermckinnon feel free to folks this PR/commit into something you are already working on. opened this as WIP just to highlight |
sandbox_image
is not even present (or commented out) in a custom config.toml (created by customer on top of our AMI as base or injected via user data)