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-c8b042721
efe\1713264850790\build
I don't know where the build subfolder comes from.
And in that working directioy there is no out folder.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're very welcome!
Happy to hear updating the syntax did the trick :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.