Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket pipeline not correctly installing image.

Ernesto Bastidas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 26, 2024

I have this bitbucket pipeline:


image: ubuntu:latest

pipelines:
branches:
master:
- step:
name: Upload
script:
- sudo apt-get update && apt-get install -y openssh-client jq curl
- cat /opt/atlassian/pipelines/agent/ssh/id_rsa >> ec2_private_key.pem
- chmod 600 ec2_private_key.pem
- echo "Fetching modified files from Bitbucket API using diff endpoint"
- |
curl -s -H "Authorization: Bearer $API_TOKEN_BEARER" \
| jq -r '.values[0].hash' > latest_commit.txt
- COMMIT_HASH=$(cat latest_commit.txt)
- |
curl -s -H "Authorization: Bearer $API_TOKEN_BEARER" \
| grep '^+++ b' | awk '{print $2}' | sed 's/^b\///' > modified_files.txt
- echo "Modified files:"
- cat modified_files.txt
- while IFS= read -r file; do
scp -i ec2_private_key.pem -o StrictHostKeyChecking=no -r "$file" ubuntu@$EC2_HOST:$PATH"$file";
done < modified_files.txt
- ssh -i ec2_private_key.pem -o StrictHostKeyChecking=no ubuntu@$EC2_HOST "cd $PATH && sudo docker-compose up --build -d"

But in the build setup phase of the pipeline I get this error, so the image is not installed properly and I can't use any commands that come by defect in ubuntu.

This is the error in the build setup:


Images used:
58
bash: dircolors: command not found
59

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 27, 2024

Hi @Ernesto Bastidas 

 

Welcome to the Bitbucket Cloud community!

 

I have pulled that image locally and found that dircolors is installed as part of the coreutils package as you would expect.

 

Do you have a repository/deployment/workspace variable called PATH configured anywhere? If so, this can break your pipeline steps. This happens because the shell uses PATH to find commands, so if you replace its usual list of locations then utilities like dircolors won't work anymore. More information and a bug ticket can be found below:

 

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events