From 8ee638e5d753ec1ed94f29bade0f88dac5e5a989 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Jun 2023 15:12:32 -0500 Subject: [PATCH 1/3] chore(deps): bump actions/setup-go from 3.5.0 to 4.0.1 (#2849) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3.5.0 to 4.0.1. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3.5.0...v4.0.1) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/e2e.yaml | 2 +- .github/workflows/gh-pages.yaml | 2 +- .github/workflows/go.yml | 6 +++--- .github/workflows/image-reuse.yaml | 2 +- .github/workflows/release.yaml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 9559c4fde9..80637ab009 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: 1.19 - uses: actions/checkout@v3.1.0 diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index c3fce6b8bc..89df548ebd 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -24,7 +24,7 @@ jobs: with: python-version: 3.x - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: 1.19 - name: build diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 26ff28b01c..87d385a9d6 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -36,7 +36,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: ${{ env.GOLANG_VERSION }} - name: Checkout code @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: ${{ env.GOLANG_VERSION }} id: go @@ -103,7 +103,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3.1.0 - name: Setup Golang - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: ${{ env.GOLANG_VERSION }} # k8s codegen generates files into GOPATH location instead of the GitHub git checkout location diff --git a/.github/workflows/image-reuse.yaml b/.github/workflows/image-reuse.yaml index f2171f099f..5a091da3a5 100644 --- a/.github/workflows/image-reuse.yaml +++ b/.github/workflows/image-reuse.yaml @@ -69,7 +69,7 @@ jobs: if: ${{ github.ref_type != 'tag'}} - name: Setup Golang - uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 + uses: actions/setup-go@v4.0.1 # v3.5.0 with: go-version: ${{ inputs.go-version }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8afadbcc11..2bac1b57af 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -118,7 +118,7 @@ jobs: ref: ${{ github.event.inputs.tag }} - name: Setup Golang - uses: actions/setup-go@v4 + uses: actions/setup-go@v4.0.1 with: go-version: 1.19 From 1d53b251e1e1139f5e94314b5b121829edc5c88a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Jun 2023 15:13:04 -0500 Subject: [PATCH 2/3] chore(deps): bump github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 from 1.19.12 to 1.19.13 (#2847) chore(deps): bump github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 Bumps [github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2](https://github.com/aws/aws-sdk-go-v2) from 1.19.12 to 1.19.13. - [Release notes](https://github.com/aws/aws-sdk-go-v2/releases) - [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/efs/v1.19.12...service/efs/v1.19.13) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 6f08deb83b..4cd9ca9fee 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/aws/aws-sdk-go-v2 v1.18.1 github.com/aws/aws-sdk-go-v2/config v1.18.27 github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.26.2 - github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.12 + github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.13 github.com/blang/semver v3.5.1+incompatible github.com/bombsimon/logrusr/v4 v4.0.0 github.com/evanphx/json-patch/v5 v5.6.0 diff --git a/go.sum b/go.sum index ff90462f03..8e0ed9a6d4 100644 --- a/go.sum +++ b/go.sum @@ -117,8 +117,8 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.3.35 h1:LWA+3kDM8ly001vJ1X1waCuLJdt github.com/aws/aws-sdk-go-v2/internal/ini v1.3.35/go.mod h1:0Eg1YjxE0Bhn56lx+SHJwCzhW+2JGtizsrx+lCqrfm0= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.26.2 h1:PWGu2JhCb/XJlJ7SSFJq76pxk4xWsN76nZxh7TzMHx0= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.26.2/go.mod h1:2KOZkkzMDZCo/aLzPhys06mHNkiU74u85aMJA3PLRvg= -github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.12 h1:CeJNl5G6Y3+VYbZHczL/I2rsvQDBsNkhEOm98eo2eVo= -github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.12/go.mod h1:BNkuX97Xp8meRKwZkWlXajo3u4cP/B3TC+YsadbOfaM= +github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.13 h1:g/Kzed9qNdvz5p7Av3ffavD19eN11deWqlHgR2JuXuw= +github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.19.13/go.mod h1:BNkuX97Xp8meRKwZkWlXajo3u4cP/B3TC+YsadbOfaM= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.28 h1:bkRyG4a929RCnpVSTvLM2j/T4ls015ZhhYApbmYs15s= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.28/go.mod h1:jj7znCIg05jXlaGBlFMGP8+7UN3VtCkRBG2spnmRQkU= github.com/aws/aws-sdk-go-v2/service/sso v1.12.12 h1:nneMBM2p79PGWBQovYO/6Xnc2ryRMw3InnDJq1FHkSY= From bf2cc7dd9426332d235c097ac275d3a945ca3da0 Mon Sep 17 00:00:00 2001 From: yyzxw <34639446+yyzxw@users.noreply.github.com> Date: Wed, 21 Jun 2023 21:03:03 +0800 Subject: [PATCH 3/3] chore: add make help cmd (#2854) Signed-off-by: yyzxw <1020938856@qq.com> --- Makefile | 122 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 53 deletions(-) diff --git a/Makefile b/Makefile index 2ebb183635..638498ff85 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ ifdef IMAGE_NAMESPACE IMAGE_PREFIX=${IMAGE_NAMESPACE}/ endif -# protoc,my.proto +## protoc,my.proto define protoc # protoc $(1) PATH=${DIST_DIR}:$$PATH protoc \ @@ -66,22 +66,26 @@ endef .PHONY: all all: controller image -# downloads vendor files needed by tools.go (i.e. go_install) +##@ Development .PHONY: go-mod-vendor -go-mod-vendor: +go-mod-vendor: ## downloads vendor files needed by tools.go (i.e. go_install) go mod tidy go mod vendor +.PHONY: lint +lint: go-mod-vendor ## run all linters + golangci-lint run --fix + .PHONY: install-go-tools-local -install-go-tools-local: go-mod-vendor +install-go-tools-local: go-mod-vendor ## install all go tools ./hack/installers/install-codegen-go-tools.sh .PHONY: install-protoc-local -install-protoc-local: +install-protoc-local: ## install protoc tool ./hack/installers/install-protoc.sh .PHONY: install-devtools-local -install-devtools-local: +install-devtools-local: ## install dev tools ./hack/installers/install-dev-tools.sh # Installs all tools required to build and test locally @@ -94,6 +98,8 @@ APIMACHINERY_PKGS=k8s.io/apimachinery/pkg/util/intstr,+k8s.io/apimachinery/pkg/a .PHONY: install-toolchain install-toolchain: install-go-tools-local install-protoc-local +##@ Code Generation + # generates all auto-generated code .PHONY: codegen codegen: go-mod-vendor gen-proto gen-k8scodegen gen-openapi gen-mocks gen-crd manifests docs @@ -104,7 +110,7 @@ gen-proto: k8s-proto api-proto ui-proto # generates the .proto files affected by changes to types.go .PHONY: k8s-proto -k8s-proto: go-mod-vendor $(TYPES) +k8s-proto: go-mod-vendor $(TYPES) ## generate kubernetes protobuf files PATH=${DIST_DIR}:$$PATH go-to-protobuf \ --go-header-file=./hack/custom-boilerplate.go.txt \ --packages=github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1 \ @@ -117,44 +123,42 @@ k8s-proto: go-mod-vendor $(TYPES) # generates *.pb.go, *.pb.gw.go, swagger from .proto files .PHONY: api-proto -api-proto: go-mod-vendor k8s-proto +api-proto: go-mod-vendor k8s-proto ## generate api protobuf files $(call protoc,pkg/apiclient/rollout/rollout.proto) # generates ui related proto files .PHONY: ui-proto -ui-proto: +ui-proto: ## generate ui protobuf files yarn --cwd ui run protogen # generates k8s client, informer, lister, deepcopy from types.go .PHONY: gen-k8scodegen -gen-k8scodegen: go-mod-vendor +gen-k8scodegen: go-mod-vendor ## generate kubernetes codegen files ./hack/update-codegen.sh # generates ./manifests/crds/ .PHONY: gen-crd -gen-crd: install-go-tools-local +gen-crd: install-go-tools-local ## generate crd manifests go run ./hack/gen-crd-spec/main.go # generates mock files from interfaces .PHONY: gen-mocks -gen-mocks: install-go-tools-local +gen-mocks: install-go-tools-local ## generate mock files ./hack/update-mocks.sh # generates openapi_generated.go .PHONY: gen-openapi -gen-openapi: $(DIST_DIR)/openapi-gen +gen-openapi: $(DIST_DIR)/openapi-gen ## generate openapi files PATH=${DIST_DIR}:$$PATH openapi-gen \ --go-header-file ${CURRENT_DIR}/hack/custom-boilerplate.go.txt \ --input-dirs github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1 \ --output-package github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1 \ --report-filename pkg/apis/api-rules/violation_exceptions.list -.PHONY: controller -controller: - CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/rollouts-controller ./cmd/rollouts-controller +##@ Plugins .PHONY: plugin -plugin: ui/dist +plugin: ui/dist ## build plugin cp -r ui/dist/app/* server/static CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME} ./cmd/kubectl-argo-rollouts @@ -163,28 +167,30 @@ ui/dist: yarn --cwd ui build .PHONY: plugin-linux -plugin-linux: ui/dist +plugin-linux: ui/dist ## build plugin for linux cp -r ui/dist/app/* server/static CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-linux-amd64 ./cmd/kubectl-argo-rollouts CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-linux-arm64 ./cmd/kubectl-argo-rollouts .PHONY: plugin-darwin -plugin-darwin: ui/dist +plugin-darwin: ui/dist ## build plugin for darwin cp -r ui/dist/app/* server/static CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-darwin-amd64 ./cmd/kubectl-argo-rollouts CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-darwin-arm64 ./cmd/kubectl-argo-rollouts .PHONY: plugin-windows -plugin-windows: ui/dist +plugin-windows: ui/dist ## build plugin for windows cp -r ui/dist/app/* server/static CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/${PLUGIN_CLI_NAME}-windows-amd64 ./cmd/kubectl-argo-rollouts -.PHONY: docs -docs: - go run ./hack/gen-docs/main.go +##@ Build + +.PHONY: controller +controller: ## build controller binary + CGO_ENABLED=0 go build -v -ldflags '${LDFLAGS}' -o ${DIST_DIR}/rollouts-controller ./cmd/rollouts-controller .PHONY: builder-image -builder-image: +builder-image: ## build builder image DOCKER_BUILDKIT=1 docker build -t $(IMAGE_PREFIX)argo-rollouts-ci-builder:$(IMAGE_TAG) --target builder . @if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) ; fi @@ -198,25 +204,34 @@ else endif @if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)argo-rollouts:$(IMAGE_TAG) ; fi + +# Build sample plugin with debug info +# https://www.jetbrains.com/help/go/attach-to-running-go-processes-with-debugger.html +.PHONY: build-sample-metric-plugin-debug +build-sample-metric-plugin-debug: ## build sample metric plugin with debug info + go build -gcflags="all=-N -l" -o metric-plugin test/cmd/metrics-plugin-sample/main.go + +.PHONY: build-sample-traffic-plugin-debug +build-sample-traffic-plugin-debug: ## build sample traffic plugin with debug info + go build -gcflags="all=-N -l" -o traffic-plugin test/cmd/trafficrouter-plugin-sample/main.go + .PHONY: plugin-image -plugin-image: +plugin-image: ## build plugin image DOCKER_BUILDKIT=1 docker build --target kubectl-argo-rollouts -t $(IMAGE_PREFIX)kubectl-argo-rollouts:$(IMAGE_TAG) . if [ "$(DOCKER_PUSH)" = "true" ] ; then docker push $(IMAGE_PREFIX)kubectl-argo-rollouts:$(IMAGE_TAG) ; fi -.PHONY: lint -lint: go-mod-vendor - golangci-lint run --fix +##@ Test .PHONY: test -test: test-kustomize +test: test-kustomize ## run all tests @make test-unit .PHONY: test-kustomize -test-kustomize: +test-kustomize: ## run kustomize tests ./test/kustomize/test.sh .PHONY: start-e2e -start-e2e: +start-e2e: ## start e2e test environment go run ./cmd/rollouts-controller/main.go --instance-id ${E2E_INSTANCE_ID} --loglevel debug --kloglevel 6 .PHONY: test-e2e @@ -224,55 +239,63 @@ test-e2e: install-devtools-local ${DIST_DIR}/gotestsum --rerun-fails-report=rerunreport.txt --junitfile=junit.xml --format=testname --packages="./test/e2e" --rerun-fails=5 -- -timeout 60m -count 1 --tags e2e -p ${E2E_PARALLEL} -parallel ${E2E_PARALLEL} -v --short ./test/e2e ${E2E_TEST_OPTIONS} .PHONY: test-unit - test-unit: install-devtools-local + test-unit: install-devtools-local ## run unit tests ${DIST_DIR}/gotestsum --junitfile=junit.xml --format=testname -- -covermode=count -coverprofile=coverage.out `go list ./... | grep -v ./test/cmd/metrics-plugin-sample` .PHONY: coverage -coverage: test +coverage: test ## run coverage tests go tool cover -html=coverage.out -o coverage.html open coverage.html .PHONY: manifests -manifests: +manifests: ## generate manifests e.g. CRD, RBAC etc. ./hack/update-manifests.sh .PHONY: clean -clean: +clean: ## clean up build artifacts -rm -rf ${CURRENT_DIR}/dist -rm -rf ${CURRENT_DIR}/ui/dist .PHONY: precheckin precheckin: test lint +##@ Docs + +# convenience target to run `mkdocs serve` using a docker container +.PHONY: serve-docs +serve-docs: docs ## serve docs locally + docker run --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs squidfunk/mkdocs-material serve -a 0.0.0.0:8000 + +.PHONY: docs +docs: ## build docs + go run ./hack/gen-docs/main.go + +##@ Release + .PHONY: release-docs -release-docs: docs +release-docs: docs ## build and deploy docs docker run --rm -it \ -v ~/.ssh:/root/.ssh \ -v ${CURRENT_DIR}:/docs \ -v ~/.gitconfig:/root/.gitconfig \ squidfunk/mkdocs-material gh-deploy -r ${GIT_REMOTE_REPO} -# convenience target to run `mkdocs serve` using a docker container -.PHONY: serve-docs -serve-docs: docs - docker run --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs squidfunk/mkdocs-material serve -a 0.0.0.0:8000 - .PHONY: release-precheck -release-precheck: manifests +release-precheck: manifests ## precheck release @if [ "$(GIT_TREE_STATE)" != "clean" ]; then echo 'git tree state is $(GIT_TREE_STATE)' ; exit 1; fi @if [ -z "$(GIT_TAG)" ]; then echo 'commit must be tagged to perform release' ; exit 1; fi @if [ "$(GIT_TAG)" != "v`cat VERSION`" ]; then echo 'VERSION does not match git tag'; exit 1; fi .PHONY: release-plugins -release-plugins: +release-plugins: ## build and push plugins ./hack/build-release-plugins.sh .PHONY: release release: release-precheck precheckin image plugin-image release-plugins .PHONY: trivy -trivy: +trivy: ## run trivy scan @trivy fs --clear-cache @trivy fs . @@ -280,13 +303,6 @@ trivy: checksums: shasum -a 256 ./dist/kubectl-argo-rollouts-* | awk -F './dist/' '{print $$1 $$2}' > ./dist/argo-rollouts-checksums.txt -# Build sample plugin with debug info -# https://www.jetbrains.com/help/go/attach-to-running-go-processes-with-debugger.html -.PHONY: build-sample-metric-plugin-debug -build-sample-metric-plugin-debug: - go build -gcflags="all=-N -l" -o metric-plugin test/cmd/metrics-plugin-sample/main.go - -.PHONY: build-sample-traffic-plugin-debug -build-sample-traffic-plugin-debug: - go build -gcflags="all=-N -l" -o traffic-plugin test/cmd/trafficrouter-plugin-sample/main.go +help: ## Display this help. + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)