Skip to content

Commit

Permalink
Add apidiff target to the Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Meghana Jangi <mjangi@vmware.com>
  • Loading branch information
meghanajangi committed Feb 24, 2022
1 parent 6c42970 commit 111ee3b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
EXP_DIR := exp

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

.PHONY: apidiff
apidiff: $(GO_APIDIFF) ## Check for API differences
$(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible

##@ build:

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

2 changes: 2 additions & 0 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/golang/mock v1.6.0
github.com/golangci/golangci-lint v1.44.2
github.com/itchyny/gojq v0.12.6
github.com/joelanford/go-apidiff v0.2.0
github.com/onsi/ginkgo v1.16.5
github.com/spf13/pflag v1.0.5
k8s.io/apimachinery v0.23.0-alpha.4
Expand Down Expand Up @@ -238,6 +239,7 @@ require (
go.opencensus.io v0.23.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect
golang.org/x/exp v0.0.0-20211029160041-3396431c207b // indirect
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
Expand Down
3 changes: 3 additions & 0 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/joelanford/go-apidiff v0.1.0/go.mod h1:wgVWgVCwYYkjcYpJtBnWYkyUYZfVovO3Y5pX49mJsqs=
github.com/joelanford/go-apidiff v0.2.0 h1:qChl0utb9SUk8K1XYjxd0uamfSPELIgleS0Ve5RggKs=
github.com/joelanford/go-apidiff v0.2.0/go.mod h1:46ufX9MyC2TmG+kCfwCB+Yxu19l7WN+4CN/flWAJ2v8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
Expand Down Expand Up @@ -1676,6 +1678,7 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20211029160041-3396431c207b h1:58UzImHd/vC6WxTQm75bwlBAOU/jDjzIMHUGO8O65UM=
golang.org/x/exp v0.0.0-20211029160041-3396431c207b/go.mod h1:OyI624f2tQ/aU3IMa7GB16Hk54CHURAfHfj6tMqtyhA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
Expand Down
1 change: 1 addition & 0 deletions hack/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
_ "github.com/golang/mock/mockgen"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/itchyny/gojq/cmd/gojq"
_ "github.com/joelanford/go-apidiff"
_ "github.com/onsi/ginkgo/ginkgo"
_ "k8s.io/apimachinery/pkg/util/intstr"
_ "k8s.io/code-generator"
Expand Down
5 changes: 2 additions & 3 deletions scripts/ci-apidiff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ set -o nounset
set -o pipefail

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

APIDIFF="hack/tools/bin/go-apidiff"

cd "${REPO_ROOT}" && make ${APIDIFF}
cd "${REPO_ROOT}" && make apidiff
echo "*** Running go-apidiff ***"

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

0 comments on commit 111ee3b

Please sign in to comment.