From 915e4d3587d21f6d92d4c9c5bff4179cde6db341 Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Thu, 8 Feb 2024 14:05:59 -0700 Subject: [PATCH 1/6] change to self hosted --- .github/workflows/cicd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 755af957..fc057dfc 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 From 951885458315a87a2dc8180339af2f62f5054468 Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 20 Feb 2024 13:43:48 -0700 Subject: [PATCH 2/6] change to use docker-buildx for linux platfrom --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index fc057dfc..0594f7ca 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -125,7 +125,7 @@ jobs: run: | export VERSION=$(cat VERSION) echo $VERSION - make docker-build + make docker-buildx - name: Push to DockerHub if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }} From 8c7352336108f47b77626725668e886f257cb1cf Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 20 Feb 2024 13:56:51 -0700 Subject: [PATCH 3/6] fix makefile --- .github/workflows/cicd.yml | 2 +- Makefile | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 0594f7ca..fc057dfc 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -125,7 +125,7 @@ jobs: run: | export VERSION=$(cat VERSION) echo $VERSION - make docker-buildx + make docker-build - name: Push to DockerHub if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-') }} 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 From 3902a33f0cacf7a64793c4ce9dbfa5471ce3bf4d Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 20 Feb 2024 14:19:36 -0700 Subject: [PATCH 4/6] making changes to dockeerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 32c37bd9..4aaafafb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=${BUILDPLATFORM} golang:1.21 as builder +FROM --platform=${PLATFORM} golang:1.21 as builder ARG TARGETOS ARG TARGETARCH From 6534a025cd6081911c9c1a9ec47e4a8df042a828 Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 20 Feb 2024 14:53:42 -0700 Subject: [PATCH 5/6] trying things --- .github/workflows/cicd.yml | 2 +- Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index fc057dfc..70f65bb9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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 4aaafafb..baf82d17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM --platform=${PLATFORM} golang:1.21 as builder +FROM --platform=linux/amd64 golang:1.21 as builder ARG TARGETOS ARG TARGETARCH @@ -15,7 +15,7 @@ RUN go mod download COPY . . # Build -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${} go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details From 9053f81315e9a605b383483a8ce6fdfd2e25286f Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Tue, 20 Feb 2024 14:57:56 -0700 Subject: [PATCH 6/6] oopsies --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index baf82d17..d9eb24d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN go mod download COPY . . # Build -RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${} go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details