Skip to content

Commit a7c08ad

Browse files
author
Diego Nadares
committed
Merge branch 'tkt_376_modificar_ci_para_correr_tests_con_branch_de_reports' into 'dev'
Resolve "Modificar CI para correr tests con branch de reports" Closes #376 See merge request faradaysec/faraday-plugins!285
2 parents f2fcc13 + 801d56a commit a7c08ad

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.gitlab-ci.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,20 @@ workflow:
4242
- cd ..
4343

4444
.clone_reports: &clone_reports
45-
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/faradaysec/support/report-collection.git
46-
- cd report-collection
47-
- (git branch -a | grep $CI_COMMIT_BRANCH) && export REPORT_REF=$CI_COMMIT_BRANCH || export REPORT_REF=master
48-
- git checkout $REPORT_REF
49-
- cd ..
45+
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/faradaysec/support/report-collection.git
46+
- cd report-collection
47+
- |
48+
SUFFIX="${CI_COMMIT_BRANCH#*_}"
49+
MATCH_BRANCH=$(git branch -r --list "*_reports_for_${SUFFIX}" | sed 's|origin/||' | head -n 1 | xargs)
50+
if [ -n "$MATCH_BRANCH" ]; then
51+
echo "Using branch from report-collection: $MATCH_BRANCH"
52+
REPORT_REF="$MATCH_BRANCH"
53+
else
54+
echo "Can't find branch *_reports_for_${SUFFIX}, will use master"
55+
REPORT_REF="master"
56+
fi
57+
git checkout "$REPORT_REF"
58+
- cd ..
5059

5160
bandit:
5261
stage: SAST

0 commit comments

Comments
 (0)