File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,44 +320,6 @@ check-committer:
320320 - junit-report.xml
321321 reports :
322322 junit : junit-report.xml
323- check-large-files :
324- stage : lint
325- needs : [pipelines-check]
326- rules :
327- - if : $CI_PIPELINE_SOURCE == 'merge_request_event'
328- image :
329- name : $CI_REGISTRY_GO/golang:latest-alpine
330- entrypoint : [""]
331- tags :
332- - go
333- script :
334- # List all files in the latest commit that are larger than 2MB
335- - |
336- git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
337- git diff --name-only origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}..HEAD | while read file; do
338- if [ -f "$file" ] && [ $(stat -c%s "$file") -gt 2097152 ]; then
339- echo "$file"
340- fi
341- done > large_files.txt
342-
343- # Fail the job if any file is larger than 1MB
344- - |
345- if [ -s large_files.txt ]; then
346- echo "The following files exceed 1MB:"
347- cat large_files.txt
348- junit-report add --status=failed --file=large-files --message="large files found" --description="$(cat large_files.txt)"
349- exit 1
350- else
351- echo "No large files found in the latest commit."
352- junit-report add --status=ok --file=large-files --message="commit clean" --description="No large files found in the latest commit."
353- fi
354- artifacts :
355- when : on_failure
356- paths :
357- - junit-report.xml
358- reports :
359- junit : junit-report.xml
360-
361323build :
362324 stage : build
363325 needs : []
You can’t perform that action at this time.
0 commit comments