Skip to content
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

release: accept empty KUBE_DOCKER_IMAGE_TAG #80185

Merged
merged 2 commits into from Jul 17, 2019

Conversation

javier-b-perez
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:
When we build CI releases, they need to use the same docker tag for 'k8s.gcr.io' and for KUBE_DOCKER_REGISTRY. If we leave KUBE_DOCKER_IMAGE_TAG empty, it will use the same docker tag.

See #80184

Special notes for your reviewer:
If only KUBE_DOCKER_IMAGE_TAG is defined, and for some reason the value is the same as '$docker_tag', it will work because we can tag the image with the same name. The only difference, the image will be preserved at the end of the execution.

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 15, 2019
@javier-b-perez
Copy link
Contributor Author

/assign @cblecker
/assign @BenTheElder

@javier-b-perez
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce

@javier-b-perez
Copy link
Contributor Author

Some tests:
make quick-release
cat manifest.json
"RepoTags":["k8s.gcr.io/kube-apiserver-amd64:v1.16.0-alpha.0.2265_12cf78e2d3a8de"]

KUBE_DOCKER_REGISTRY=gcr.io/my-project make quick-release
cat manifest.json
"RepoTags":["k8s.gcr.io/kube-apiserver-amd64:v1.16.0-alpha.0.2265_12cf78e2d3a8de","gcr.io/my-project/kube-apiserver-amd64:v1.16.0-alpha.0.2265_12cf78e2d3a8de"]

@javier-b-perez
Copy link
Contributor Author

/priority important-soon
/sig release
/area release-eng

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/release Categorizes an issue or PR as relevant to SIG Release. area/release-eng Issues or PRs related to the Release Engineering subproject and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 15, 2019
@dims
Copy link
Member

dims commented Jul 16, 2019

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 16, 2019
if [[ -n "${KUBE_DOCKER_IMAGE_TAG-}" && -n "${KUBE_DOCKER_REGISTRY-}" && $docker_registry != $KUBE_DOCKER_REGISTRY ]]; then
release_docker_image_tag="${KUBE_DOCKER_REGISTRY}/${binary_name}-${arch}:${KUBE_DOCKER_IMAGE_TAG}"
if [[ -n "${KUBE_DOCKER_IMAGE_TAG-}" || -n "${KUBE_DOCKER_REGISTRY-}" ]]; then
release_docker_image_tag="${KUBE_DOCKER_REGISTRY-$docker_registry}/${binary_name}-${arch}:${KUBE_DOCKER_IMAGE_TAG-$docker_tag}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing these inline substitutions, could set do something like:

KUBE_DOCKER_REGISTRY="${KUBE_DOCKER_REGISTRY-$docker_registry}"

That way, $KUBE_DOCKER_REGISTRY will always have a value (either an explicit one, or a sane default), rather than doing these inline ones. I haven't looked through the rest of the if logic here, but it's obvious we need to clean some of this up and make it more easily understandable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, this is pretty tricky to follow 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about now?
I always generate release_docker_image_tag, it could be default values or ENV value.
It should always remote the docker_tag image. Releases are going to be tagged with release_docker_image_tag, which should be different that docker_tag.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 16, 2019
Copy link
Contributor

@fejta fejta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 16, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, fejta, javier-b-perez

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 16, 2019
@javier-b-perez
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce-big

@k8s-ci-robot k8s-ci-robot merged commit 704790e into kubernetes:master Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/release Categorizes an issue or PR as relevant to SIG Release. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants