How to change the build working directory on Bamboo Stock Image elastic agents
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Storage limits on some elastic agent instances might require that the build directory of the elastic agent be relocated.
Workaround
You can solve this problem by adding a startup script to your image in Bamboo that will mount an external storage location to a local folder and update the agent configuration.
In Bamboo server, go to Admin >> Elastic Instances >> Image Configurations
Select the Stock image you want to customize and click Edit
Go to Instance startup script field and add the following script:
Linux Stock image
1 2 3 4 5 6 7 8 9
mkdir /b chown bamboo:bamboo -R /b mkdir -p /mnt/bamboo-ebs/bamboo-agent/ cp /opt/bamboo-elastic-agent/ebs-resources/bamboo-agent.cfg.xml /mnt/bamboo-ebs/bamboo-agent/ chown bamboo:bamboo -R /mnt/bamboo-ebs sed -i 's:<buildWorkingDirectory>.*</buildWorkingDirectory>:<buildWorkingDirectory>/b</buildWorkingDirectory>:g' /mnt/bamboo-ebs/bamboo-agent/bamboo-agent.cfg.xml su - bamboo -c "/opt/bamboo-elastic-agent/ebs-resources/customiseInstance.sh"
Windows Stock image
1 2 3 4
mkdir C:\b icacls "C:\b" /grant Bamboo:(OI)(CI)F /T sed -i "s/<buildWorkingDirectory>.*</<buildWorkingDirectory>c:\\\b</" C:\Users\Bamboo\bamboo-agent-home\bamboo-agent.cfg.template.xml
Start your elastic instance
Was this helpful?