fix: add install-helm dependency to helm-lint target#157
Conversation
|
I think the issue isn't about availability of helm, because |
|
In other words, we are expecting the Helm to be available on the local bin directory while it is on the system-wide bin directory |
|
If we override the Helm path during the action, then that should be enough I think. Also, we could drop |
|
@fmuyassarov Understood. Two options: |
I'm afraid this will actually break. If Helm isn’t available, we install it into the local |
|
You're right - if HELM = $(OUT_DIR)/helm
.PHONY: install-helm
install-helm: $(OUT_DIR)
@if [ -f "$(HELM)" ]; then \
exit 0; \
elif command -v helm >/dev/null 2>&1; then \
ln -sf "$$(command -v helm)" "$(HELM)"; \
else \
echo "Installing helm to $(OUT_DIR)..."; \
GOBIN=$(OUT_DIR) go install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION_SHA); \
fi
This way:
- CI (ubuntu-latest): symlinks system helm to bin/helm
- cloudbuild: installs to bin/helm
- Always uses $(OUT_DIR)/helm consistently
We can still remove azure/setup-helm from the workflow since ubuntu-latest has helm preinstalled. |
|
@fmuyassarov Does this align with your ideas? |
Sorry for late response @AutuSnow . I just realized that it might actually be fine to add the Helm installation target as a dependency for My preference would probably be to keep it simple and maybe improve the current approach just a little bit on top of what you already have now. In other words, diff --git a/Makefile b/Makefile
index e0e7491..e8daf0c 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ KIND_K8S_VERSION ?= v1.36.0
# paths
YQ = $(OUT_DIR)/yq
GOLANGCI_LINT = $(OUT_DIR)/golangci-lint
-HELM = $(OUT_DIR)/helm
+HELM := $(or $(shell command -v helm 2>/dev/null),$(OUT_DIR)/helm)
# disable CGO by default for static binaries
CGO_ENABLED=0
@@ -241,7 +241,7 @@ install-yq: $(OUT_DIR) ## make sure the yq tool is available locally
install-golangci-lint: $(OUT_DIR) ## make sure the golangci-lint tool is available locally
@hack/fetch-golangci-lint.sh $(OUT_DIR) $(GOLANGCI_LINT_VERSION)
-helm-lint: ## lint helm chart with strict mode
+helm-lint: install-helm ## lint helm chart with strict mode
$(HELM) lint --strict ${HELM_CHART}this way we avoid installing the Helm on the runner too. WDYT? |
|
@fmuyassarov Sure this is the least amount of modification, and I think this method has finer granularity than the one I used above |
installed first. This caused CI failures when helm was not available in the system PATH. Other helm targets (helm-package, helm-push) already depend on install-helm. This change makes helm-lint consistent with them. Fixes the error: bash: /home/runner/work/.../bin/helm: No such file or directory make: *** [Makefile:248: helm-lint] Error 127
b6f6853 to
19ca569
Compare
|
/lgtm Thanks! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AutuSnow, pravk03 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The helm-lint target was calling $(HELM) without ensuring helm is installed first. This caused CI failures when helm was not available in the system PATH.
Other helm targets (helm-package, helm-push) already depend on install-helm. This change makes helm-lint consistent with them.
Fixes the error:
bash: /home/runner/work/.../bin/helm: No such file or directory
make: *** [Makefile:248: helm-lint] Error 127