Hello, I am trying to run the pipeline, thru bitbucket-pipeline.yaml file.
The pipelines is failing to run a script even though the script is available in the location.
see the screenshot for reference.
&& this is my bitbucket pipeline yaml file
Can any atlassian expert help?
image: hashicorp/terraform:1.8.5
definitions:
services:
docker:
memory: 3072
pipelines:
branches:
us-stg-dat-*:
- step:
script:
- cd merkle-datb/deployment/environments
- pwd
- ls -lart
- ./stage.sh plan
Hi @Arun Kumar D and welcome to the community!
I was able to reproduce this error with a bitbucket-pipelines.yml file similar to yours. The error did not occur when I used image: atlassian/default-image:4, so I suspected that it had something to do with the image hashicorp/terraform:1.8.5. After running some additional commands during the build, I found out that this Docker image does not include bash but it uses sh instead.
Do you have the shebang #!/bin/bash at the beginning of your script file, stage.sh? If so, can you change it to #!/bin/sh and then run another build? I was able to run a script successfully in a Pipelines build that uses image: hashicorp/terraform:1.8.5 when I included the shebang #!/bin/sh at the beginning of my script.
Another option, if you don't want to change the script, would be to install bash during the build. You can do it by adding the following command in the bitbucket-pipelines.yml file, right before the command that executes the script:
- apk add --no-cache bash
Please feel free to let me know how it goes!
Kind regards,
Theodora
Hello @Theodora Boudale
Thanks for helping me out on the pipeline failure step. Thanks for helping me find out the shebang #!/bin/bash line.
You guessed it exactly right. I do exactly have shebang line.
I have included a line in the script for installation of the bash. That actually worked.
- apk add --no-cache bash
Thanks Again. Good day
Arun Kumar D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.