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

Bitbucket self-hosted runner (Windows) Artifacts Problem

Michael Deynet
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!
April 23, 2024

We are running a Windows based self-hosted runner.

Out bitbucket-pipelines.yml contains one step:

pipelines:
default:
- step:
name: Build firmware
runs-on:
- self.hosted
- windows
- build
script:
- C:\tmp\Python\python.exe C:\tmp\mpr-testrack\main_build.py
- dir C:\tmp\TMP_DST\mpr2\out
- mkdir %BITBUCKET_CLONE_DIR\out
- move C:\tmp\TMP_DST\mpr2\out\* %BITBUCKET_CLONE_DIR\out\
- dir %BITBUCKET_CLONE_DIR\out
artifacts:
- out\**
- out/**


The idea is to copy the build files to %BITBUCKET_CLONE_DIR\out to have the option to download these from the bitbucket webpage.

 

Under the script section everything works fine (the move as well as the last dir)

 

When teardown is performed, bitbucket does not find the artifacts:

Searching for files matching artifact pattern out\**
Searching for files matching artifact pattern out/**

Under "Artifacts": "No Artifacts uploaded"

 

For testing purposes I implemented a following step in the pipeline and there the working directory is this: 

C:\bucher\bitbucket_runner\atlassian-bitbucket-pipelines-runner\temp\889d0a5a-cc18-5f20-b774-c8b042721efe\1713264850790\build

I don't know where the build subfolder comes from.

And in that working directioy there is no out folder.

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 25, 2024

Hello @Michael Deynet and welcome to the Community!

The build subfolder is automatically created during the build start, and it's where the runner will download the files from Bitbucket (clone the repository, download any artifacts, etc).

The environment variable 

BITBUCKET_CLONE_DIR

will contain the full path to the build subfolder.

As for the reason why the artifact is not being uploaded, I suspect this is because you are using an invalid syntax to reference the variable, which is making the "out" folder to be created at a different path.

To reference variables in the Windows environment I'd suggest using the following syntax : 

$env:ENV_VARIABLE_NAME

For example : 

mkdir $env:BITBUCKET_CLONE_DIR\out

This should make sure the folder is being created at the correct location.

Could you try editing your YML file to use the above syntax in all the variables references, and try running the build again? 

Should you have any questions, feel free to ask.

Thank you, @Michael Deynet !

Patrik S

Michael Deynet
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!
April 25, 2024

Thank you @Patrik S 

That is the soluation!

Thank you for your help!

Like Patrik S likes this
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2024

You're very welcome!

Happy to hear updating the syntax did the trick :)

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events