Repository: openshift-kni/telco-reference
Pull request #156: ztp: CNF-17491: ci validate for telco-ran
Author: login: abraham2512
Labels: name: lgtm
description: Indicates that a PR is ready to be merged.
name: approved
description: Indicates a PR has been approved by an approver from all required OWNERS files.
Created: 2025-04-30T17:48:31Z | Merged: 2025-05-16T19:28:13Z

This MR enables kube-compare-reference ci check for telco-ran directory


Diff:
diff --git a/Makefile b/Makefile
index 0df59dd4d..831fee122 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,12 @@ markdownlint: markdownlint-image  ## run the markdown linter
 		-v $$(pwd):/workdir:Z \
 		$(IMAGE_NAME)-markdownlint:latest
 
-ci-validate: lintCheck check-reference
+ci-validate: lintCheck check-reference-core check-reference-ran
 
-.PHONY: check-reference
-check-reference:
+.PHONY: check-reference-core
+check-reference-core:
 	$(MAKE) -C ./telco-core/configuration check
+
+.PHONY: check-reference-ran
+check-reference-ran:
+	$(MAKE) -C ./telco-ran/configuration check
diff --git a/telco-ran/configuration/Makefile b/telco-ran/configuration/Makefile
index 40b7f3fae..9f42865a8 100644
--- a/telco-ran/configuration/Makefile
+++ b/telco-ran/configuration/Makefile
@@ -1,8 +1,7 @@
 
-.PHONY: ci-job checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
-
-ci-job: checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
+.PHONY: check checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
 
+check: checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
 
 checkExtraManifests:
 	$(MAKE) -C ./extra-manifests-builder check
diff --git a/telco-ran/configuration/extra-manifests-builder/Makefile b/telco-ran/configuration/extra-manifests-builder/Makefile
index ebfb5d49a..f9cb9f1a6 100644
--- a/telco-ran/configuration/extra-manifests-builder/Makefile
+++ b/telco-ran/configuration/extra-manifests-builder/Makefile
@@ -1,7 +1,8 @@
 GOPATH  ?= $(HOME)/go
 GOBIN ?= $(GOPATH)/bin
 export MCMAKER := $(GOBIN)/mcmaker
-export GOFLAGS ?= -mod=vendor
+# Set this flag below if using custom go.mod
+# export GOFLAGS ?= -mod=vendor
 
 DST := ../source-crs/extra-manifest
 CHK := .chk
@@ -70,5 +71,6 @@ test:
 	done; \
 	exit $$failures
 
+# Setting mcmaker tag=latest for install in prow (no go.mod)
 $(MCMAKER):
-	go install github.com/lack/mcmaker
+	go install github.com/lack/mcmaker@latest
diff --git a/telco-ran/configuration/kube-compare-reference/Makefile b/telco-ran/configuration/kube-compare-reference/Makefile
index 416b4082b..e230010d4 100644
--- a/telco-ran/configuration/kube-compare-reference/Makefile
+++ b/telco-ran/configuration/kube-compare-reference/Makefile
@@ -1,22 +1,15 @@
-CLUSTER_COMPARE_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_linux_amd64")) | .browser_download_url')
-HELM_CONVERT_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_addon_tools_linux_amd64")) | .browser_download_url')
-HELM_URL := https://get.helm.sh/helm-v3.16.1-linux-amd64.tar.gz
-HELM_PKG := helm-linux-amd64.tar.gz
-
 .PHONY: check
 check: metadata_lint compare
 
 kubectl-cluster_compare:
-	@echo "Downloading $@"
-	curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v kubectl-cluster_compare > /dev/null 2>&1 || { \
+		echo "kubectl-cluster_compare tool isn't installed; please download it from https://github.com/openshift/kube-compare"; \
+	}
 
 helm-convert:
-	@echo "Downloading $@"
-	curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v helm-convert > /dev/null 2>&1 || { \
+		echo "helm-convert isn't installed; please download and install it"; \
+	}
 
 .PHONY: metadata_lint
 metadata_lint: kubectl-cluster_compare
@@ -39,16 +32,14 @@ clean:
 convert: helm-convert helm
 	@echo "Converting reference files to Helm Charts."
 	@rm -rf Chartv1 renderedv1
-	@./helm-convert -r ./metadata.yaml -n Chartv1 -v default_value.yaml
+	@helm-convert -r ./metadata.yaml -n Chartv1 -v default_value.yaml
 	@echo "Rendering Helm Charts to CR files."
-	@./helm template renderedv1 ./Chartv1 --output-dir renderedv1
+	@helm template renderedv1 ./Chartv1 --output-dir renderedv1
 
 helm:
