Skip to content

Commit 54f8c19

Browse files
authored
Merge pull request #3222 from meghanajangi/Adding-apidiff-target-to-the-Makefile
Adding apidiff target to the Makefile
2 parents 9a74bcc + 111ee3b commit 54f8c19

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
4343
EXP_DIR := exp
4444

4545
# Binaries.
46-
GO_APIDIFF := $(TOOLS_BIN_DIR)/go-apidiff
46+
GO_APIDIFF_BIN := $(BIN_DIR)/go-apidiff
47+
GO_APIDIFF := $(TOOLS_DIR)/$(GO_APIDIFF_BIN)
4748
CLUSTERCTL := $(BIN_DIR)/clusterctl
4849
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
4950
CONVERSION_GEN := $(TOOLS_BIN_DIR)/conversion-gen
@@ -313,6 +314,10 @@ verify-gen: generate ## Verify generated files
313314
echo "generated files are out of date, run make generate"; exit 1; \
314315
fi
315316

317+
.PHONY: apidiff
318+
apidiff: $(GO_APIDIFF) ## Check for API differences
319+
$(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible
320+
316321
##@ build:
317322

318323
.PHONY: binaries
@@ -629,3 +634,4 @@ clean-temporary: ## Remove all temporary files and folders
629634
rm -rf test/e2e/capi-kubeadm-control-plane-controller-manager
630635
rm -rf test/e2e/logs
631636
rm -rf test/e2e/resources
637+

hack/tools/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/golang/mock v1.6.0
99
github.com/golangci/golangci-lint v1.44.2
1010
github.com/itchyny/gojq v0.12.6
11+
github.com/joelanford/go-apidiff v0.2.0
1112
github.com/onsi/ginkgo v1.16.5
1213
github.com/spf13/pflag v1.0.5
1314
k8s.io/apimachinery v0.23.0-alpha.4
@@ -238,6 +239,7 @@ require (
238239
go.opencensus.io v0.23.0 // indirect
239240
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
240241
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect
242+
golang.org/x/exp v0.0.0-20211029160041-3396431c207b // indirect
241243
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect
242244
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
243245
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect

hack/tools/go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC
905905
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
906906
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
907907
github.com/joelanford/go-apidiff v0.1.0/go.mod h1:wgVWgVCwYYkjcYpJtBnWYkyUYZfVovO3Y5pX49mJsqs=
908+
github.com/joelanford/go-apidiff v0.2.0 h1:qChl0utb9SUk8K1XYjxd0uamfSPELIgleS0Ve5RggKs=
909+
github.com/joelanford/go-apidiff v0.2.0/go.mod h1:46ufX9MyC2TmG+kCfwCB+Yxu19l7WN+4CN/flWAJ2v8=
908910
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
909911
github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
910912
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
@@ -1676,6 +1678,7 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0
16761678
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
16771679
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
16781680
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
1681+
golang.org/x/exp v0.0.0-20211029160041-3396431c207b h1:58UzImHd/vC6WxTQm75bwlBAOU/jDjzIMHUGO8O65UM=
16791682
golang.org/x/exp v0.0.0-20211029160041-3396431c207b/go.mod h1:OyI624f2tQ/aU3IMa7GB16Hk54CHURAfHfj6tMqtyhA=
16801683
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
16811684
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=

hack/tools/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
_ "github.com/golang/mock/mockgen"
2929
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
3030
_ "github.com/itchyny/gojq/cmd/gojq"
31+
_ "github.com/joelanford/go-apidiff"
3132
_ "github.com/onsi/ginkgo/ginkgo"
3233
_ "k8s.io/apimachinery/pkg/util/intstr"
3334
_ "k8s.io/code-generator"

scripts/ci-apidiff.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ set -o nounset
1919
set -o pipefail
2020

2121
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
22+
APIDIFF="${REPO_ROOT}/hack/tools/bin/go-apidiff"
2223

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

2827
${APIDIFF} "${PULL_BASE_SHA}" --print-compatible

0 commit comments

Comments
 (0)