Hello,
I have a multi-environment app, I want to rerun a job multiple times with a different .env file.
I have ca. 20 different $CUSTMER_ENV_FILE
, and I want to run a job like this for every customer.
Job I want tu run:
# Job: test_e2e
test_dev: # only on mr
image: cypress/browsers:node12.14.1-chrome85-ff81
stage: test_e2e
rules:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev"'
script:
- npm install
- npm install -g env-cmd
- env-cmd env/$CUSTMER_ENV_FILE npm run tests
I also thought I could just use a script:
yourfilenames=`ls -a ./env | grep test`
for file in $yourfilenames
do
echo "RUN TESTS WITH THIS ENV: " $file
env-cmd -f env/$file npm run serve &
set -o allexport; source env/$file; set +o allexport
echo "Start Sleep"
sleep 30s
echo "End Sleep"
npx percy exec -- cypress run
done
However, this is not working because the pipeline is not failing if tests are failing inside the loop. Also, I do not get the nice visual feedback.