Skip to content

Commit

Permalink
Automator: update common-files@master in istio/istio.io@master (#11050)
Browse files Browse the repository at this point in the history
  • Loading branch information
istio-testing authored Mar 14, 2022
1 parent b5952bb commit c702c2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/.commonfiles.sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4f7a47a2619aa100ebdec34dc4a0369204c1c01c
4023d4ecadf17e8b274212b8c7285ee0e6e9b4fe
25 changes: 24 additions & 1 deletion common/scripts/check_clean_repo.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2019 Istio Authors
# Copyright Istio Authors

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,32 @@
# See the License for the specific language governing permissions and
# limitations under the License.

function write_patch_file() {
if [ -z "${ARTIFACTS}" ]; then
return 0
fi

PATCH_NAME="check-clean-repo-diff.patch"
PATCH_OUT="${ARTIFACTS}/${PATCH_NAME}"
git diff > "${PATCH_OUT}"

[ -n "${JOB_NAME}" ] && [ -n "${BUILD_ID}" ]
IN_PROW="$?"

# Don't persist large diffs (30M+) on CI
LARGE_FILE="$(find "${ARTIFACTS}" -name "${PATCH_NAME}" -type 'f' -size +30M)"
if [ "${IN_PROW}" -eq 0 ] && [ -n "${LARGE_FILE}" ]; then
rm "${PATCH_OUT}"
echo "WARNING: patch file was too large to persist ($(du -h "${PATCH_OUT}"))"
return 0
fi
echo "You can also try applying the patch file from the build artifacts."
}

if [[ -n $(git status --porcelain) ]]; then
git status
git diff
echo "ERROR: Some files need to be updated, please run 'make gen' and include any changed files in your PR"
write_patch_file
exit 1
fi

0 comments on commit c702c2d

Please sign in to comment.