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

When sourcing an atifact I'm getting "bash: bg: no job control"

Christian Chipont November 8, 2022

I have a pipeline which does the following:


- step:
name: 'Set environment variables'
deployment: Production
script:
- export PROJECT_ENVIRONMENT="production"
- export PROJECT_NAME="payment-service-api"
- export IMAGE="${AWS_ECR_URL}/${AWS_ECR_REPOSITORY}"
- export TAG="${PROJECT_NAME}-${PROJECT_ENVIRONMENT}-${BITBUCKET_BUILD_NUMBER}"
- printenv | xargs echo export > .envs
artifacts:
- .envs
- step:
name: "Build and Push API to ECR"
services:
- docker
script:
- export INSTANCE_NAME="API"
- source .envs
and fails in the last step with the message:
+ source .envs
bash: bg: no job control

What is really strange is that the same pipe for a different branch runs fine. I would sincerely appreciate any help as I'm out of ideas.
Chris

1 answer

1 accepted

0 votes
Answer accepted
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 10, 2022

Hey Christian,

Welcome to the Bitbucket Cloud community!

I notice that you are calling the .envs file using the source command, this means that the .envs file is executed by bash.

You may need to add the following line at the beginning of the .envs file to prevent this error message:

#! /bin/bash   
set -m

 There is a thread I have located on StackOverflow that explains this a little more:

https://stackoverflow.com/questions/11821378/what-does-bashno-job-control-in-this-shell-mean

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Christian Chipont November 16, 2022

Dear Ben,

Thanks for your reply. I had found this link also.

Seems like some vars, when doing this, don't get sourced to the new bash. I don't know why. I will have to investigate further, probably some issue with the chars not being properly escaped I guess.

I will try further and report back.

Chris

Suggest an answer

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

Atlassian Community Events