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

part of BITBUCKET_REPO_SLUG is replaced by a Workspace variable

fmq August 22, 2024

Hi all.. 

So basically I have workspace variable called ASYS_DOCKER_HUB_USER, the value is "audser",  the project name is "https://bitbucket.org/kurobits/api-audser", now in my pipeline I have the following:

- echo $BITBUCKET_REPO_SLUG

witch I would expect to produce: api-audser

but it produces: 

slug.jpg

 

so basically it's replacing part of the slug with the name of a variable that has the same value as part of the actual slug, any ideas as why this could be happening?

 

TIA

1 answer

0 votes
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 26, 2024

G'day, @fmq 

Welcome to the community!

Is the variable a secure variable? If it is, the echo command will not display its value in the logs, as secure variables are not exposed in this manner.

In summary, when you set a variable as secure, any attempt to echo it during the build steps will not reveal its value, ensuring its confidentiality

Regards,
Syahrul

fmq August 27, 2024

Hey Syahrul

 

Well there are two variables in play here, on is a standard Bitbucket pipeline variable (BITBUCKET_REPO_SLUG) that represents the Slug of the repository and the one that I’m trying to use (the echo is only for demonstration purposes of what happens) , I would asume it’s not a secure variable, the second variable is a secure variable (ASYS_DOCKER_HUB_USER) that it’s value just so happens to be the same as part of the value for the repo slug, so, when I try to use the repo slug it will print out the NAME of the other variable.

Let’s assume that:

$BITBUCKET_REPO_SLUG=api-audser
$ASYS_DOCKER_HUB_USER=audser

 

any attempt of using $BITBUCKET_REPO_SLUG in the pipeline will turn out as:
api-$ASYS_DECOKER_HUB_USER (instead of api-audser)

 

It is a very strange behavior.

Regards

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2024

Hi @fmq 

Thanks for clarifying.

This behavior is expected. The reason is that the pipeline detects "audser" as a secure variable because you configured "$ASYS_DOCKER_HUB_USER" as such. Therefore, when you echo "$BITBUCKET_REPO_SLUG", it returns "api-$ASYS_DOCKER_HUB_USER" because "audser" is considered a secure variable, and thus, it is masked.

We have a feature request on this that I highly suggest you Vote and Watch them at:

https://jira.atlassian.com/browse/BCLOUD-23354

Regards,
Syahrul

 

fmq August 30, 2024

Hi @Syahrul 

thanks for the response, I asume then that this only happens in the logs file but not on the actual pipeline?

 

Thanks!

 

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 1, 2024

Hi @fmq 

Yes! This doesn't affect any of your pipeline build. It only masks in the build logs output.

Regards,
Syahrul

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events