Skip to content

Commit f434147

Browse files
oktalzGopher Bot
authored andcommitted
BUILD/MINOR: ci: prevent committing files larger that 1MB
1 parent 202b2fe commit f434147

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.gitlab/diff.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@ diff-crd:
3030
- git diff
3131
- test -z "$(git diff 2> /dev/null)" || exit "CRD generation was not generated, issue \`make cr_generate\` and commit the result"
3232
- test -z "$(git ls-files --others --exclude-standard 2> /dev/null)" || exit "CRD generation created untracked files, cannot proceed"
33+
check-large-files:
34+
stage: diff
35+
tags:
36+
- go
37+
script:
38+
# List all files in the latest commit that are larger than 1MB
39+
- git ls-tree -r HEAD --long | awk '$4 > 1048576 { print $0 }' > large_files.txt
40+
41+
# Fail the job if any file is larger than 1MB
42+
- |
43+
if [ -s large_files.txt ]; then
44+
echo "❌ The following files exceed 1MB:"
45+
cat large_files.txt
46+
exit 1
47+
else
48+
echo "✅ No large files found in the latest commit."
49+
fi

0 commit comments

Comments
 (0)