Paralel execution inside a Bash script
Summary
I try to use & to run multiple commands in parallel in gitlabci. However I receive an error code and no description on what had happened
Steps to reproduce
Launch a bash scirpt with & in .gitlabci
.gitlab-ci.yml
before_script:
- apk update
- apk add --update bash
custom_deploy:
except:
refs:
- develop
- useracceptance
- master
stage: deploy
when: manual
script:
- (cd deploy && ./deploy_test.sh ${ENV} ${IMAGE_TAG})
deploy_test.sh
#!/bin/bash
N=10 #Maximum paralel launches
for f in config/"$DEPLOYMENT_ENV"/$ENV/*; do
echo "Launching -> $f"
sceptre --var-file "$f" --var "imageversion=$IMG_VERSION" launch "$DEPLOYMENT_ENV"/ecs-service -y &
(( ++count % N == 0)) && wait
done
Actual behavior
Launching -> config/CI/MA/fcid
Launching -> config/CI/MA/fcid2
Launching -> config/CI/MA/mvp
Launching -> config/CI/MA/mvp3
ERROR: Job failed: exit code 1
Expected behavior
Script should launch multiple environments in paralel
Environment description
I'm using Gitlab enterprise hosted on https://gitlabhost.com/
Used GitLab Runner version
Running withgitlab-runner 10.6.0-rc1 (0a9d5de9)
Using Docker executor with image docker:latest
Edited by 🤖 GitLab Bot 🤖