From e9f7e88e14c7112cfc5206f18f2fbecea230e578 Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Fri, 7 Mar 2025 14:11:35 +0000 Subject: [PATCH 1/4] chore(operator): CI take advantage of setup-go cache --- .github/workflows/operator-bundle.yaml | 13 ++----- .github/workflows/operator-scorecard.yaml | 13 ++----- .github/workflows/operator.yaml | 46 ++++++----------------- 3 files changed, 19 insertions(+), 53 deletions(-) diff --git a/.github/workflows/operator-bundle.yaml b/.github/workflows/operator-bundle.yaml index e99fc0865612f..1f9c6a6156b3f 100644 --- a/.github/workflows/operator-bundle.yaml +++ b/.github/workflows/operator-bundle.yaml @@ -13,19 +13,14 @@ jobs: build: name: build runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: + - name: Install make + run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go - - uses: actions/checkout@v4 - - name: Install make - run: sudo apt-get install make + go-version-file: ./operator/go.mod - name: make bundle run: | make bundle-all && git diff --exit-code -I'^ createdAt: ' diff --git a/.github/workflows/operator-scorecard.yaml b/.github/workflows/operator-scorecard.yaml index 4fd8fe5852d39..5eea3be9b1101 100644 --- a/.github/workflows/operator-scorecard.yaml +++ b/.github/workflows/operator-scorecard.yaml @@ -13,22 +13,17 @@ jobs: build: name: scorecard runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: + - name: Install make + run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go + go-version-file: ./operator/go.mod - uses: engineerd/setup-kind@v0.5.0 with: version: "v0.17.0" - - uses: actions/checkout@v4 - - name: Install make - run: sudo apt-get install make - name: Run scorecard run: make scorecard working-directory: ./operator diff --git a/.github/workflows/operator.yaml b/.github/workflows/operator.yaml index 38b3b61196de3..8f55c1e6a7c11 100644 --- a/.github/workflows/operator.yaml +++ b/.github/workflows/operator.yaml @@ -13,19 +13,14 @@ jobs: docs: name: docs runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: - name: Install make run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go - - uses: actions/checkout@v4 + go-version-file: ./operator/go.mod - name: Check generated docs working-directory: ./operator run: | @@ -35,19 +30,14 @@ jobs: lint: name: lint runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: - name: Install make run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go - - uses: actions/checkout@v4 + go-version-file: ./operator/go.mod - name: Lint uses: golangci/golangci-lint-action@v6 with: @@ -61,19 +51,15 @@ jobs: build-manager: name: Build Manager runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: - name: Install make run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} + go-version-file: ./operator/go.mod id: go - - uses: actions/checkout@v4 - name: Build Manager working-directory: ./operator run: |- @@ -82,19 +68,14 @@ jobs: build-broker: name: Build Broker runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: - name: Install make run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go - - uses: actions/checkout@v4 + go-version-file: ./operator/go.mod - name: Build Broker working-directory: ./operator run: |- @@ -103,19 +84,14 @@ jobs: test: name: test runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - go: ['1.22'] steps: - name: Install make run: sudo apt-get install make + - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go }} - id: go - - uses: actions/checkout@v4 + go-version-file: ./operator/go.mod - name: Run tests working-directory: ./operator run: go test -coverprofile=profile.cov ./... @@ -127,5 +103,5 @@ jobs: with: working-directory: ./operator path-to-profile: profile.cov - flag-name: Go-${{ matrix.go }} + flag-name: Go-1.23 shallow: true From fd591456734cdd3057e3025f2ee26287f974cb18 Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Mon, 10 Mar 2025 10:53:39 +0000 Subject: [PATCH 2/4] chore(operator): ci remove installing make as it's not necessary --- .github/workflows/operator-bundle.yaml | 2 -- .github/workflows/operator-scorecard.yaml | 2 -- .github/workflows/operator.yaml | 10 ---------- 3 files changed, 14 deletions(-) diff --git a/.github/workflows/operator-bundle.yaml b/.github/workflows/operator-bundle.yaml index 1f9c6a6156b3f..682bc8b788614 100644 --- a/.github/workflows/operator-bundle.yaml +++ b/.github/workflows/operator-bundle.yaml @@ -14,8 +14,6 @@ jobs: name: build runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 diff --git a/.github/workflows/operator-scorecard.yaml b/.github/workflows/operator-scorecard.yaml index 5eea3be9b1101..f66558f3fe213 100644 --- a/.github/workflows/operator-scorecard.yaml +++ b/.github/workflows/operator-scorecard.yaml @@ -14,8 +14,6 @@ jobs: name: scorecard runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 diff --git a/.github/workflows/operator.yaml b/.github/workflows/operator.yaml index 8f55c1e6a7c11..e735a8721ad9b 100644 --- a/.github/workflows/operator.yaml +++ b/.github/workflows/operator.yaml @@ -14,8 +14,6 @@ jobs: name: docs runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 @@ -31,8 +29,6 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 @@ -52,8 +48,6 @@ jobs: name: Build Manager runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 @@ -69,8 +63,6 @@ jobs: name: Build Broker runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 @@ -85,8 +77,6 @@ jobs: name: test runs-on: ubuntu-latest steps: - - name: Install make - run: sudo apt-get install make - uses: actions/checkout@v4 - name: Set up Go 1.x uses: actions/setup-go@v5 From 82e6e6a934a48f6c6b7949f172c6c00c58f73d04 Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Mon, 10 Mar 2025 10:55:51 +0000 Subject: [PATCH 3/4] chore: small change in README to trigger CI run --- operator/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator/Makefile b/operator/Makefile index ddc475e0c136f..ab6b8f41b7ce0 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -117,7 +117,7 @@ OCI_RUNTIME ?= $(shell which podman || which docker) help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -##@ Development +### Development .PHONY: deps deps: go.mod go.sum From 63553de351e3b8cfbb8819f2e00deda272333ee4 Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Wed, 12 Mar 2025 10:59:29 +0000 Subject: [PATCH 4/4] update the make change --- operator/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/operator/Makefile b/operator/Makefile index ab6b8f41b7ce0..bf38ca1e55268 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -117,7 +117,7 @@ OCI_RUNTIME ?= $(shell which podman || which docker) help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) -### Development +##@ Development .PHONY: deps deps: go.mod go.sum @@ -313,6 +313,7 @@ oci-push-calculator: ## Push the calculator image $(OCI_RUNTIME) push $(CALCULATOR_IMG) ##@ Website + TYPES_TARGET := $(shell find api/loki -type f -iname "*_types.go") docs/operator/api.md: $(TYPES_TARGET) $(GEN_CRD_API_REFERENCE_DOCS) $(GEN_CRD_API_REFERENCE_DOCS) -api-dir "github.com/grafana/loki/operator/api/loki/" -config "$(PWD)/config/docs/config.json" -template-dir "$(PWD)/config/docs/templates" -out-file "$(PWD)/$@" @@ -331,7 +332,7 @@ docs/operator/feature-gates.md: $(FEATURE_GATES_TARGET) $(GEN_CRD_API_REFERENCE_ sed -i 's/+newline/\n/' $@ .PHONY: web-pre -web-pre: docs/operator/api.md docs/operator/feature-gates.md +web-pre: docs/operator/api.md docs/operator/feature-gates.md ## Build the markdown API files of the loki-operator.dev website @echo ">> preprocessing docs for website" @git submodule update --init --recursive cd $(WEBSITE_DIR)/themes/doks/ && npm install && rm -rf content