Forums

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

Bitbucket standard variables are not resolved

Jeroen Lodder August 16, 2023

I have the following step within my pipeline to deploy to a local folder on the build server.

 - step: &deploy
name: Deploy
runs-on:
- self.hosted
- windows
script:
- dir -r
- $COMMIT_SHORT = git log --pretty=format:'%h' -n 1
- Compress-Archive -Path bin/*.exe, bin/*.dll -DestinationPath "C:\atlassian-bitbucket-pipelines-runner\Artifacts\${BITBUCKET_REPO_SLUG}-${BITBUCKET_BRANCH}-$COMMIT_SHORT-${BITBUCKET_BUILD_NUMBER}.zip"

But none of the variables are resolved, except COMMIT_SHORT, what is causing this?

1 answer

1 vote
Jeroen Lodder August 16, 2023

For windows powershell every variables work when used with $env:

$env:BITBUCKET_REPO_SLUG
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 17, 2023

Hey @Jeroen Lodder and thank you for reaching out to Community!

As you correctly stated, Windows has a different syntax compared to Linux for referring to environment variables.

To reference a variable in a step that uses Windows runners you can use the syntax :

$env:VariableName

as also described in the article How to access environment variables in Windows Runners on Bitbucket cloud pipelines? 

Thank you, @Jeroen Lodder !

Patrik S

Like Jeroen Lodder likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, compass, developer experience, devex, platform engineering, internal developer platform, component catalog, atlassian learning, productivity tools, developer productivity, software architecture, compass webinar, engineering teams

Discover how Compass drives DevEx and productivity at Atlassian 🏃🏻‍♂️

Learn why Compass was built to tackle dev experience at scale. See how Atlassian uses it to boost visibility, reduce cognitive load, and drive consistency—plus tips to get started and customize your IDP for stronger team engagement.

Join the webinar ✨
AUG Leaders

Atlassian Community Events