-
Notifications
You must be signed in to change notification settings - Fork 13
Add Makefile with containerized builds #80
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
Open
empovit
wants to merge
1
commit into
rh-ecosystem-edge:main
Choose a base branch
from
empovit:add-makefile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| FROM registry.access.redhat.com/ubi9/nodejs-20:latest | ||
| USER root | ||
| RUN npm i -g yarn | ||
| WORKDIR /workspace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| .PHONY: help build-dev-image build lint type-check i18n clean update-lockfile \ | ||
| build-image push-image helm-lint deploy undeploy | ||
|
|
||
| # Configuration | ||
| REGISTRY ?= quay.io/edge-infrastructure | ||
| IMAGE_NAME ?= console-plugin-nvidia-gpu | ||
| IMAGE_TAG ?= $(shell git rev-parse --short HEAD) | ||
| NAMESPACE ?= nvidia-gpu-operator | ||
| RELEASE_NAME ?= console-plugin-nvidia-gpu | ||
|
|
||
| # Container runtime (podman preferred, falls back to docker) | ||
| CONTAINER_TOOL ?= $(shell command -v podman 2>/dev/null || echo docker) | ||
| DEV_IMAGE ?= $(IMAGE_NAME)-dev | ||
|
|
||
| # Colors for output | ||
| BLUE := \033[36m | ||
| GREEN := \033[32m | ||
| YELLOW := \033[33m | ||
| RESET := \033[0m | ||
|
|
||
| # All JS/TS targets run inside a container (no Node.js required on host). | ||
| # Run 'make build-dev-image' once before using other targets. | ||
| # For hot-reload development, use: yarn start (requires Node.js on host) | ||
|
|
||
| help: ## Show this help | ||
| @echo "$(BLUE)Available targets:$(RESET)" | ||
| @echo "" | ||
| @echo "$(YELLOW)Development (containerized - no Node.js required):$(RESET)" | ||
| @grep -E '^(build-dev-image|build|lint|type-check|i18n|clean|update-lockfile):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(BLUE)%-18s$(RESET) %s\n", $$1, $$2}' | ||
| @echo "" | ||
| @echo "$(YELLOW)Container Image:$(RESET)" | ||
| @grep -E '^(build-image|push-image):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(BLUE)%-18s$(RESET) %s\n", $$1, $$2}' | ||
| @echo "" | ||
| @echo "$(YELLOW)Helm:$(RESET)" | ||
| @grep -E '^(helm-lint|deploy|undeploy):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " $(BLUE)%-18s$(RESET) %s\n", $$1, $$2}' | ||
| @echo "" | ||
| @echo "$(YELLOW)Variables:$(RESET)" | ||
| @echo " IMAGE_TAG=$(IMAGE_TAG) (default: git commit hash)" | ||
| @echo " NAMESPACE=$(NAMESPACE)" | ||
| @echo "" | ||
| @echo "$(YELLOW)Examples:$(RESET)" | ||
| @echo " make build-dev-image # Run once to create dev container" | ||
| @echo " make build-image IMAGE_TAG=0.3.0" | ||
| @echo " make deploy NAMESPACE=my-namespace" | ||
|
|
||
| ##@ Development (containerized) | ||
|
|
||
| build-dev-image: ## Build the dev container image (run once) | ||
| @echo "$(GREEN)Building dev image: $(DEV_IMAGE)...$(RESET)" | ||
| $(CONTAINER_TOOL) build -t $(DEV_IMAGE) -f Dockerfile.dev . | ||
| @echo "$(GREEN)✓ Dev image ready. Run 'make build', 'make lint', etc.$(RESET)" | ||
|
|
||
| build: ## Build plugin for production | ||
| @echo "$(GREEN)Building plugin (containerized)...$(RESET)" | ||
| @$(CONTAINER_TOOL) run --rm \ | ||
| -v "$(CURDIR):/workspace:z" \ | ||
| -w /workspace \ | ||
| $(DEV_IMAGE) \ | ||
| sh -c "yarn install --frozen-lockfile && yarn build" | ||
|
|
||
| lint: ## Lint the code | ||
| @echo "$(GREEN)Linting code (containerized)...$(RESET)" | ||
| @$(CONTAINER_TOOL) run --rm \ | ||
| -v "$(CURDIR):/workspace:z" \ | ||
| -w /workspace \ | ||
| $(DEV_IMAGE) \ | ||
| sh -c "yarn install --frozen-lockfile && yarn lint" | ||
|
|
||
| type-check: ## Check TypeScript types | ||
| @echo "$(GREEN)Type checking (containerized)...$(RESET)" | ||
| @$(CONTAINER_TOOL) run --rm \ | ||
| -v "$(CURDIR):/workspace:z" \ | ||
| -w /workspace \ | ||
| $(DEV_IMAGE) \ | ||
| sh -c "yarn install --frozen-lockfile && yarn type-check" | ||
|
|
||
| i18n: ## Generate i18n translations | ||
| @echo "$(GREEN)Generating i18n (containerized)...$(RESET)" | ||
| @$(CONTAINER_TOOL) run --rm \ | ||
| -v "$(CURDIR):/workspace:z" \ | ||
| -w /workspace \ | ||
| $(DEV_IMAGE) \ | ||
| sh -c "yarn install --frozen-lockfile && yarn i18n" | ||
|
|
||
| clean: ## Clean build artifacts | ||
| @echo "$(GREEN)Cleaning build artifacts...$(RESET)" | ||
| rm -rf dist/ *.tgz | ||
|
|
||
| update-lockfile: ## Regenerate yarn.lock | ||
| @echo "$(GREEN)Regenerating yarn.lock (containerized)...$(RESET)" | ||
| @$(CONTAINER_TOOL) run --rm \ | ||
| -v "$(CURDIR):/workspace:z" \ | ||
| -w /workspace \ | ||
| --user root \ | ||
| $(DEV_IMAGE) \ | ||
| sh -c "rm -f yarn.lock && yarn install --ignore-engines && chown $(shell id -u):$(shell id -g) yarn.lock" | ||
| @echo "$(GREEN)✓ yarn.lock regenerated$(RESET)" | ||
|
|
||
| ##@ Container Image | ||
|
|
||
| build-image: ## Build container image | ||
| @echo "$(GREEN)Building image: $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)$(RESET)" | ||
| $(CONTAINER_TOOL) build -t $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG) . | ||
|
|
||
| push-image: build-image ## Build and push container image | ||
| @echo "$(GREEN)Pushing image: $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)$(RESET)" | ||
| $(CONTAINER_TOOL) push $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG) | ||
| @echo "$(GREEN)✓ Pushed: $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_TAG)$(RESET)" | ||
|
|
||
| ##@ Helm | ||
|
|
||
| helm-lint: ## Lint the Helm chart | ||
| @echo "$(GREEN)Linting Helm chart...$(RESET)" | ||
| helm lint deployment/$(RELEASE_NAME) | ||
|
|
||
| deploy: ## Deploy plugin to cluster (install or upgrade) | ||
| @echo "$(GREEN)Deploying plugin...$(RESET)" | ||
| helm upgrade --install -n $(NAMESPACE) $(RELEASE_NAME) \ | ||
| --set image.repository=$(REGISTRY)/$(IMAGE_NAME) \ | ||
| --set image.tag=$(IMAGE_TAG) \ | ||
| ./deployment/$(RELEASE_NAME) | ||
| @echo "$(GREEN)✓ Deployed $(RELEASE_NAME)$(RESET)" | ||
|
|
||
| undeploy: ## Remove plugin from cluster | ||
| @echo "$(GREEN)Removing $(RELEASE_NAME)...$(RESET)" | ||
| helm uninstall -n $(NAMESPACE) $(RELEASE_NAME) | ||
| @echo "$(GREEN)✓ Removed $(RELEASE_NAME)$(RESET)" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: rh-ecosystem-edge/console-plugin-nvidia-gpu
Length of output: 864
🏁 Script executed:
Repository: rh-ecosystem-edge/console-plugin-nvidia-gpu
Length of output: 119
🌐 Web query:
helm upgrade --install --create-namespace flag documentation💡 Result:
The --create-namespace flag (helm upgrade) tells Helm to create the target release namespace if it does not exist — but it only takes effect when used together with --install (i.e., when upgrade will install if release is missing). Example: helm upgrade --install my-release ./chart --namespace my-ns --create-namespace. Source: Helm docs (upgrade command) and Helm FAQ. [1][2]
Sources
Add
--create-namespaceto support fresh cluster deployments.helm upgrade --installfails if the target namespace doesn't exist. Add--create-namespaceto automatically create the namespace on first deploy.✅ Suggested change
📝 Committable suggestion
🧰 Tools
🪛 checkmake (0.2.2)
[warning] 116-116: Target body for "deploy" exceeds allowed length of 5 (6).
(maxbodylength)
🤖 Prompt for AI Agents