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?
For windows powershell every variables work when used with $env:
$env:BITBUCKET_REPO_SLUG
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.