From 4084a5d3113a0d16429aa5767508012b744707da Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 14:42:57 -0600 Subject: [PATCH 1/7] chore: Set GHA to self-hosted runners. --- .github/workflows/ci.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 85f8ac33..19144f74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,9 @@ on: # jobs to run jobs: build: - runs-on: ubuntu-latest + runs-on: + - self-hosted + - large steps: - name: Set up Go 1.21 uses: actions/setup-go@v2 @@ -67,7 +69,9 @@ jobs: run: sudo make test-e2e publish: name: Publish docker image - runs-on: ubuntu-latest + runs-on: + - self-hosted + - large needs: build if: github.event_name == 'release' && github.event.action == 'created' steps: From 3b29dc261ca40588a4acdd226f354a2d4addccbb Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 14:50:49 -0600 Subject: [PATCH 2/7] chore: Remove ALT_REPO and APP_ALTREPO references where image tags get copied. --- Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Makefile b/Makefile index 9dfa48a1..f4e83914 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,6 @@ APP_NAME=zookeeper REPO=mesosphere/$(PROJECT_NAME) TEST_REPO=testzkop/$(PROJECT_NAME) APP_REPO=pravega/$(APP_NAME) -ALTREPO=emccorp/$(PROJECT_NAME) -APP_ALTREPO=emccorp/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/") GIT_SHA=$(shell git rev-parse --short HEAD) TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION) @@ -174,14 +172,6 @@ push: build-image build-zk-image login docker push $(REPO):latest docker push $(APP_REPO):$(VERSION) docker push $(APP_REPO):latest - docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION) - docker tag $(REPO):$(VERSION) $(ALTREPO):latest - docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION) - docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest - docker push $(ALTREPO):$(VERSION) - docker push $(ALTREPO):latest - docker push $(APP_ALTREPO):$(VERSION) - docker push $(APP_ALTREPO):latest clean: rm -f bin/$(PROJECT_NAME) From c32a111796b83ae0a57251805f9b86043dde6286 Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 15:23:48 -0600 Subject: [PATCH 3/7] chore: Set TEST_REPO and APP_REPO to mesosphere --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f4e83914..f57579d3 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ PROJECT_NAME=zookeeper-operator EXPORTER_NAME=zookeeper-exporter APP_NAME=zookeeper REPO=mesosphere/$(PROJECT_NAME) -TEST_REPO=testzkop/$(PROJECT_NAME) -APP_REPO=pravega/$(APP_NAME) +TEST_REPO=mesosphere/$(PROJECT_NAME) +APP_REPO=mesosphere/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/") GIT_SHA=$(shell git rev-parse --short HEAD) TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION) From 9e62ec23834d086d5c3a869c9c16ea47ecc4f4da Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 15:25:15 -0600 Subject: [PATCH 4/7] chore: Update TEST_IMAGE name to use tags instead. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f57579d3..269a3dd3 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ TEST_REPO=mesosphere/$(PROJECT_NAME) APP_REPO=mesosphere/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/") GIT_SHA=$(shell git rev-parse --short HEAD) -TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION) +TEST_IMAGE=$(TEST_REPO):testimages-$(VERSION) DOCKER_TEST_PASS=testzkop@123 DOCKER_TEST_USER=testzkop .PHONY: all build check clean test From 043479ab6dff2effc95db63fedcae5a74a3ac8cb Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 15:31:43 -0600 Subject: [PATCH 5/7] chore: Introduce Release registry, tag and push all images to release registry. --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 269a3dd3..d038afe0 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ CRD_OPTIONS ?= "crd" PROJECT_NAME=zookeeper-operator EXPORTER_NAME=zookeeper-exporter APP_NAME=zookeeper +RELEASE_REGISTRY ?= ghcr.io REPO=mesosphere/$(PROJECT_NAME) TEST_REPO=mesosphere/$(PROJECT_NAME) APP_REPO=mesosphere/$(APP_NAME) @@ -128,17 +129,17 @@ build-go: -o bin/$(EXPORTER_NAME)-windows-amd64.exe cmd/exporter/main.go build-image: - docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(REPO):$(VERSION) . - docker tag $(REPO):$(VERSION) $(REPO):latest + docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(RELEASE_REGISTRY)/$(REPO):$(VERSION) . + docker tag $(RELEASE_REGISTRY)/$(REPO):$(VERSION) $(RELEASE_REGISTRY)/$(REPO):latest build-zk-image: - docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker - docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest + docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION) ./docker + docker tag $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION) $(RELEASE_REGISTRY)/$(APP_REPO):latest build-zk-image-swarm: docker build --build-arg VERSION=$(VERSION)-swarm --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) \ - -f ./docker/Dockerfile-swarm -t $(APP_REPO):$(VERSION)-swarm ./docker + -f ./docker/Dockerfile-swarm -t $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION)-swarm ./docker test: go test $$(go list ./... | grep -v /vendor/ | grep -v /test/e2e) -race -coverprofile=coverage.txt -covermode=atomic @@ -168,10 +169,10 @@ test-login: echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin push: build-image build-zk-image login - docker push $(REPO):$(VERSION) - docker push $(REPO):latest - docker push $(APP_REPO):$(VERSION) - docker push $(APP_REPO):latest + docker push $(RELEASE_REGISTRY)/$(REPO):$(VERSION) + docker push $(RELEASE_REGISTRY)/$(REPO):latest + docker push $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION) + docker push $(RELEASE_REGISTRY)/$(APP_REPO):latest clean: rm -f bin/$(PROJECT_NAME) From 7ec481b81d912fc1ee4e1da73cd824f87d5a329f Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 15:37:48 -0600 Subject: [PATCH 6/7] chore: Add workflow dispatch for CI. --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 19144f74..d0958772 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,6 +3,7 @@ name: CI # on events on: + workflow_dispatch: push: branches: - master From ab895775ebfc1fcc0d01fa0fc1f8870a97e92c96 Mon Sep 17 00:00:00 2001 From: Kaiwalya Joshi Date: Mon, 8 Jan 2024 15:45:42 -0600 Subject: [PATCH 7/7] chore: Add CODEOWNERS file. Revert to ubuntu-latest. --- .github/CODEOWNERS | 3 +++ .github/workflows/ci.yaml | 20 ++++++++++++++------ Makefile | 9 ++++----- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..b7ad0f9b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# Reference: https://help.github.com/en/articles/about-code-owners +# Order is important: later rules override preceding rules +* @mesosphere/kommander diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d0958772..0327dbf3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,8 +18,7 @@ on: jobs: build: runs-on: - - self-hosted - - large + - ubuntu-latest steps: - name: Set up Go 1.21 uses: actions/setup-go@v2 @@ -38,8 +37,9 @@ jobs: run: make check - name: unit tests run: make test - - name: Codecov - uses: codecov/codecov-action@v1.0.12 + # This fails + # - name: Codecov + # uses: codecov/codecov-action@v1.0.12 - name: Set env run: | echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV @@ -70,12 +70,20 @@ jobs: run: sudo make test-e2e publish: name: Publish docker image + permissions: + contents: read + packages: write runs-on: - - self-hosted - - large + - ubuntu-latest needs: build if: github.event_name == 'release' && github.event.action == 'created' steps: + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Pushing docker images run: sudo make push - name: Uploading binary files diff --git a/Makefile b/Makefile index d038afe0..0ede5ca3 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,11 @@ EXPORTER_NAME=zookeeper-exporter APP_NAME=zookeeper RELEASE_REGISTRY ?= ghcr.io REPO=mesosphere/$(PROJECT_NAME) -TEST_REPO=mesosphere/$(PROJECT_NAME) +TEST_REPO=testzkop/$(PROJECT_NAME) APP_REPO=mesosphere/$(APP_NAME) VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/") GIT_SHA=$(shell git rev-parse --short HEAD) -TEST_IMAGE=$(TEST_REPO):testimages-$(VERSION) +TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION) DOCKER_TEST_PASS=testzkop@123 DOCKER_TEST_USER=testzkop .PHONY: all build check clean test @@ -48,7 +48,6 @@ deploy: manifests kustomize cd config/manager && $(KUSTOMIZE) edit set image pravega/zookeeper-operator=$(TEST_IMAGE) $(KUSTOMIZE) build config/default | kubectl apply -f - - # Deploy controller in the configured Kubernetes cluster in ~/.kube/config deploy-test: manifests kustomize cd config/test @@ -106,7 +105,7 @@ generate: echo '{{- end }}' >> charts/zookeeper-operator/templates/zookeeper.pravega.io_zookeeperclusters_crd.yaml -build: test build-go build-image +build: test build-go build-image build-zk-image build-go: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ @@ -168,7 +167,7 @@ login: test-login: echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin -push: build-image build-zk-image login +push: build-image build-zk-image docker push $(RELEASE_REGISTRY)/$(REPO):$(VERSION) docker push $(RELEASE_REGISTRY)/$(REPO):latest docker push $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION)