Skip to content

Commit ce46f41

Browse files
Fix apidiff ci job
1 parent 45ea0cc commit ce46f41

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

Makefile

+27-22
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,33 @@ all: generate test operator
8282
help: ## Display this help
8383
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[0-9A-Za-z_-]+:.*?##/ { printf " \033[36m%-45s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
8484

85+
## --------------------------------------
86+
## Hack / Tools
87+
## --------------------------------------
88+
89+
kustomize: $(KUSTOMIZE) ## Build a local copy of kustomize.
90+
go-apidiff: $(GO_APIDIFF) ## Build a local copy of apidiff
91+
92+
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
93+
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
94+
95+
$(KUSTOMIZE): # Build kustomize from tools folder.
96+
$(ROOT)/hack/ensure-kustomize.sh
97+
98+
$(SETUP_ENVTEST): $(TOOLS_DIR)/go.mod # Build setup-envtest from tools folder.
99+
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/setup-envtest sigs.k8s.io/controller-runtime/tools/setup-envtest
100+
101+
$(GOTESTSUM): $(TOOLS_DIR)/go.mod # Build gotestsum from tools folder.
102+
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/gotestsum gotest.tools/gotestsum
103+
104+
$(GOLANGCI_LINT): .github/workflows/golangci-lint.yml # Download golanci-lint using hack script into tools folder.
105+
hack/ensure-golangci-lint.sh \
106+
-b $(TOOLS_DIR)/$(BIN_DIR) \
107+
$(shell cat .github/workflows/golangci-lint.yml | grep version | sed 's/.*version: //')
108+
109+
$(GO_APIDIFF): $(TOOLS_DIR)/go.mod # Build go-apidiff from tools folder.
110+
cd $(TOOLS_DIR) && go build -tags=tools -o $(GO_APIDIFF_BIN) github.com/joelanford/go-apidiff
111+
85112
## --------------------------------------
86113
## Testing
87114
## --------------------------------------
@@ -112,28 +139,6 @@ test-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run tests with verbose setting and
112139
operator: ## Build operator binary
113140
go build -trimpath -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/operator sigs.k8s.io/cluster-api-operator
114141

115-
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
116-
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen
117-
118-
$(KUSTOMIZE): # Build kustomize from tools folder.
119-
$(ROOT)/hack/ensure-kustomize.sh
120-
121-
$(SETUP_ENVTEST): $(TOOLS_DIR)/go.mod # Build setup-envtest from tools folder.
122-
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/setup-envtest sigs.k8s.io/controller-runtime/tools/setup-envtest
123-
124-
$(GOTESTSUM): $(TOOLS_DIR)/go.mod # Build gotestsum from tools folder.
125-
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/gotestsum gotest.tools/gotestsum
126-
127-
$(GOLANGCI_LINT): .github/workflows/golangci-lint.yml # Download golanci-lint using hack script into tools folder.
128-
hack/ensure-golangci-lint.sh \
129-
-b $(TOOLS_DIR)/$(BIN_DIR) \
130-
$(shell cat .github/workflows/golangci-lint.yml | grep version | sed 's/.*version: //')
131-
132-
$(GO_APIDIFF): $(TOOLS_DIR)/go.mod # Build go-apidiff from tools folder.
133-
cd $(TOOLS_DIR) && go build -tags=tools -o $(GO_APIDIFF_BIN) github.com/joelanford/go-apidiff
134-
135-
kustomize: $(KUSTOMIZE) ## Build a local copy of kustomize.
136-
137142
## --------------------------------------
138143
## Lint / Verify
139144
## --------------------------------------

scripts/ci-apidiff.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ set -o pipefail
2020

2121
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222

23+
APIDIFF="hack/tools/bin/go-apidiff"
24+
25+
cd "${REPO_ROOT}" && make go-apidiff
2326
echo "*** Running go-apidiff ***"
2427

25-
cd "${REPO_ROOT}" && make apidiff
28+
${APIDIFF} "${PULL_BASE_SHA}" --print-compatible

0 commit comments

Comments
 (0)