How to change the build working directory on Bamboo Stock Image elastic agents
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
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
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
Last modified on Oct 30, 2019
Powered by Confluence and Scroll Viewport.