Skip to content

Commit 71c9047

Browse files
yaakovpraislermelamedbn
authored andcommitted
Fix git diff in test upload job (#24560)
* fix git diff in test upload job * this is a test * Revert "this is a test" This reverts commit 9aa526f. * added script that checks whether to trigger test upload * fix * debugging * debugging * revert prints
1 parent a000672 commit 71c9047

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

.gitlab/ci/on-push.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,16 +505,15 @@ test-upload-flow:
505505
rules:
506506
- if: '$CI_PIPELINE_SOURCE =~ /^(push|contrib)$/'
507507
variables:
508-
CURRENT_BRANCH: "$CI_COMMIT_BRANCH"
509508
ALL_BUCKETS: "$GCS_MARKET_BUCKET_DEV,$GCS_MARKET_V2_BUCKET_DEV"
510509
stage: unittests-and-validations
511510
allow_failure: true
512511
script:
513512
- |
514-
if ! $(git diff origin/master $CI_COMMIT_BRANCH --name-only | grep -q "Tests/\|Utils/") ; then
515-
echo "No upload related files were modified, skipping upload test "
516-
exit 0
517-
fi
513+
- section_start "Checks Whether to Trigger a Test Upload"
514+
- ./Utils/should_trigger_test_upload.sh
515+
- section_end "Checks Whether to Trigger a Test Upload"
516+
518517
- section_start "Create Testing Branch"
519518
- export BRANCH="${CI_COMMIT_BRANCH}-upload_test_branch-$(date +%s)"
520519
- python3 ./Utils/test_upload_flow/create_test_branch.py -tb $BRANCH -a $ARTIFACTS_FOLDER -g $GITLAB_PUSH_TOKEN

Utils/should_trigger_test_upload.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
DIFF_FILES_LIST=$(git diff origin/master...$CI_COMMIT_BRANCH --name-only)
4+
IGNORED_FILES=(
5+
"Tests/conf.json"
6+
"Tests/known_words.txt"
7+
)
8+
9+
for i in "${IGNORED_FILES[@]}"; do
10+
DIFF_FILES_LIST=${DIFF_FILES_LIST[*]/$i}
11+
done
12+
13+
SHOULD_SKIP_TEST=$(echo "${DIFF_FILES_LIST[*]}" | grep "Tests/\|Utils/")
14+
15+
if [ -z "$SHOULD_SKIP_TEST" ] ; then
16+
echo "No upload-flow related files were modified, skipping upload test"
17+
exit 0
18+
fi
19+
20+
echo "Found modified files that should be tested in upload-flow"

0 commit comments

Comments
 (0)