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

Artifact missing - name contains `BITBUCKET_PARALLEL_STEP`

Georg Duemlein December 4, 2022

My pipeline looks like that:

 

- parlell
- step:
script:
- cli-command > /tmp/report-${BITBUCKET_PARALLEL_STEP}.txt
artifacts:
- "/tmp/report-*.txt"

However, the file is not stored as an artifact.

If I remove the parallel step variable, the file is part of the artifacts, but only the last one.

 

I feel I am missing something here ...

 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 6, 2022

Hi @Georg Duemlein,

Every step of a Pipelines build runs in a Docker container, and the repo is cloned in the directory /opt/atlassian/pipelines/agent/build (the clone directory). Only files in the clone directory can be defined as artifacts, if you define as an artifact a file located in /tmp folder it's not going to be uploaded.

I would suggest creating the file inside the clone directory (that's the present working directory when the build runs) or creating a tmp folder inside the clone directory and create the file there. The path you specify in the artifacts section should be relative to the clone directory.


Another thing to keep in mind is that parallel steps cannot use an artifact produced by a step in the same parallel set. If a parallel step produces an artifact, this will be available only to steps following the parallel set.

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

Georg Duemlein December 6, 2022

Ok, that makes sense!

Is the clone directory exposed as an environment variable by any chance?

Or is it safe to assume it doesn't change?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 7, 2022

Hi Georg,

The directory is exposed in the variable $BITBUCKET_CLONE_DIR, for reference: https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/

It has been the same path for the last few years. I don't think we can guarantee though we won't ever change it, so I think it's safer to use the environment variable.

Kind regards,
Theodora

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 7, 2022

Just a quick note that using the environment variable is not needed for the artifacts definition, and it will not work, first, because the path needs to be relative to the clone dir and, second, because of a bug that the file path in artifacts cannot render variable names. 

If you generate the file in a tmp directory inside the clone dir, a definition like the following should work:

artifacts:
- "tmp/report-*.txt"

Suggest an answer

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

Atlassian Community Events