From c77c26d8e0e41f325fb85494ef9cc12404d22b97 Mon Sep 17 00:00:00 2001 From: Simon Beck Date: Tue, 5 Sep 2023 11:12:23 +0200 Subject: [PATCH] Fixes for make targets concerning the release flow --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 13 +++++++------ Makefile | 2 ++ Makefile.vars.mk | 3 ++- package/package.mk | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index badc429..0f657db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,4 +27,4 @@ jobs: ${{ runner.os }}-go- - name: Run build - run: make build + run: make build -e IMG_TAG=${GITHUB_REF##*/} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbd4a71..e966597 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,12 +33,13 @@ jobs: restore-keys: | ${{ runner.os }}-go- - - name: Login to Upbound - uses: docker/login-action@v2 - with: - registry: xpkg.upbound.io - username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} - password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} + # We currently don't have upbound credentials for this repo + # - name: Login to Upbound + # uses: docker/login-action@v2 + # with: + # registry: xpkg.upbound.io + # username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }} + # password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }} - name: Login to ghcr.io uses: docker/login-action@v2 diff --git a/Makefile b/Makefile index c6647b8..1ac953c 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,8 @@ build-bin: fmt vet ## Build binary .PHONY: build-docker build-docker: build-bin ## Build docker image + env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ + go build -o ${BIN_FILENAME} $(DOCKER_CMD) build -t $(CONTAINER_IMG) . .PHONY: test diff --git a/Makefile.vars.mk b/Makefile.vars.mk index 72ae9b8..5a97da0 100644 --- a/Makefile.vars.mk +++ b/Makefile.vars.mk @@ -17,7 +17,8 @@ DOCKER_CMD ?= docker CONTAINER_REGISTRY ?= ghcr.io UPBOUND_CONTAINER_REGISTRY ?= xpkg.upbound.io -IMG_TAG ?= latest +GIT_TAG = $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match) +IMG_TAG = $(subst /,_,$(GIT_TAG)) # Image URL to use all building/pushing image targets CONTAINER_IMG ?= $(CONTAINER_REGISTRY)/$(PROJECT_OWNER)/$(PROJECT_NAME)/controller:$(IMG_TAG) LOCAL_PACKAGE_IMG = localhost:5000/$(PROJECT_OWNER)/$(PROJECT_NAME)/package:$(IMG_TAG) diff --git a/package/package.mk b/package/package.mk index a167a06..3a3b1be 100644 --- a/package/package.mk +++ b/package/package.mk @@ -33,7 +33,7 @@ package-provider-local: $(crossplane_bin) generate ## Build Crossplane package f .PHONY: package-provider package-provider: export CONTROLLER_IMG = $(CONTAINER_IMG) -package-provider: $(up_bin) generate-go build-docker ## Build Crossplane package for Upbound Marketplace +package-provider: $(up_bin) generate build-docker ## Build Crossplane package for Upbound Marketplace @rm -rf package/*.xpkg @yq e 'del(.spec)' $(package_dir)/crossplane.yaml.template > $(package_dir)/crossplane.yaml $(up_bin) xpkg build -f $(package_dir) -o $(package_dir)/provider-minio.xpkg --controller=$(CONTROLLER_IMG)