-	@echo "Installing helm..."
-	curl -fsSL $(HELM_URL) -o $(HELM_PKG)
-	tar -zxvf $(HELM_PKG) linux-amd64/helm --strip-components 1
-	rm -f $(HELM_PKG)
-
+	@command -v helm > /dev/null 2>&1 || { \
+		echo "helm isn't installed; please download and install it"; \
+	}
 
 .PHONY: compare
 compare: convert


Reviews:
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-13T21:39:24Z
user: login: irinamihai
body: Just a few comments.
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T14:29:22Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-14T14:30:26Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-14T17:17:01Z
user: login: irinamihai
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-14T20:06:49Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-14T20:12:09Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-14T21:48:12Z
user: login: imiller0
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-15T14:58:42Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-15T15:38:13Z
user: login: abraham2512
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-15T15:41:58Z

Review comments:
diff_hunk: @@ -2,21 +2,26 @@ CLUSTER_COMPARE_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/ope
 HELM_CONVERT_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_addon_tools_linux_amd64")) | .browser_download_url')
 HELM_URL := https://get.helm.sh/helm-v3.16.1-linux-amd64.tar.gz
 HELM_PKG := helm-linux-amd64.tar.gz
+BIN_PATH := ~/.local/bin
path: telco-ran/configuration/kube-compare-reference/Makefile
user: login: abraham2512
body: Needed to include this because prow job sets up the binaries in `/usr/bin`, but running make locally was previously setting it up in kube-compare root. This was needed to ensure `helm` and `helm-convert` can be invoked in the same way.
created_at: 2025-05-13T21:39:24Z
author_association: MEMBER
diff_hunk: @@ -32,8 +32,12 @@ markdownlint: markdownlint-image  ## run the markdown linter
 		-v $$(pwd):/workdir:Z \
 		$(IMAGE_NAME)-markdownlint:latest
 
-ci-validate: lintCheck check-reference
+ci-validate: lintCheck check-reference check-reference-ran
 
 .PHONY: check-reference
path: Makefile
user: login: irinamihai
body: Could we also update this to `check-reference-core` to make it consistent?
created_at: 2025-05-14T14:09:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -3,6 +3,7 @@
 
 ci-job: checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
 
+check: check-reference
path: telco-ran/configuration/Makefile
user: login: irinamihai
body: Do we actually need this target? I think `ci-job` should be renamed to `check`. This way it will be consistent with the `core` [structure](https://github.com/openshift-kni/telco-reference/blob/main/telco-core/configuration/Makefile#L2) as well.
created_at: 2025-05-14T14:29:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -32,8 +32,12 @@ markdownlint: markdownlint-image  ## run the markdown linter
 		-v $$(pwd):/workdir:Z \
 		$(IMAGE_NAME)-markdownlint:latest
 
-ci-validate: lintCheck check-reference
+ci-validate: lintCheck check-reference check-reference-ran
 
 .PHONY: check-reference
path: Makefile
user: login: abraham2512
body: Updated this, thanks
created_at: 2025-05-14T14:30:26Z
author_association: MEMBER
diff_hunk: @@ -3,6 +3,7 @@
 
 ci-job: checkExtraManifests checkSourceCRsAnnotation checkZtpPaths check-reference
 
+check: check-reference
path: telco-ran/configuration/Makefile
user: login: abraham2512
body: Updated
created_at: 2025-05-14T17:17:01Z
author_association: MEMBER
diff_hunk: @@ -1,7 +1,7 @@
 GOPATH  ?= $(HOME)/go
 GOBIN ?= $(GOPATH)/bin
 export MCMAKER := $(GOBIN)/mcmaker
-export GOFLAGS ?= -mod=vendor
+# export GOFLAGS ?= -mod=vendor
path: telco-ran/configuration/extra-manifests-builder/Makefile
user: login: irinamihai
body: Why is this commented out and not removed, if not used?
created_at: 2025-05-14T20:05:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -71,4 +71,4 @@ test:
 	exit $$failures
 
 $(MCMAKER):
-	go install github.com/lack/mcmaker
+	go install github.com/lack/mcmaker@latest
path: telco-ran/configuration/extra-manifests-builder/Makefile
user: login: irinamihai
body: Do we want to lock this in before a branch is cut? If yes, then we probably need a comment or something to draw attention to this.
created_at: 2025-05-14T20:06:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,7 +1,7 @@
 GOPATH  ?= $(HOME)/go
 GOBIN ?= $(GOPATH)/bin
 export MCMAKER := $(GOBIN)/mcmaker
-export GOFLAGS ?= -mod=vendor
+# export GOFLAGS ?= -mod=vendor
path: telco-ran/configuration/extra-manifests-builder/Makefile
user: login: abraham2512
body: ~Yes I think its not needed. Removed the comment.~
I kept it commented and added a note instead. It will be needed in case of a custom go.mod
created_at: 2025-05-14T20:12:08Z
author_association: MEMBER
diff_hunk: @@ -71,4 +71,4 @@ test:
 	exit $$failures
 
 $(MCMAKER):
-	go install github.com/lack/mcmaker
+	go install github.com/lack/mcmaker@latest
path: telco-ran/configuration/extra-manifests-builder/Makefile
user: login: abraham2512
body: Added a comment about it.
I think mcmaker package was latest master by default, so I think we don't need to version control it in our branches.
created_at: 2025-05-14T21:48:11Z
author_association: MEMBER
diff_hunk: @@ -2,21 +2,26 @@ CLUSTER_COMPARE_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/ope
 HELM_CONVERT_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_addon_tools_linux_amd64")) | .browser_download_url')
 HELM_URL := https://get.helm.sh/helm-v3.16.1-linux-amd64.tar.gz
 HELM_PKG := helm-linux-amd64.tar.gz
+BIN_PATH := ~/.local/bin
 
 .PHONY: check
 check: metadata_lint compare
 
 kubectl-cluster_compare:
-	@echo "Downloading $@"
-	curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v kubectl-cluster_compare > /dev/null 2>&1 || { \
+		echo "kubectl-cluster_compare tool isn't installed; Downloading $@"; \
+		curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} kubectl-cluster_compare; \
+		rm -f $@.tgz; \
+	}
 
 helm-convert:
