Bamboo shared workspace
Asked by Oliver Pereira:

Hi,

Is there any way to share the workspace between stages in Bamboo?

Currently it's a big hurdle for us if we have to break our jobs into multiple stages


Answers:
author: Pawel Skierczynski
body: If your job is producing something interesting it can save it to be retrieved by other job in different stage or plan.

You have 3 options:

1) Define artifact and use download artifact task later to retrieve it - it will upload and download it later.

2) Manually publish artifact (like jar in maven repository etc.) and retrieve it later - similar to one but using something external instead of Bamboo

3) If you can ensure that all agents run in same infrastructure/cloud (like using same disc storage or it's amazon image with shared storage mounted) you could avoid copying it by storing it there.

comments: author: Caley Goff
body: I was just about to mention artifact sharing instead you did an outstanding job of doing it for me. Artifact sharing is the answer to this. Artifacts literally can be what ever you want, you just have to define it in the interface. From there if you want to use that artifact in another place downstream, you have to share it. However note that one of your tasks in that job for that stage has to produce the define artifact in order to pass, otherwise because you shared it, if its not available at the end of the task execute your job will fail.


author: Marcin Oles
body: It would make sense to create an initial one-job stage which builds the project, and this job would create the artifact to be reused later.But please remember that artifacts are always preserved and in this scenario may take a lot of space in a short time. Consider enabling build expiry feature, which could expire entire builds or just artifacts under some configurable conditions (eg. preserve last X builds or preserve builds younger than X days).


author: Marcin Oles
body: Unfortunately, there isn't.

Please remember that **each job has it's own workspace** and **jobs can be executed in parallel within a stage** - this would make it difficult to achieve shared workspaces between stages.

To sequentially execute activities within one workspace you should use tasks in a job.

A potential way of sharing directory content would be to create artifact definitions and download them in the next stage(s).

Regards,  
Marcin

comments: author: Richard Cross
body: This is disappointing, because in Atlassian's own guide "Bamboo Best Practice: Using Stages" suggests that we Checkout \& Compile in one stage, and then run Unit Tests in the Next Stage, when clearly this is clearly impractical, as it would involve tarring up all sources and compiled test classes. With dozens of builds per hour, this really eats into disk space on even small projects.


author: Oliver Pereira
body: Another user somehow managed to share the target directory across the stages. (<https://answers.atlassian.com/questions/30180>).

But I am struggling to achieve that.


author: Oliver Pereira
body: The problem we have currently is that the integration tests a lot of time to execute and they are NOT required to run each time.

But at the same time we don't want the tasks to start from scratch for every single stage.

TeamCity allows builds to execute from one workspace and to bind all jobs / stages to a single agent.

comments: author: Peter Kahn
body: You could us NFS or smb but perf will be an issue. Zipping the important bits and distributing to later steps via maven deps or shared artifacts seems the better option.