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

Can't access unsecured variable in pipelines script

Chris Thorp June 14, 2022

I'm trying to access a variable (unsecured) in a script to create a .env file before building, but the file is always created empty. The plan is to base64 decode it, but right now I'm just trying to access it at all. As far as I can read only secured variables should be restricted. What am I missing?

Screenshots below

Thanks!

 

script:
- echo $ENV_FILE > .env.local
- cat .env.local
- yarn install
- yarn build 

 Monosnap rushhourmedia _ wristcheck-next _ Deployments — Bitbucket 2022-06-14 17-54-24.pngMonosnap rushhourmedia _ wristcheck-next — Bitbucket 2022-06-14 17-55-20.png

1 answer

0 votes
Norbert C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 15, 2022

Hi Chris,

Thanks for reaching out to Atlassian Community, my name is Norbert and I'm a Bitbucket Cloud Support Engineer, it's nice to meet with you!

This sounds interesting, can you try to do only the "echo $ENV_FILE" command and let me know whether if it shows the environmental variable? Also, can you let me know if you're using Runners or are you running it on our Pipelines infrastructure?

Please let me know.

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Chris Thorp June 16, 2022

Hi Norbert,

I figured it out myself eventually - this was a deployment level variable which I didn't realise would not be available in non-deployment steps. I have moved it to a repository level variable which is now working.

 

Thanks for he reply

Norbert C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 16, 2022

Hi Chris,

Thank you for your reply, I'm glad to hear your issue is resolved :).

Have a lovely weekend ahead and stay safe!

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events