-	@echo "Downloading $@"
-	curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v helm-convert > /dev/null 2>&1 || { \
+		echo "helm-convert isn't installed; Downloading $@"; \
+		curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} helm-convert; \
+		rm -f $@.tgz; \
+	}
path: telco-ran/configuration/kube-compare-reference/Makefile
user: login: imiller0
body: There was a similar need for kube-compare and helm in the Core reference comparison. In PR #51 we worked to ensure that this was available through the CI image rather than pulling dynamically. I suspect it is already there so the curl won't be run in this case. Please convert this to a message to the user on downloading and installing it themselves rather than pulling automatically similar to what is done on the core side.
created_at: 2025-05-15T14:57:51Z
author_association: COLLABORATOR
diff_hunk: @@ -39,15 +44,17 @@ clean:
 convert: helm-convert helm
 	@echo "Converting reference files to Helm Charts."
 	@rm -rf Chartv1 renderedv1
-	@./helm-convert -r ./metadata.yaml -n Chartv1 -v default_value.yaml
+	@helm-convert -r ./metadata.yaml -n Chartv1 -v default_value.yaml
 	@echo "Rendering Helm Charts to CR files."
-	@./helm template renderedv1 ./Chartv1 --output-dir renderedv1
+	@helm template renderedv1 ./Chartv1 --output-dir renderedv1
 
 helm:
-	@echo "Installing helm..."
-	curl -fsSL $(HELM_URL) -o $(HELM_PKG)
-	tar -zxvf $(HELM_PKG) linux-amd64/helm --strip-components 1
-	rm -f $(HELM_PKG)
+	@command -v helm > /dev/null 2>&1 || { \
+		echo "Installing helm..."; \
+		curl -fsSL $(HELM_URL) -o $(HELM_PKG); \
+		tar -zxvf $(HELM_PKG) -C ${BIN_PATH} linux-amd64/helm --strip-components 1; \
+		rm -f $(HELM_PKG); \
+	}
path: telco-ran/configuration/kube-compare-reference/Makefile
user: login: imiller0
body: Same as above
created_at: 2025-05-15T14:58:38Z
author_association: COLLABORATOR
diff_hunk: @@ -2,21 +2,26 @@ CLUSTER_COMPARE_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/ope
 HELM_CONVERT_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_addon_tools_linux_amd64")) | .browser_download_url')
 HELM_URL := https://get.helm.sh/helm-v3.16.1-linux-amd64.tar.gz
 HELM_PKG := helm-linux-amd64.tar.gz
+BIN_PATH := ~/.local/bin
 
 .PHONY: check
 check: metadata_lint compare
 
 kubectl-cluster_compare:
-	@echo "Downloading $@"
-	curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v kubectl-cluster_compare > /dev/null 2>&1 || { \
+		echo "kubectl-cluster_compare tool isn't installed; Downloading $@"; \
+		curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} kubectl-cluster_compare; \
+		rm -f $@.tgz; \
+	}
 
 helm-convert:
