Forums

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

Reverse Repositories Variable

Revan Hernandy January 7, 2022

Hi All,

 

On my project, and unfortunately, I lost and forget some variable values. How do I get the value of repositories variable of my bitbucket project? I'm an admin in my project. Is there any chance to reverse back the variable values?

 

Thanks

1 answer

0 votes
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2022

Hi, @Revan Hernandy

Thank you for reaching out to Atlassian Community!

Before we start, I’d like to confirm what is happening on your side. Feel free to correct me in case I have misunderstood something here. You mentioned you lost and forgot some variable values on your repository. Could you please clarify if the variables have been deleted, or if you just don’t remember their values, but they are still there?

If you still have the secured variables, you can find out their values. You can achieve that by going to your yml file > echo the variable in a file that you define as an artifact > and then you can see the value of the variable if you download the artifact.

This is an example of how to retrieve a secured variable’s value with artifacts:

script:
  - echo $variable > variablevalue.txt
artifacts:
  - variablevalue.txt

Looking forward to hearing from you. 

Kind regards,
Caroline

Revan Hernandy January 13, 2022

Hi Caroline,

yes, I lost/forget some necessary credentials there and I need to know the value of the variables.

what pipe can I use?  atlassian/ssh-run:0.2.2 ?

if yes what mode can I use? script or command?

 

thank you!

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2022

Hi, @Revan Hernandy,

Could you please clarify which type of variables you are using in this YAML file? Does it get the values for secured Pipelines variables defined on a repository or workspace level, deployment variables, or some variables on your server?

If these variables are set in Repository settings > Repository variables (secured), you should be able to retrieve their secured values using any image (for example, atlassian/default-image:3), and you just would need to add this to your YAML file:

script:
  - echo $variable > variablevalue.txt
artifacts:
  - variablevalue.txt

Then download the artifacts by accessing the successful build > open Artifacts > Download artifact.

I hope this clarifies the process, but please let me know if you face any obstacles. 

Kind regards,
Caroline

Revan Hernandy January 21, 2022

@Caroline R it worked thank you!

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2022

Hi, Revan! 

Thanks for your confirmation, I'm glad to know that! 

Kind regards,
Caroline 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events