I've got this shell script which pushes a Docker image into a repo on AWS depending on if the branch is stage or production.
the script throws [: unexpected operator
if [ -z "$GITLAB_PULL_REQUEST" ] || [ "$GITLAB_PULL_REQUEST" == "false" ]
then
if [ "$GITLAB_BRANCH" == "staging" ] || \ # error refers to this condition statements
[ "$GITLAB_BRANCH" == "production" ]
then
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
export PATH=~/bin:$PATH
export AWS_ACCOUNT_ID=27472968600
export AWS_ACCESS_KEY_ID=AKIAJKGN7TUK...
export AWS_SECRET_ACCESS_KEY=M8G9Zei...
eval $(aws ecr get-login --region eu-west-2 --no-include-email)
export TAG=$GITLAB_BRANCH
export REPO=$AWS_ACCOUNT_ID.dkr.ecr.eu-west-2.amazonaws.com
fi
What is the correct way to do it in shell ?