-
Notifications
You must be signed in to change notification settings - Fork 56
gcp: adding image check before creating image #589
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
base: devel
Are you sure you want to change the base?
Conversation
@bpradipt @littlejawa, yesterday I force pushed this commit to the PR branch, I remember seeing that commit on that PR, for some reason, it looks like it got lost, maybe with another force-push. So my bad. |
ce9465b
to
a765819
Compare
As following other providers logic. Signed-off-by: Beraldo Leal <[email protected]>
a765819
to
7c3bef4
Compare
@beraldoleal: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
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.
lgtm
|
||
# This command returns something like this: | ||
# https://www.googleapis.com/compute/v1/projects/my-project/global/images/my-image | ||
# Use `cut` to the image name |
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.
It is obvious that cut
is used below, it is less obvious what we want to drop.
# Use `cut` to the image name | |
# we want to drop the leading "https://www.googleapis.com/compute/v1/" |
--project="${GCP_PROJECT_ID}" \ | ||
--format='get(selfLink)' 2>/dev/null | cut -d/ -f6-) | ||
|
||
if [[ $? -ne 0 ]]; 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.
AFAICT this branch is dead code.
greg@bahia:~$ image_path=$(false | cut -d/ -f6-)
greg@bahia:~$ echo $?
0
else | ||
echo "Image mismatch: GCP image (${image_path}) different from ConfigMap (${latest_image_id})." | ||
return 2 | ||
fi |
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.
This image_exists
function turns out to have non-trivial semantics, not just returning true or false. IMO it would be clearer to open-code it in its unique caller. This would spare the need for the exit status values.
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.
gcp: adding image check before creating image
As following other providers logic.Signed-off-by: Beraldo Leal [email protected]
The commit message would be a good place to describe the various cases that need to be handled BTW.
In the meantime, I went to #584 and I realized that you borrowed the convoluted image_exists
pattern from there and it is already merged 😞 ... well, I guess I won't fight if everyone is apparently happy with that.
As following other providers logic. A follow up to #584.