I am using circleci for CI CD, and here I am running a shell script. Their website says we should use these as best practices,
#!/usr/bin/env bash
# Exit script if you try to use an uninitialized variable.
set -o nounset
# Exit script if a statement returns a non-true return value.
set -o errexit
# Use the error status of the first failure, rather than that of the last item in a pipeline.
set -o pipefail
But it still throws this error -
ami_manager.sh: 5: set: Illegal option -o pipefail
Exited with code exit status 2
I am running this job -
build_image_if_required:
docker:
- image: cimg/base:2023.04
executor: aws-cli/default
working_directory: ~/project
steps:
- attach_workspace:
at: .
- checkout
- run:
name: Install Packer
command: |
sudo curl https://releases.hashicorp.com/packer/1.8.4/packer_1.8.4_linux_amd64.zip -o /tmp/packer.zip
sudo unzip /tmp/packer.zip
sudo mv ./packer /usr/bin/
sudo chmod +x /usr/bin/packer
- aws-cli/setup:
aws_access_key_id: aws_access_key_id
aws_secret_access_key: aws_secret_access_key
region: region
- run:
name: Find changes to build image
command: cd infrastructure/scripts; sh ami_manager.sh dev
- persist_to_workspace:
root: .
paths:
- .
I have changed docker image, and tried to run without these flags but then it sill shows some other errors, like no parentheses in function is expected
, and then function is not found
, so I figured there's something wrong ...
If anyone have faced such issues before please show a way.