-
Notifications
You must be signed in to change notification settings - Fork 261
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
🐛 Fix image push in Makefile for image-push jobs #1039
🐛 Fix image push in Makefile for image-push jobs #1039
Conversation
✔️ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready! 🔨 Explore the source changes: 2c6ebb6 🔍 Inspect the deploy log: https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/618447807014300008895887 😎 Browse the preview: https://deploy-preview-1039--kubernetes-sigs-cluster-api-openstack.netlify.app |
3438b45
to
1a42a5b
Compare
1a42a5b
to
2fcee3b
Compare
/retest |
f0b8e80
to
0c8d3df
Compare
/lgtm |
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.
/approve
/approve |
We should wait for kubernetes/test-infra#24227 to be merged first |
We can simplify this bug as follows: ROOT_DIR_RELATIVE := .
include $(ROOT_DIR_RELATIVE)/common.mk
TAG ?= dev
ARCH ?= amd64
STAGING_REGISTRY := gcr.io/k8s-staging-capi-openstack
REGISTRY ?= $(STAGING_REGISTRY)
IMAGE_NAME ?= capi-openstack-controller
CONTROLLER_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
CONTROLLER_IMG_TAG ?= $(CONTROLLER_IMG)-$(ARCH):$(TAG)
.PHONY: docker-build
docker-build: ## Build the docker image for controller-manager
/usr/bin/echo $(ARCH) $(CONTROLLER_IMG_TAG)
docker-build-%:
$(MAKE) ARCH=$* docker-build If we run
Note the output line:
We can see that the value of ARCH is 'arm', as expected, but the value of CONTROLLER_IMG_TAG, which contains ARCH, substituted the wrong value. Note that CONTROLLER_IMG_TAG is a recursively expanded variable, which is the default kind of make variable. This means that the variable is expanded at the point of use, not the point of definition. But we can clearly see in this case that the expanded value of ARCH in CONTROLLER_IMG_TAG is not the same as the value of ARCH used on the same line. The problem is that common.mk includes the directive
Of these I prefer the latter solution because the global behaviour of We introduced My preference would be to remove the directive and then fix whatever it broke by exporting any environment variables explicitly to the shell or sub-make which requires it. @randomvariable I don't suppose you remember what it was? |
|
Looking at this Makefile some more we use a huge number of submakes, most of which seem to be unnecessary. For example: .PHONY: generate
generate: ## Generate code
$(MAKE) generate-go
$(MAKE) generate-manifests This could simply be: .PHONY: generate
generate: generate-go generate-manifests As currently written we either need A slightly more complex example may actually relate to the reason this was introduced, as it invokes .PHONY: $(RELEASE_DIR)/$(MANIFEST_FILE).yaml
$(RELEASE_DIR)/$(MANIFEST_FILE).yaml:
$(MAKE) compiled-manifest \
PROVIDER=$(MANIFEST_FILE) \
OLD_IMG=$(CONTROLLER_ORIGINAL_IMG) \
MANIFEST_IMG=$(CONTROLLER_IMG) \
CONTROLLER_NAME=$(CONTROLLER_NAME) \
PROVIDER_CONFIG_DIR=$(CONFIG_DIR) \
NAMESPACE=$(NAMESPACE)
.PHONY: compiled-manifest
compiled-manifest: $(RELEASE_DIR) $(KUSTOMIZE)
$(MAKE) image-patch-source-manifest
$(MAKE) image-patch-pull-policy
$(MAKE) image-patch-kustomization
$(KUSTOMIZE) build $(IMAGE_PATCH_DIR)/$(PROVIDER) > $(RELEASE_DIR)/$(PROVIDER).yaml Can be written as: compiled_manifest=$(RELEASE_DIR)/$(MANIFEST_FILE).yaml
.PHONY: $(compiled_manifest)
$(compiled_manifest): PROVIDER=$(MANIFEST_FILE)
$(compiled_manifest): OLD_IMG=$(CONTROLLER_ORIGINAL_IMG)
$(compiled_manifest): MANIFEST_IMG=$(CONTROLLER_IMG)
$(compiled_manifest): PROVIDER_CONFIG_DIR=$(CONFIG_DIR)
$(compiled_manifest): $(KUSTOMIZE) image-patch-source-manifest image-patch-pull-policy image-patch-kustomization | $(RELEASE_DIR)
$(KUSTOMIZE) build $(IMAGE_PATCH_DIR)/$(PROVIDER) > $(RELEASE_DIR)/$(PROVIDER).yaml Anyway, I strongly suspect that most of these things are never going to be a real issue to anybody, so rather than a mass cleanup it might be worth just removing |
TL;DR
A thorough fix would be:
Alternative:
|
Thanks for the detailed analysis. Just removing .EXPORT_ALL_VARIABLES sounds fine for me :-) |
c4ebf02
to
12329eb
Compare
From me also many thanks for the detailed analysis @mdbooth! I just pushed the commit with the removal of |
/retest |
That failed because we're no longer passing the Make variable DOCKER_BUILDKIT=1 to docker as an environment variable. |
12329eb
to
727519e
Compare
Thanks, got it. Fixed it. I also looked for other environment variables, that should have been all of them. |
I just threw up #1040 so I can try things, but it's not going to replace this PR. Feel free to look at anything I throw in there or not. |
Signed-off-by: Tobias Giese <[email protected]>
727519e
to
2c6ebb6
Compare
@mdbooth the e2e tests are green now. Exporting the Docker and PATH variable seems to fix it. |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrischdi, mdbooth, sbueringer, tobiasgiese 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 |
/unhold |
What this PR does / why we need it:
This PR should fix the failing
post-cluster-api-provider-openstack-push-images
job.It seems that the first failing job was on September 2nd 11:02am, which was PR #981.
last successful job: Sep 01 10:35:07
first failing job: Sep 02 11:02:17
I found the following errors:
and
If I run a
make docker-build-arm docker-push-arm
on themain
branch:And the same command on this branch:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs:
/hold
Tobias Giese [email protected], Daimler TSS GmbH, legal info/Impressum