From 9bfec6c19bc4f19d8e941f8810d1d6d380448b6d Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:24:09 +0300 Subject: [PATCH 01/53] chore: remove appsflyer internal references --- Makefile | 14 +++++++------- charts/local-pvc-releaser/README.md | 2 +- config/manager/kustomization.yaml | 2 +- index.yaml | 16 ---------------- 4 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 index.yaml diff --git a/Makefile b/Makefile index ec1605e..85c265c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Image URL to use all building/pushing image targets TAG ?= $(shell if [ -z "${CI_COMMIT_TAG}" ]; then echo "latest"; else echo ${CI_COMMIT_TAG}; fi) -REGISTRY ?= "" -IMG ?= "${REGISTRY}/local-pvc-releaser:${TAG}" +IMG ?= "local-pvc-releaser" +IMAGE = "${IMG}:${TAG}" #GIT GIT_URL ?= "github.com/appsflyer/local-pvc-releaser" @@ -97,11 +97,11 @@ run: manifests generate fmt vet ## Run a controller from your host. # TODO: Enable test again #docker-build: test ## Build docker image with the manager. docker-build: ## Build docker image with the manager. - docker build -t ${IMG} . + docker build -t ${IMAGE} . .PHONY: docker-push docker-push: ## Push docker image with the manager. - docker push ${IMG} + docker push ${IMAGE} # PLATFORMS defines the target platforms for the manager image be build to provide support to multiple # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: @@ -115,7 +115,7 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - docker buildx create --name project-v3-builder docker buildx use project-v3-builder - - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . + - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMAGE} -f Dockerfile.cross . - docker buildx rm project-v3-builder rm Dockerfile.cross @@ -135,7 +135,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified .PHONY: deploy deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} + cd config/manager && $(KUSTOMIZE) edit set image controller=${IMAGE} $(KUSTOMIZE) build config/default | kubectl apply -f - .PHONY: undeploy @@ -144,7 +144,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi DEPLOY_FILE ?= "local-pvc-releaser.yml" deploy-yml: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. - cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} + cd config/manager && $(KUSTOMIZE) edit set image controller=${IMAGE} $(KUSTOMIZE) build config/default > ${DEPLOY_FILE} ##@ Build Dependencies diff --git a/charts/local-pvc-releaser/README.md b/charts/local-pvc-releaser/README.md index 5c0a017..e00db28 100644 --- a/charts/local-pvc-releaser/README.md +++ b/charts/local-pvc-releaser/README.md @@ -28,7 +28,7 @@ default values. |----------------------------------------------------------|-----------------------------------------------------------|------------------------------------------------------------------| | `controller.name` | Number of replicas for the controller | `local-pvc-releaser` | | `controller.replicas` | Name of the controller pod | `1` | -| `controller,image.repository` | Local PVC releaser repository name | `packages.af-eng.io/docker/realtime-platform/local-pvc-releaser` | +| `controller,image.repository` | Local PVC releaser repository name | `appsflyer/local-pvc-releaser` | | `controller.image.tag` | Local PVC releaser image tag | `v0.1.0` | | `controller.image.pullPolicy` | Image pull policy | `Always` | | `controller.resources` | Local PVC Releaser resource requests & limits | `{}` | diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index e59ed18..a615dbd 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: packages.af-eng.io/docker/realtime-platform/local-pvc-releaser + newName: appsflyer/local-pvc-releaser newTag: devtag diff --git a/index.yaml b/index.yaml deleted file mode 100644 index ddd91d8..0000000 --- a/index.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -entries: - local-pvc-releaser: - - apiVersion: v2 - appVersion: v0.1.0 - created: "2023-09-06T14:37:07.253198+03:00" - description: The local PVC releaser aim to delete persistent volume claims triggered - by un-expected node deletion events by the K8s node-controller for making automatic - recovery for pods. - digest: f383d8c3b023228b7d9d02aea15764144d5a53a39e30f4b9267b890e85648fbd - name: local-pvc-releaser - type: application - urls: - - https://gitlab.appsflyer.com/real-time-platform/controllers/local-pvc-releaser/charts/local-pvc-releaser-0.1.0.tgz - version: 0.1.0 -generated: "2023-09-06T14:37:07.251453+03:00" From 12432dcd093d509ef8d9066821f9438387143907 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:27:17 +0300 Subject: [PATCH 02/53] ci(lint): add go lint --- .github/workflows/golang_linter.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/golang_linter.yml diff --git a/.github/workflows/golang_linter.yml b/.github/workflows/golang_linter.yml new file mode 100644 index 0000000..02c8101 --- /dev/null +++ b/.github/workflows/golang_linter.yml @@ -0,0 +1,52 @@ +name: Go Linter + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + - name: Lint + uses: golangci/golangci-lint-action@v3 + # continue-on-error: true + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.54.2 + + # Optional: working directory, useful for monorepos + # TODO: remove before release + working-directory: internal + + # Optional: golangci-lint command line arguments. + args: + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true then the action don't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. + # skip-build-cache: true From 1794498a797f4c3f264ea7686965eada23926fad Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:27:42 +0300 Subject: [PATCH 03/53] ci(vet): add golang vet --- .github/workflows/golang_unit_test.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/golang_unit_test.yml diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml new file mode 100644 index 0000000..9a3a560 --- /dev/null +++ b/.github/workflows/golang_unit_test.yml @@ -0,0 +1,27 @@ +name: Go Unit Test + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + vet: + name: vet + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + - name: Vet + run: | + go vet ./... From 4b03ee71e1d3e44ba714661ba002f01d64da2bb1 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:28:00 +0300 Subject: [PATCH 04/53] ci(fmt): add golang fmt --- .github/workflows/golang_unit_test.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index 9a3a560..e58757d 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -24,4 +24,17 @@ jobs: go-version-file: './go.mod' - name: Vet run: | - go vet ./... + + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + - name: Vet + run: | + go fmt ./... From a116018571643436752dda66921ddaae80c79dd3 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:29:16 +0300 Subject: [PATCH 05/53] ci(unit): add unit tests --- .github/workflows/golang_unit_test.yml | 51 ++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index e58757d..c31bc77 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -24,6 +24,7 @@ jobs: go-version-file: './go.mod' - name: Vet run: | + go vet ./... fmt: name: fmt @@ -38,3 +39,53 @@ jobs: - name: Vet run: | go fmt ./... + + unit-test: + name: unit-test + needs: ["fmt", "vet"] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + # - name: Download envtest setup script + # run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh + + # - name: Make the script executable + # run: chmod +x setup-envtest.sh + + # - name: Setup envtest + # run: ./setup-envtest.sh + + # - name: Install Controller-gen + # run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0 + + # - name: Install Kustomize + # run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash + + - name: run unit tests + run: make unit-test + - uses: actions/upload-artifact@v3 + with: + name: unit_coverage_report + path: unit-test-cover.out + + coverage: + name: Coverage report + runs-on: ubuntu-latest + needs: unit-test + steps: + - uses: actions/download-artifact@v3 + with: + name: unit_coverage_report + - uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: unit-test-cover.out + flags: unittests + fail_ci_if_error: true \ No newline at end of file diff --git a/Makefile b/Makefile index 85c265c..6c7dd90 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ integration-test: generate fmt vet envtest ## Run tests. .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile unit-cover.out ##@ Build From 98032b7e4f9f85af25f5daa32e6444682458a5cf Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:29:48 +0300 Subject: [PATCH 06/53] ci(integration): add integration tests --- .github/workflows/golang_integration_test.yml | 68 +++++++++++++++++++ Makefile | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/golang_integration_test.yml diff --git a/.github/workflows/golang_integration_test.yml b/.github/workflows/golang_integration_test.yml new file mode 100644 index 0000000..17285c2 --- /dev/null +++ b/.github/workflows/golang_integration_test.yml @@ -0,0 +1,68 @@ +name: Go Integration Test + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + integration-test: + name: integration-test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + # - name: Download envtest setup script + # run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh + + # - name: Make the script executable + # run: chmod +x setup-envtest.sh + + # - name: Setup envtest + # run: ./setup-envtest.sh + + # - name: Install Controller-gen + # run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0 + + # - name: Install Kustomize + # run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1.8.0 + with: + config: test/kind/config.yml + cluster_name: test-cluster + + - name: run integration tests + run: make integration-test + - uses: actions/upload-artifact@v3 + with: + name: integration_coverage_report + path: integration-test-cover.out + + coverage: + name: Coverage report + runs-on: ubuntu-latest + needs: integration-test + steps: + - uses: actions/download-artifact@v3 + with: + name: integration_coverage_report + - uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: integration-test-cover.out + flags: integrationtests + fail_ci_if_error: true \ No newline at end of file diff --git a/Makefile b/Makefile index 6c7dd90..af2881d 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ lint: $(GOLINT) .PHONY: integration-test integration-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile integration-cover.out .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. From d42e1e19840785a23df2fcb9d217722c35c1b71f Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:33:58 +0300 Subject: [PATCH 07/53] ci(codecov): fix report naming --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index af2881d..072c10d 100644 --- a/Makefile +++ b/Makefile @@ -74,12 +74,11 @@ lint: $(GOLINT) .PHONY: integration-test integration-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile integration-cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile $@-cover.out -covermode atomic; go tool cover -func $@-cover.out .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile unit-cover.out - + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile $@-cover.out -covermode atomic; go tool cover -func $@-cover.out ##@ Build .PHONY: build From d0cb6cad59664e158e5464036b91c374462e0804 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:34:22 +0300 Subject: [PATCH 08/53] ci(release): add buildx based release --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60dca8b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release +on: + release: + types: [created, published] + +jobs: + docker-buildx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: local-pvc-releaser + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Validate Docker meta + run: echo "Output is empty, failing!" && exit 1 + if: steps.meta.outputs.tags == '' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/arm64,linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From ad2a492078055f3d68b19deaac14501c0427ac62 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 15:36:28 +0300 Subject: [PATCH 09/53] ci(helm): add helm release action --- .github/workflows/release.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60dca8b..bc3d83c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,4 +41,26 @@ jobs: platforms: linux/arm64,linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + + helm-release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From 45ac629c2d25344502e6604d24393ef994f53901 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:02:47 +0300 Subject: [PATCH 10/53] fix: typo in ci step --- .github/workflows/golang_unit_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index c31bc77..b6419ca 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -36,7 +36,7 @@ jobs: uses: actions/setup-go@v4 with: go-version-file: './go.mod' - - name: Vet + - name: fmt run: | go fmt ./... From 5c9cc9b951ab9c895e49c2965abdafbeae80317c Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:07:25 +0300 Subject: [PATCH 11/53] ci(codecov): disable --- .github/workflows/golang_integration_test.yml | 30 +++++++++---------- .github/workflows/golang_unit_test.yml | 30 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/golang_integration_test.yml b/.github/workflows/golang_integration_test.yml index 17285c2..a33e9be 100644 --- a/.github/workflows/golang_integration_test.yml +++ b/.github/workflows/golang_integration_test.yml @@ -51,18 +51,18 @@ jobs: name: integration_coverage_report path: integration-test-cover.out - coverage: - name: Coverage report - runs-on: ubuntu-latest - needs: integration-test - steps: - - uses: actions/download-artifact@v3 - with: - name: integration_coverage_report - - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: integration-test-cover.out - flags: integrationtests - fail_ci_if_error: true \ No newline at end of file + # coverage: + # name: Coverage report + # runs-on: ubuntu-latest + # needs: integration-test + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: integration_coverage_report + # - uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: integration-test-cover.out + # flags: integrationtests + # fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index b6419ca..5bd66c6 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -74,18 +74,18 @@ jobs: name: unit_coverage_report path: unit-test-cover.out - coverage: - name: Coverage report - runs-on: ubuntu-latest - needs: unit-test - steps: - - uses: actions/download-artifact@v3 - with: - name: unit_coverage_report - - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: unit-test-cover.out - flags: unittests - fail_ci_if_error: true \ No newline at end of file + # coverage: + # name: Coverage report + # runs-on: ubuntu-latest + # needs: unit-test + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: unit_coverage_report + # - uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: unit-test-cover.out + # flags: unittests + # fail_ci_if_error: true \ No newline at end of file From a73b86d5b14a3fe9ad7a66502ec832ad7a6f1b48 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:14:49 +0300 Subject: [PATCH 12/53] ci(lint): add timeout argument --- .github/workflows/golang_linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golang_linter.yml b/.github/workflows/golang_linter.yml index 02c8101..a6c2a1d 100644 --- a/.github/workflows/golang_linter.yml +++ b/.github/workflows/golang_linter.yml @@ -36,7 +36,7 @@ jobs: working-directory: internal # Optional: golangci-lint command line arguments. - args: + args: --timeout=5m # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true From a83935ec513730e2bea3dbb015c5d2c0b18b2215 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 12:37:26 +0300 Subject: [PATCH 13/53] fix: cmd dir --- main.go => cmd/main.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main.go => cmd/main.go (100%) diff --git a/main.go b/cmd/main.go similarity index 100% rename from main.go rename to cmd/main.go From 2da3ac0e8f4e2238c1ed4c817ec8dafaf35d3d27 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 13:03:42 +0300 Subject: [PATCH 14/53] fix(ci): image name --- .github/workflows/release.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc3d83c..5e9aee6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: local-pvc-releaser + images: appsflyer/local-pvc-releaser tags: | type=ref,event=tag type=semver,pattern={{version}} diff --git a/Makefile b/Makefile index 072c10d..300094f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Image URL to use all building/pushing image targets TAG ?= $(shell if [ -z "${CI_COMMIT_TAG}" ]; then echo "latest"; else echo ${CI_COMMIT_TAG}; fi) -IMG ?= "local-pvc-releaser" +IMG ?= "appsflyer/local-pvc-releaser" IMAGE = "${IMG}:${TAG}" #GIT GIT_URL ?= "github.com/appsflyer/local-pvc-releaser" From 10c6b6381b116e1071c1a23d886ccd2ed27156b6 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 14:44:53 +0300 Subject: [PATCH 15/53] fix(ci): helm release workflow checkout depth --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e9aee6..df38f2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + with: + fetch-depth: 0 - name: Configure Git run: | From ff2f6fc6531bf29dde91535cd65397e233bfa3ad Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 15:04:46 +0300 Subject: [PATCH 16/53] fix(helm): initial version --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 77df2cb..f8476b5 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -8,4 +8,4 @@ type: application version: 0.0.0 # Application Version -appVersion: "v0.1.0" +appVersion: "v0.0.0-rc1" From 5e07d092d77a5c7002ca8c5c37c2a7caeaa0e13b Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 15:34:50 +0300 Subject: [PATCH 17/53] fix(ci): helm-release warning --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df38f2c..7c8be20 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,4 +64,5 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1.5.0 env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From de92dadf2bb0fef88f160f666919a71661c703a3 Mon Sep 17 00:00:00 2001 From: talasulin Date: Thu, 19 Oct 2023 12:16:44 +0300 Subject: [PATCH 18/53] testing chart release --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index f8476b5..95b8eca 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.0.0 +version: 0.1.0 # Application Version appVersion: "v0.0.0-rc1" From 31e659aed64f4ba76962f3fcbbb6ba1140aec529 Mon Sep 17 00:00:00 2001 From: talasulin Date: Thu, 19 Oct 2023 12:21:30 +0300 Subject: [PATCH 19/53] testing chart release --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 95b8eca..6bbf146 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.1.0 +version: 0.2.0 # Application Version appVersion: "v0.0.0-rc1" From 7c220dfff111c09832c0fecdd71b2cd502d01a94 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 09:54:26 +0300 Subject: [PATCH 20/53] test --- .github/workflows/release.yml | 5 +++-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c8be20..7b59a85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: Release on: - release: - types: [created, published] + push: + branches: + - add_github_actions_tal jobs: docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 6bbf146..95b8eca 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.2.0 +version: 0.1.0 # Application Version appVersion: "v0.0.0-rc1" From 7957c75924f70040473765fda4aa5d7019d76d8f Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:26:29 +0300 Subject: [PATCH 21/53] test helm release --- .github/workflows/release.yml | 76 ++++++++++++++-------------- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b59a85..07e5d67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,44 +5,44 @@ on: - add_github_actions_tal jobs: - docker-buildx: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: appsflyer/local-pvc-releaser - tags: | - type=ref,event=tag - type=semver,pattern={{version}} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Validate Docker meta - run: echo "Output is empty, failing!" && exit 1 - if: steps.meta.outputs.tags == '' - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/arm64,linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# docker-buildx: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# +# - name: Docker meta +# id: meta +# uses: docker/metadata-action@v5 +# with: +# images: appsflyer/local-pvc-releaser +# tags: | +# type=ref,event=tag +# type=semver,pattern={{version}} +# type=raw,value=latest,enable={{is_default_branch}} +# +# - name: Validate Docker meta +# run: echo "Output is empty, failing!" && exit 1 +# if: steps.meta.outputs.tags == '' +# +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v3 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to Docker Hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# context: . +# platforms: linux/arm64,linux/amd64 +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} helm-release: permissions: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 95b8eca..6bbf146 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.1.0 +version: 0.2.0 # Application Version appVersion: "v0.0.0-rc1" From 462b2aae1861081c09bd021f7cd9624f950a168f Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:46:53 +0300 Subject: [PATCH 22/53] test helm tag --- .github/workflows/release.yml | 3 +-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e5d67..ea19862 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: Release on: push: - branches: - - add_github_actions_tal + tags: [ 'v*.*.*' ] jobs: # docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 6bbf146..1be933b 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.2.0 +version: 0.3.0 # Application Version appVersion: "v0.0.0-rc1" From 86c5db3127dc3e33b2520c2905b81fcec937266f Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:48:19 +0300 Subject: [PATCH 23/53] test helm tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea19862..e142da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release on: push: - tags: [ 'v*.*.*' ] + tags: [ '*.*.*' ] jobs: # docker-buildx: From 952d3eba954fb53a82ab4245daa56ac56ba4232a Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:50:45 +0300 Subject: [PATCH 24/53] test helm tag --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e142da2..07e5d67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: Release on: push: - tags: [ '*.*.*' ] + branches: + - add_github_actions_tal jobs: # docker-buildx: From 65745dfceb135c785c23cc3a2d2e754c749a00a8 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:51:45 +0300 Subject: [PATCH 25/53] test helm tag --- .github/workflows/release.yml | 3 +-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e5d67..e142da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: Release on: push: - branches: - - add_github_actions_tal + tags: [ '*.*.*' ] jobs: # docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 1be933b..81a6231 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.3.0 +version: 0.4.0 # Application Version appVersion: "v0.0.0-rc1" From 5a125afc0cb1aa3d10b970c10ae22cad37726ba0 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:27:17 +0300 Subject: [PATCH 26/53] ci(lint): add go lint --- .github/workflows/golang_linter.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/golang_linter.yml diff --git a/.github/workflows/golang_linter.yml b/.github/workflows/golang_linter.yml new file mode 100644 index 0000000..02c8101 --- /dev/null +++ b/.github/workflows/golang_linter.yml @@ -0,0 +1,52 @@ +name: Go Linter + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + - name: Lint + uses: golangci/golangci-lint-action@v3 + # continue-on-error: true + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.54.2 + + # Optional: working directory, useful for monorepos + # TODO: remove before release + working-directory: internal + + # Optional: golangci-lint command line arguments. + args: + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true then the action don't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. + # skip-build-cache: true From a582ebd9d3fade082b428708bcfd8d72d214b2c0 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:27:42 +0300 Subject: [PATCH 27/53] ci(vet): add golang vet --- .github/workflows/golang_unit_test.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/golang_unit_test.yml diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml new file mode 100644 index 0000000..9a3a560 --- /dev/null +++ b/.github/workflows/golang_unit_test.yml @@ -0,0 +1,27 @@ +name: Go Unit Test + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + vet: + name: vet + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + - name: Vet + run: | + go vet ./... From 4c4c4d2281e789cb45f33b1826e80f440faaacf6 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:28:00 +0300 Subject: [PATCH 28/53] ci(fmt): add golang fmt --- .github/workflows/golang_unit_test.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index 9a3a560..e58757d 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -24,4 +24,17 @@ jobs: go-version-file: './go.mod' - name: Vet run: | - go vet ./... + + fmt: + name: fmt + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + - name: Vet + run: | + go fmt ./... From 123157aea5f56fb5fd5383ab973abd13fff8d632 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:29:16 +0300 Subject: [PATCH 29/53] ci(unit): add unit tests --- .github/workflows/golang_unit_test.yml | 51 ++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index e58757d..c31bc77 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -24,6 +24,7 @@ jobs: go-version-file: './go.mod' - name: Vet run: | + go vet ./... fmt: name: fmt @@ -38,3 +39,53 @@ jobs: - name: Vet run: | go fmt ./... + + unit-test: + name: unit-test + needs: ["fmt", "vet"] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + # - name: Download envtest setup script + # run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh + + # - name: Make the script executable + # run: chmod +x setup-envtest.sh + + # - name: Setup envtest + # run: ./setup-envtest.sh + + # - name: Install Controller-gen + # run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0 + + # - name: Install Kustomize + # run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash + + - name: run unit tests + run: make unit-test + - uses: actions/upload-artifact@v3 + with: + name: unit_coverage_report + path: unit-test-cover.out + + coverage: + name: Coverage report + runs-on: ubuntu-latest + needs: unit-test + steps: + - uses: actions/download-artifact@v3 + with: + name: unit_coverage_report + - uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: unit-test-cover.out + flags: unittests + fail_ci_if_error: true \ No newline at end of file diff --git a/Makefile b/Makefile index 85c265c..6c7dd90 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ integration-test: generate fmt vet envtest ## Run tests. .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile unit-cover.out ##@ Build From afea6b1d654846405930721cec08be7187a9edbc Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:29:48 +0300 Subject: [PATCH 30/53] ci(integration): add integration tests --- .github/workflows/golang_integration_test.yml | 68 +++++++++++++++++++ Makefile | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/golang_integration_test.yml diff --git a/.github/workflows/golang_integration_test.yml b/.github/workflows/golang_integration_test.yml new file mode 100644 index 0000000..17285c2 --- /dev/null +++ b/.github/workflows/golang_integration_test.yml @@ -0,0 +1,68 @@ +name: Go Integration Test + +on: + push: + branches-ignore: + - main + - master + pull_request: + branches: + - main + - master + release: + +jobs: + integration-test: + name: integration-test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version-file: './go.mod' + + # - name: Download envtest setup script + # run: curl -sSLo setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh + + # - name: Make the script executable + # run: chmod +x setup-envtest.sh + + # - name: Setup envtest + # run: ./setup-envtest.sh + + # - name: Install Controller-gen + # run: GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.13.0 + + # - name: Install Kustomize + # run: curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash + + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1.8.0 + with: + config: test/kind/config.yml + cluster_name: test-cluster + + - name: run integration tests + run: make integration-test + - uses: actions/upload-artifact@v3 + with: + name: integration_coverage_report + path: integration-test-cover.out + + coverage: + name: Coverage report + runs-on: ubuntu-latest + needs: integration-test + steps: + - uses: actions/download-artifact@v3 + with: + name: integration_coverage_report + - uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + files: integration-test-cover.out + flags: integrationtests + fail_ci_if_error: true \ No newline at end of file diff --git a/Makefile b/Makefile index 6c7dd90..af2881d 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,7 @@ lint: $(GOLINT) .PHONY: integration-test integration-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile integration-cover.out .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. From a326058097fd8ce5fbe4fbbdd8914ee4f9f2a330 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:33:58 +0300 Subject: [PATCH 31/53] ci(codecov): fix report naming --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index af2881d..072c10d 100644 --- a/Makefile +++ b/Makefile @@ -74,12 +74,11 @@ lint: $(GOLINT) .PHONY: integration-test integration-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile integration-cover.out + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./test/... -coverprofile $@-cover.out -covermode atomic; go tool cover -func $@-cover.out .PHONY: unit-test unit-test: generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile unit-cover.out - + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./internal/... -coverprofile $@-cover.out -covermode atomic; go tool cover -func $@-cover.out ##@ Build .PHONY: build From 0e25c4bc74b929e84c7fa76412e2e44203aeefa7 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 14:34:22 +0300 Subject: [PATCH 32/53] ci(release): add buildx based release --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60dca8b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release +on: + release: + types: [created, published] + +jobs: + docker-buildx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: local-pvc-releaser + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Validate Docker meta + run: echo "Output is empty, failing!" && exit 1 + if: steps.meta.outputs.tags == '' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/arm64,linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From ac35d57187bcdb2b5dda263a3a7c602570d8e073 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 15:36:28 +0300 Subject: [PATCH 33/53] ci(helm): add helm release action --- .github/workflows/release.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 60dca8b..bc3d83c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,4 +41,26 @@ jobs: platforms: linux/arm64,linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + + helm-release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From ee618c4406b081c72966751022aad6f06d1daf5b Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:02:47 +0300 Subject: [PATCH 34/53] fix: typo in ci step --- .github/workflows/golang_unit_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index c31bc77..b6419ca 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -36,7 +36,7 @@ jobs: uses: actions/setup-go@v4 with: go-version-file: './go.mod' - - name: Vet + - name: fmt run: | go fmt ./... From 852a26184e6e0f44ad9d687c9f08f7d6bf0c6f36 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:07:25 +0300 Subject: [PATCH 35/53] ci(codecov): disable --- .github/workflows/golang_integration_test.yml | 30 +++++++++---------- .github/workflows/golang_unit_test.yml | 30 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/golang_integration_test.yml b/.github/workflows/golang_integration_test.yml index 17285c2..a33e9be 100644 --- a/.github/workflows/golang_integration_test.yml +++ b/.github/workflows/golang_integration_test.yml @@ -51,18 +51,18 @@ jobs: name: integration_coverage_report path: integration-test-cover.out - coverage: - name: Coverage report - runs-on: ubuntu-latest - needs: integration-test - steps: - - uses: actions/download-artifact@v3 - with: - name: integration_coverage_report - - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: integration-test-cover.out - flags: integrationtests - fail_ci_if_error: true \ No newline at end of file + # coverage: + # name: Coverage report + # runs-on: ubuntu-latest + # needs: integration-test + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: integration_coverage_report + # - uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: integration-test-cover.out + # flags: integrationtests + # fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/golang_unit_test.yml b/.github/workflows/golang_unit_test.yml index b6419ca..5bd66c6 100644 --- a/.github/workflows/golang_unit_test.yml +++ b/.github/workflows/golang_unit_test.yml @@ -74,18 +74,18 @@ jobs: name: unit_coverage_report path: unit-test-cover.out - coverage: - name: Coverage report - runs-on: ubuntu-latest - needs: unit-test - steps: - - uses: actions/download-artifact@v3 - with: - name: unit_coverage_report - - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: unit-test-cover.out - flags: unittests - fail_ci_if_error: true \ No newline at end of file + # coverage: + # name: Coverage report + # runs-on: ubuntu-latest + # needs: unit-test + # steps: + # - uses: actions/download-artifact@v3 + # with: + # name: unit_coverage_report + # - uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: unit-test-cover.out + # flags: unittests + # fail_ci_if_error: true \ No newline at end of file From 9cadbaccb804722c05578e0c8065e83de592232f Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Thu, 5 Oct 2023 18:14:49 +0300 Subject: [PATCH 36/53] ci(lint): add timeout argument --- .github/workflows/golang_linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golang_linter.yml b/.github/workflows/golang_linter.yml index 02c8101..a6c2a1d 100644 --- a/.github/workflows/golang_linter.yml +++ b/.github/workflows/golang_linter.yml @@ -36,7 +36,7 @@ jobs: working-directory: internal # Optional: golangci-lint command line arguments. - args: + args: --timeout=5m # Optional: show only new issues if it's a pull request. The default value is `false`. # only-new-issues: true From b91d97443964f1ecb6bd5d5b67d47987b46b273b Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 12:37:26 +0300 Subject: [PATCH 37/53] fix: cmd dir --- main.go => cmd/main.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main.go => cmd/main.go (100%) diff --git a/main.go b/cmd/main.go similarity index 100% rename from main.go rename to cmd/main.go From 2156b734712f43a4fb0c82c607528ad83ce3154e Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 13:03:42 +0300 Subject: [PATCH 38/53] fix(ci): image name --- .github/workflows/release.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc3d83c..5e9aee6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: local-pvc-releaser + images: appsflyer/local-pvc-releaser tags: | type=ref,event=tag type=semver,pattern={{version}} diff --git a/Makefile b/Makefile index 072c10d..300094f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Image URL to use all building/pushing image targets TAG ?= $(shell if [ -z "${CI_COMMIT_TAG}" ]; then echo "latest"; else echo ${CI_COMMIT_TAG}; fi) -IMG ?= "local-pvc-releaser" +IMG ?= "appsflyer/local-pvc-releaser" IMAGE = "${IMG}:${TAG}" #GIT GIT_URL ?= "github.com/appsflyer/local-pvc-releaser" From a61d84d27a154b6e2438f59b178736b484172ff9 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 14:44:53 +0300 Subject: [PATCH 39/53] fix(ci): helm release workflow checkout depth --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e9aee6..df38f2c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + with: + fetch-depth: 0 - name: Configure Git run: | From 836252982dabd77d3c32228c7c750a40b1f1a244 Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 15:04:46 +0300 Subject: [PATCH 40/53] fix(helm): initial version --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 77df2cb..f8476b5 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -8,4 +8,4 @@ type: application version: 0.0.0 # Application Version -appVersion: "v0.1.0" +appVersion: "v0.0.0-rc1" From 9629d202d92188528f50d56cbbbd1cbc9643bc8d Mon Sep 17 00:00:00 2001 From: Daniel Rogatchevsky Date: Mon, 16 Oct 2023 15:34:50 +0300 Subject: [PATCH 41/53] fix(ci): helm-release warning --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df38f2c..7c8be20 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,4 +64,5 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1.5.0 env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From 802d3bfcf35a2d89bcc1f5a1e692e58da9ec93e0 Mon Sep 17 00:00:00 2001 From: talasulin Date: Thu, 19 Oct 2023 12:16:44 +0300 Subject: [PATCH 42/53] testing chart release --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index f8476b5..95b8eca 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.0.0 +version: 0.1.0 # Application Version appVersion: "v0.0.0-rc1" From 13e49e320ea898728da9a4548c90197ccc48eb65 Mon Sep 17 00:00:00 2001 From: talasulin Date: Thu, 19 Oct 2023 12:21:30 +0300 Subject: [PATCH 43/53] testing chart release --- charts/local-pvc-releaser/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 95b8eca..6bbf146 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.1.0 +version: 0.2.0 # Application Version appVersion: "v0.0.0-rc1" From 089f456bacddfe8d1beb3615b2ac59d4b96218da Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 09:54:26 +0300 Subject: [PATCH 44/53] test --- .github/workflows/release.yml | 5 +++-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c8be20..7b59a85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: Release on: - release: - types: [created, published] + push: + branches: + - add_github_actions_tal jobs: docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 6bbf146..95b8eca 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.2.0 +version: 0.1.0 # Application Version appVersion: "v0.0.0-rc1" From a46ae4094ba8715ba349b0a997d4e68c267b57cd Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:26:29 +0300 Subject: [PATCH 45/53] test helm release --- .github/workflows/release.yml | 76 ++++++++++++++-------------- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7b59a85..07e5d67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,44 +5,44 @@ on: - add_github_actions_tal jobs: - docker-buildx: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: appsflyer/local-pvc-releaser - tags: | - type=ref,event=tag - type=semver,pattern={{version}} - type=raw,value=latest,enable={{is_default_branch}} - - - name: Validate Docker meta - run: echo "Output is empty, failing!" && exit 1 - if: steps.meta.outputs.tags == '' - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/arm64,linux/amd64 - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# docker-buildx: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# +# - name: Docker meta +# id: meta +# uses: docker/metadata-action@v5 +# with: +# images: appsflyer/local-pvc-releaser +# tags: | +# type=ref,event=tag +# type=semver,pattern={{version}} +# type=raw,value=latest,enable={{is_default_branch}} +# +# - name: Validate Docker meta +# run: echo "Output is empty, failing!" && exit 1 +# if: steps.meta.outputs.tags == '' +# +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v3 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to Docker Hub +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# context: . +# platforms: linux/arm64,linux/amd64 +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} helm-release: permissions: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 95b8eca..6bbf146 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.1.0 +version: 0.2.0 # Application Version appVersion: "v0.0.0-rc1" From 002ee117db3b893c3538a7ce3a66507c7b2ae071 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:46:53 +0300 Subject: [PATCH 46/53] test helm tag --- .github/workflows/release.yml | 3 +-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e5d67..ea19862 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: Release on: push: - branches: - - add_github_actions_tal + tags: [ 'v*.*.*' ] jobs: # docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 6bbf146..1be933b 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.2.0 +version: 0.3.0 # Application Version appVersion: "v0.0.0-rc1" From 17bb1fff87aed8015db781701904a4da314da80e Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:48:19 +0300 Subject: [PATCH 47/53] test helm tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea19862..e142da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release on: push: - tags: [ 'v*.*.*' ] + tags: [ '*.*.*' ] jobs: # docker-buildx: From 9b8e3f8b81b806aff51353d86ae595b38d44d1b5 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:50:45 +0300 Subject: [PATCH 48/53] test helm tag --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e142da2..07e5d67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,8 @@ name: Release on: push: - tags: [ '*.*.*' ] + branches: + - add_github_actions_tal jobs: # docker-buildx: From 5f53b822e3fa8b43ed6d264c69f51c31f2997811 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 10:51:45 +0300 Subject: [PATCH 49/53] test helm tag --- .github/workflows/release.yml | 3 +-- charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07e5d67..e142da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,7 @@ name: Release on: push: - branches: - - add_github_actions_tal + tags: [ '*.*.*' ] jobs: # docker-buildx: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 1be933b..81a6231 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.3.0 +version: 0.4.0 # Application Version appVersion: "v0.0.0-rc1" From cb57bedf452d939010493e494ca4a9ab97a4ed32 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 23:08:21 +0300 Subject: [PATCH 50/53] splitting release workflow --- .github/workflows/helm_release.yml | 34 ++++++++++++ .github/workflows/release.yml | 88 +++++++++++------------------- 2 files changed, 66 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/helm_release.yml diff --git a/.github/workflows/helm_release.yml b/.github/workflows/helm_release.yml new file mode 100644 index 0000000..4e3e694 --- /dev/null +++ b/.github/workflows/helm_release.yml @@ -0,0 +1,34 @@ +name: Release-Helm +on: + push: + branches: + - main + - master + +jobs: + helm-release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + with: + packages_with_index: true + mark_as_latest: false + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e142da2..48dbe40 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,68 +1,44 @@ name: Release on: - push: - tags: [ '*.*.*' ] + release: + types: [created, published] jobs: -# docker-buildx: -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# -# - name: Docker meta -# id: meta -# uses: docker/metadata-action@v5 -# with: -# images: appsflyer/local-pvc-releaser -# tags: | -# type=ref,event=tag -# type=semver,pattern={{version}} -# type=raw,value=latest,enable={{is_default_branch}} -# -# - name: Validate Docker meta -# run: echo "Output is empty, failing!" && exit 1 -# if: steps.meta.outputs.tags == '' -# -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v3 -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3 -# - name: Login to Docker Hub -# uses: docker/login-action@v3 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - name: Build and push -# uses: docker/build-push-action@v5 -# with: -# context: . -# platforms: linux/arm64,linux/amd64 -# push: true -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} - - helm-release: - permissions: - contents: write + docker-buildx: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 with: - fetch-depth: 0 + images: appsflyer/local-pvc-releaser + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Validate Docker meta + run: echo "Output is empty, failing!" && exit 1 + if: steps.meta.outputs.tags == '' - - name: Install Helm - uses: azure/setup-helm@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.5.0 - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/arm64,linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 56551f473d70c0107d2854096df53b6bb5f5c195 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 23:12:34 +0300 Subject: [PATCH 51/53] init helm --- charts/local-pvc-releaser/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 81a6231..77df2cb 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.4.0 +version: 0.0.0 # Application Version -appVersion: "v0.0.0-rc1" +appVersion: "v0.1.0" From c2c8bbc056232c157c77bf0c2f34cff689234045 Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 23:25:56 +0300 Subject: [PATCH 52/53] test helm release --- .github/workflows/helm_release.yml | 1 + charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/helm_release.yml b/.github/workflows/helm_release.yml index 4e3e694..a18e8b2 100644 --- a/.github/workflows/helm_release.yml +++ b/.github/workflows/helm_release.yml @@ -4,6 +4,7 @@ on: branches: - main - master + - add_github_actions_tal jobs: helm-release: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 77df2cb..9ca46fa 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.0.0 +version: 0.1.0 # Application Version appVersion: "v0.1.0" From e26fc769d0e59997e3d444cf75e25e2ba40b668b Mon Sep 17 00:00:00 2001 From: tal-asulin Date: Sun, 22 Oct 2023 23:28:25 +0300 Subject: [PATCH 53/53] test helm release --- .github/workflows/helm_release.yml | 1 - charts/local-pvc-releaser/Chart.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/helm_release.yml b/.github/workflows/helm_release.yml index a18e8b2..4e3e694 100644 --- a/.github/workflows/helm_release.yml +++ b/.github/workflows/helm_release.yml @@ -4,7 +4,6 @@ on: branches: - main - master - - add_github_actions_tal jobs: helm-release: diff --git a/charts/local-pvc-releaser/Chart.yaml b/charts/local-pvc-releaser/Chart.yaml index 9ca46fa..77df2cb 100644 --- a/charts/local-pvc-releaser/Chart.yaml +++ b/charts/local-pvc-releaser/Chart.yaml @@ -5,7 +5,7 @@ description: The local PVC releaser aim to delete persistent volume claims trigg type: application # Chart Version -version: 0.1.0 +version: 0.0.0 # Application Version appVersion: "v0.1.0"