How can I start a bamboo job with an empty working directory (without SCM repo)?

Axel Tetzlaff September 11, 2013

I have a job that operates on files from a shared artifact by a previous stage. The job generates new files (ruby -> Gemfile.lock).

I would assume every build starts with a clean working dir, but it looks like the generated files from the previous build are still there. How can I ensure that every build of this job automatically starts in a clean state?

4 answers

1 accepted

2 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2015
2 votes
Jason Monsorno
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

Each job under the configuration -> Miscellaneous has a "Clean working directory after each build" option. Setting this option later in the process, now that you have unclean working directories, becuase is cleans the directory after the build and is a pain because you'll have to cycle through all your agents with "bad" builds to get it working. If you can spare the down-time you can clear the entire build-dir folder (in bamboo-home\xml-data) to delete all your working copies once.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2015

While that option may save disk space, it is more important to have a "before" option that makes builds work correctly ;).

0 votes
François-Marie de Jouvencel September 24, 2014

I just execute a script with the single line: "rm -R *" before anything else. This allows me to have a clean build folder before the tests, and a dirty one afterwards for analysis. 

I'm really not too happy about this solution, but since there is nothing of value on the bamboo machine I don't care if it messes up smile

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2015

Unfortunately, that also clears out any artifacts that are copied into the working directory

0 votes
Axel Tetzlaff September 11, 2013

This does solve the problem in case of successful build but makes it impossible to debug a failed build.

Cleaning the xml-data directory in a distributed environmen with several parralles plans is not an option (and does feel quite hacky too ;-) )

Jason Monsorno
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

I haven't tried it in a Job yet, but maybe you can follow the Deployment workflow. You can't use their clean task but you can write your own then use the Artifact download which is available to Jobs/tasks. I'm using V5.1.0 but you'd need atleast V5.0.0

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events