Forums

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

BITBUCKET_EXIT_CODE not present in windows runner

João Guilherme Silva Machado
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2025

When Windows Runner fails, it does not have the BITBUCKET_EXIT_CODE variable or any other to use in the after script step. The variable dont have a value, so it is always running the after script step.


- step: &test_after-script_windows

name: echo test windows

runs-on:

- self.hosted

- windows

script:

- echo teste windows

- echo $env:PACKAGE_VERSION

- echo $env:AWS_S3_BUCKET

- awscli run dotnet

after-script:

- echo $LastExitCode

- echo $BITBUCKET_EXIT_CODE

- |

if ($BITBUCKET_EXIT_CODE -ne 1) {

echo "Windows build step failed, running rollback"

} else {

echo "Windows build step succeeded"

}

1 answer

1 accepted

0 votes
Answer accepted
João Guilherme Silva Machado
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 19, 2025

I was missing the $env when calling the value

$env:BITBUCKET_EXIT_CODE

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events