Skip to content

Commit 5424a87

Browse files
authored
fix: use the correct version format (#143)
The Kubernetes `k8s.io/component-base/version` package requires the `gitVersion` variable to be valid `vX.Y.Z` SemVer. Updated the version in the `Makefile` to be compatible. Also updated a few `Makefile` target names.
1 parent 3357e13 commit 5424a87

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.github/workflows/build-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v5
1515

1616
- name: Build Container Image
17-
run: make image-build
17+
run: make build
1818

1919
- name: Run Tests
2020
run: make test

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION ?= 0.1.0-$(GIT_COMMIT_SHORT)
1+
VERSION ?= v0.1.0
22
GO_CONTAINER_IMAGE ?= docker.io/golang:1.25.3
33

44
CONTAINER_RUNTIME ?= $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
@@ -11,7 +11,7 @@ GIT_COMMIT_SHORT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unkn
1111
# Container image configuration.
1212
IMAGE_REGISTRY ?= ghcr.io/oxidecomputer
1313
IMAGE_NAME ?= oxide-cloud-controller-manager
14-
IMAGE_TAG ?= $(VERSION)
14+
IMAGE_TAG ?= $(patsubst v%,%,$(VERSION))-$(GIT_COMMIT_SHORT)
1515
IMAGE_FULL ?= $(if $(IMAGE_REGISTRY),$(IMAGE_REGISTRY)/)$(IMAGE_NAME):$(IMAGE_TAG)
1616

1717
.PHONY: test
@@ -25,17 +25,17 @@ test:
2525
.
2626
$(CONTAINER_RUNTIME) run --rm $(IMAGE_NAME)-builder:$(IMAGE_TAG) go test -v ./...
2727

28-
.PHONY: image-build
29-
image-build:
28+
.PHONY: build
29+
build:
3030
@echo "Building container image: $(IMAGE_FULL)"
3131
$(CONTAINER_RUNTIME) build \
3232
--build-arg GO_CONTAINER_IMAGE=$(GO_CONTAINER_IMAGE) \
3333
--build-arg VERSION=$(VERSION) \
3434
-t $(IMAGE_FULL) \
3535
.
3636

37-
.PHONY: image-push
38-
image-push:
37+
.PHONY: push
38+
push:
3939
@if [ -z "$(IMAGE_REGISTRY)" ]; then \
4040
echo "Error: IMAGE_REGISTRY must be set to push images"; \
4141
echo "Example: make image-push IMAGE_REGISTRY=ghcr.io/oxidecomputer"; \

0 commit comments

Comments
 (0)