-	@echo "Downloading $@"
-	curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v helm-convert > /dev/null 2>&1 || { \
+		echo "helm-convert isn't installed; Downloading $@"; \
+		curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} helm-convert; \
+		rm -f $@.tgz; \
+	}
path: telco-ran/configuration/kube-compare-reference/Makefile
user: login: abraham2512
body: Yes, we already have enabled helm and helm-convert in the CI image in PR
[cluster-compare tools for telco-ran](https://github.com/openshift/release/pull/62113/files), so the curl will not be run in the CI case.
created_at: 2025-05-15T15:38:12Z
author_association: MEMBER
diff_hunk: @@ -2,21 +2,26 @@ CLUSTER_COMPARE_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/ope
 HELM_CONVERT_DOWNLOAD_URL := $(shell curl -s https://api.github.com/repos/openshift/kube-compare/releases/latest | jq -r '.assets[] | select(.name? | match("kube-compare_addon_tools_linux_amd64")) | .browser_download_url')
 HELM_URL := https://get.helm.sh/helm-v3.16.1-linux-amd64.tar.gz
 HELM_PKG := helm-linux-amd64.tar.gz
+BIN_PATH := ~/.local/bin
 
 .PHONY: check
 check: metadata_lint compare
 
 kubectl-cluster_compare:
-	@echo "Downloading $@"
-	curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v kubectl-cluster_compare > /dev/null 2>&1 || { \
+		echo "kubectl-cluster_compare tool isn't installed; Downloading $@"; \
+		curl -sL $(CLUSTER_COMPARE_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} kubectl-cluster_compare; \
+		rm -f $@.tgz; \
+	}
 
 helm-convert:
-	@echo "Downloading $@"
-	curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz
-	tar zxvf $@.tgz $@
-	rm -f $@.tgz
+	@command -v helm-convert > /dev/null 2>&1 || { \
+		echo "helm-convert isn't installed; Downloading $@"; \
+		curl -sL $(HELM_CONVERT_DOWNLOAD_URL) -o $@.tgz; \
+		tar zxvf $@.tgz -C ${BIN_PATH} helm-convert; \
+		rm -f $@.tgz; \
+	}
path: telco-ran/configuration/kube-compare-reference/Makefile
user: login: abraham2512
body: I decided to keep it in for backwards compatibility with local make. I am okay to remove and simply add a comment about its setup as well, similar to [core](https://github.com/openshift-kni/telco-reference/blob/5b01e033c701b90df0ae13598d3eaaa988f97d77/telco-core/configuration/Makefile#L9)
created_at: 2025-05-15T15:41:58Z
author_association: MEMBER

PR comments:
user: login: openshift-ci-robot
created_at: 2025-04-30T19:09:03Z
body: @abraham2512: This pull request references CNF-17491 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set.

<details>

In response to [this](https://github.com/openshift-kni/telco-reference/pull/156):

>This MR enables kube-compare-reference ci check for telco-ran directory


Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift-kni%2Ftelco-reference).  If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
</details>
author_association: COLLABORATOR
user: login: abraham2512
created_at: 2025-05-03T00:02:35Z
body: /retest
author_association: MEMBER
user: login: abraham2512
created_at: 2025-05-06T17:07:27Z
body: /retest
author_association: MEMBER
user: login: abraham2512
created_at: 2025-05-06T20:35:26Z
body: /retest
author_association: MEMBER
user: login: abraham2512
created_at: 2025-05-07T18:33:36Z
body: /retest
author_association: MEMBER
user: login: lack
created_at: 2025-05-14T13:10:18Z
body: /lgtm
author_association: MEMBER
user: login: abraham2512
created_at: 2025-05-14T17:05:13Z
body: /retest
author_association: MEMBER
user: login: irinamihai
created_at: 2025-05-14T23:45:41Z
body: /lgtm
author_association: CONTRIBUTOR
user: login: abraham2512
created_at: 2025-05-16T18:21:21Z
body: Removed curls, updated makefile with messages 
can you add lgtm/approve once more @irinamihai @imiller0 
Thank you
author_association: MEMBER
user: login: irinamihai
created_at: 2025-05-16T19:24:55Z
body: /lgtm
/approve
author_association: CONTRIBUTOR
user: login: openshift-ci[bot]
created_at: 2025-05-16T19:25:02Z
body: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/openshift-kni/telco-reference/pull/156#" title="Author self-approved">abraham2512</a>*, *<a href="https://github.com/openshift-kni/telco-reference/pull/156#issuecomment-2887513829" title="Approved">irinamihai</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=openshift-kni%2Ftelco-reference).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/openshift-kni/telco-reference/blob/main/OWNERS)~~ [irinamihai]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
author_association: NONE