Skip to content

Commit d7b38d4

Browse files
willie-yaojackfrancis
authored andcommitted
Refactor ci-apidiff to only look for breaking changes in api/ and exp/api/
Fix spellcheck issues
1 parent 6dac75d commit d7b38d4

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ clean-temporary: ## Remove all temporary files and folders.
213213
clean-release: ## Remove the release folder.
214214
rm -rf $(RELEASE_DIR)
215215

216+
APIDIFF_OLD_COMMIT ?= $(shell git rev-parse origin/main)
217+
216218
.PHONY: apidiff
217219
apidiff: $(GO_APIDIFF) ## Check for API differences.
218-
$(GO_APIDIFF) $(shell git rev-parse origin/main) --print-compatible
220+
$(GO_APIDIFF) $(APIDIFF_OLD_COMMIT)
219221

220222
.PHONY: format-tiltfile
221223
format-tiltfile: ## Format the Tiltfile.

scripts/ci-apidiff.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,19 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
set -o errexit
1817
set -o nounset
1918
set -o pipefail
2019

2120
REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2221

23-
APIDIFF="${REPO_ROOT}/hack/tools/bin/go-apidiff"
22+
cd "${REPO_ROOT}" || exit
2423

25-
make --directory="${REPO_ROOT}" "${APIDIFF##*/}"
2624
echo "*** Running go-apidiff ***"
25+
APIDIFF=$(APIDIFF_OLD_COMMIT="${PULL_BASE_SHA}" make apidiff 2> /dev/null)
2726

28-
${APIDIFF} "${PULL_BASE_SHA}" --print-compatible
27+
if [[ "${APIDIFF}" == *"sigs.k8s.io/cluster-api-provider-azure/api/"* ]] || [[ "${APIDIFF}" == *"sigs.k8s.io/cluster-api-provider-azure/exp/api/"* ]]; then
28+
echo "${APIDIFF}"
29+
exit 1
30+
else
31+
echo "No files under api/ or exp/api/ changed."
32+
fi

scripts/go_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if [ -z "${GOBIN}" ]; then
3737
exit 1
3838
fi
3939

40-
rm "${GOBIN}/${2}"* || true
40+
rm "${GOBIN}/${2}"* 2> /dev/null || true
4141

4242
# install the golang module specified as the first argument
4343
go install -tags tools "${1}@${3}"

0 commit comments

Comments
 (0)