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

Not able to find artifact from previous step in bitbucket-pipelines

Sérgio Baixo September 10, 2024

So my intention is to build a folder with files in the 1st step of my pipeline and then in the 2nd step use those files, but somehow I'm not being able to do so. I create the folder build2 and then cd into it and and then I build my project, and add this folder into the artifacts. But then in the 2nd step, the folder does not exist. And even though the command 'cd build2' fails, the stepp still finishes as success. How can I fix and improve this?

 

 

image2.pngimage3.png

2 answers

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 11, 2024

Hi Sérgio and welcome to the community!

The only time I can reproduce this error is when the build2 directory that is created in the first step is empty. I believe that the e2studioc command is not generating any files in the directory build2. You also noted that if you generate a file yourself you can see it in the second step, which supports this hypothesis.

To confirm this, include a dir; command right after the e2studioc command on the first step, to check if that folder has any files.

Regarding the step not failing, a step will fail if a certain command returns a non-zero exit code. It looks like PowerShell -Command returns a zero exit code, which is why the step is not failing.

Kind regards,
Theodora

Sérgio Baixo September 12, 2024

Hi Theodora, 

you are correct, the build2 folder was empty and I was not thinking clearly. I ended up fixing the issue, here is what I did: I copied the content of folder build to folder build2, then entered inside build2 and execute the e2studio.exe command


image.png

 

Another important aspect to mention, at some point I was creating a folder artifact with the name 'build' instead of build2 for example. This 'build' folder gets rewritten every single time by the runner when the pipeline starts. So even though it was working, the artifact folder shouldn't have 'build' as name.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 13, 2024

Hi Sérgio,

Thank you for the feedback.

at some point I was creating a folder artifact with the name 'build' instead of build2 for example. This 'build' folder gets rewritten every single time by the runner when the pipeline starts.

For every step of a Pipelines build running with a Windows self-hosted runner, the repo will be cloned in this location (unless cloning is disabled for the step):

C:\Users\myUser\Documents\atl\temp\b609961f-891e-c872-c36b-f3f2c315d186\1726221881224\build

where
C:\Users\myUser\Documents\atl is the directory of the runner
b609961f-891e-c872-c36b-f3f2c315d186 is the UUID of the runner
1726221881224 is based on the EPOCH time, when the build gets started

Then, the commands of that step's script will be executed, and when the step finishes, the runner will attempt to delete the content of C:\Users\myUser\Documents\atl\temp\b609961f-891e-c872-c36b-f3f2c315d186\1726221881224. The same process is repeated for every step of the same pipeline, and also for the steps of any subsequent pipelines that get triggered.

This doesn't have anything to do with the artifacts folder, it's standard behavior of the runner. If you have an artifact folder named build, it should be present at the following path of the next step

C:\Users\myUser\Documents\atl\temp\b609961f-891e-c872-c36b-f3f2c315d186\1726221881224\build\build

However, as I said, the content of C:\Users\myUser\Documents\atl\temp\b609961f-891e-c872-c36b-f3f2c315d186\1726221881224 will be cleared at the end of every step (unless something prevents the runner from cleaning it, e.g. file permissions).

So, it's not really clear to me what the issue is when the artifacts folder was named build, that no longer occurs when the folder is named build2.

If you'd like me to look into it, please feel free to provide some additional details.

Kind regards,
Theodora

0 votes
Sérgio Baixo September 10, 2024

Also if I do cmd.exe /c echo. > filename.txt instead of the e2studioc command I can see the filename.txt in the second step, but not the content from the e2studioc command

Suggest an answer

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

Atlassian Community Events