Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can you use workspace variables in a custom pipe without passing the variable name?

Kimberly Anderson
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!
September 23, 2024

We're trying to use a custom pipe that builds its own workspace variable names.  In the past, we've always declared the deployment and workspace variables in the variables block for the pipe and we've just been able to use them by name.  Is there another way to do it that doesn't require passing the names?  We're okay with the pipe getting access to all workspace/deployment variables.

Thanks!

1 answer

2 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 25, 2024

Hi Kimberly and welcome to the community!

This is possible the following way:

  1. You will need to describe the variables in the pipe.yml file of the pipe's repo
  2. Then, you will need to load them in the pipe

An example of this can be found in the following pipe:

The variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAULT_REGION can also be configured as workspace, repository, or deployment variables and then it is not necessary to use them in the pipe's variables block.

For that to work, the variables are described in the pipe.yml file of the repo:

And then they are loaded in the pipe in the main.py file (line 529):

Please note that this will work if you later refer to the pipe in the bitbucket-pipelines.yml of another repo with - pipe atlassian/aws-cloudformation-deploy:0.20.1, so the format should be - pipe: BB_workspace/BB_repo:tag.

It will not work if you refer to the pipe by using theDocker image with - pipe: docker://docker_acct/docker_repo:tag.

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events