diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 755af957..70f65bb9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -13,7 +13,7 @@ on: jobs: lint: name: Lint - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Set up Go uses: actions/setup-go@v2 @@ -34,7 +34,7 @@ jobs: unit: name: Unit Test - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Set up Go uses: actions/setup-go@v2 @@ -88,7 +88,7 @@ jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Set up Go 1.x uses: actions/setup-go@v2 @@ -118,7 +118,7 @@ jobs: if: ${{ startsWith(github.ref, 'refs/heads/release-') }} run: | export BASE_VERSION=$(cat version.txt) - export VERSION=$BASE_VERSION-$(date +'%Y%m%d%H%M') + export VERSION=$BASE_VERSION-$(TARGETARCHdate +'%Y%m%d%H%M') echo $VERSION > VERSION - name: Build Images diff --git a/Dockerfile b/Dockerfile index 32c37bd9..d9eb24d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=${BUILDPLATFORM} golang:1.21 as builder +FROM --platform=linux/amd64 golang:1.21 as builder ARG TARGETOS ARG TARGETARCH diff --git a/Makefile b/Makefile index 0453fb47..cb7c92eb 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ OUTPUT_INSTALL_EXE_DIR := $(BUILD_DIR)/install-exe # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) VERSION ?= 3.0.1 +OS ?= linux +ARCH ?= amd64 +PLATFORM ?= ${OS}/${ARCH} + # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") # To re-generate a bundle for other specific channels without changing the standard setup, you can: @@ -107,14 +111,14 @@ run: manifests generate fmt vet ## Run a controller from your host. go run ./main.go docker-build: ## Build docker image with the manager. - docker build -t ${IMG} . + docker build --platform=$(PLATFORM) -t ${IMG} . docker-push: ## Push docker image with the manager. docker push ${IMG} .PHONY: docker-buildx docker-buildx: test ## Build and push docker image for the manager for cross-platform support - docker buildx build --push --platform=$(PLATFORMS) --tag $(IMG) . + docker buildx build --push --platform=$(PLATFORM) --tag $(IMG) . ##@ Deployment