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

how to Change the build working directory on Bamboo Stock Image elastic agents

Mohammed.Ammar February 27, 2023

Hi,

 

how to Change the build working directory on Bamboo Elastic agent ?

I used the below

i want to change from this to C:\Users\bamboo_agent\bamboo-agent-home\xml-data\build-dir\  to C:\Users\bamboo_agent

icacls "C:\Users\bamboo_agent" /grant Bamboo:(OI)(CI)F /T
sed -i "s/<buildWorkingDirectory>.*</<buildWorkingDirectory>c:\\\Users\bamboo_agent</" C:\Users\bamboo_agent\bamboo-agent-home\bamboo-agent.cfg.template.xml

Please help and have a look, if anything i wrong or needs change

 

Thank you

1 answer

0 votes
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2023

Hello @Mohammed.Ammar

Welcome to Atlassian Community!

You are correct. You have to modify the bamboo-agent.cfg.template.xml file to indicate another path for the build location.

Your sed command seems wrong. Try this:

sed -i 's@\(.*\<buildWorkingDirectory>\)\(.*\)\(</buildWorkingDirectory>.*\)@\1C\:\\Users\\bamboo_agent\3@' bamboo-agent.cfg.template.xml

The sed above uses 3 capture groups and replaces the second one with the content you want. E.g.:

<buildWorkingDirectory>C:\Users\bamboo_agent</buildWorkingDirectory>

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Mohammed.Ammar February 27, 2023

Hi @Eduardo Alvarenga

sed -i 's@\(.*\<buildWorkingDirectory>\)\(.*\)\(</buildWorkingDirectory>.*\)@\1C\:\\Users\\bamboo_agent\3@' bamboo-agent.cfg.template.xml

This not worked, FYI.. we have added this script in Bamboo server, go to Admin >> Elastic Instances >> Image Configurations >> Instance startup script field

 

Do we need to change/add anything on Elastic Instance level, I mean add anything on bamboo-agent.cfg.template.xml File ?

Please let us know, if i am doing anything any wrong ?
Thank you

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 27, 2023

Hello @Mohammed.Ammar

When you mentioned customisation, I assumed you were making changes to the Image that was going to be used as a new AMI.

As you are going to use the Instance Startup Script you need to add the whole path to the XML file as an argument and protect some backslashes as it will make use of GNU "sed" which is part of Cygwin. Make sure to understand the full extension of the command before adding it to the instance.

This should work as an Instance Startup Script:

mkdir C:\Users\bamboo_agent
icacls "C:\Users\bamboo_agent" /grant Bamboo:(OI)(CI)F /T
sed -i "s@\(.*\<buildWorkingDirectory>\)\(.*\)\(</buildWorkingDirectory>.*\)@\1C\:\\\\Users\\\\Bamboo_agent\3@" c:\Users\Bamboo\bamboo-agent-home\bamboo-agent.cfg.template.xml

Thanks!

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Mohammed.Ammar February 28, 2023

Hi @Eduardo Alvarenga 

Thank you for looking into it.

The script is still not working, There is something i have noticed..

In our setup we have only "bamboo-agent.cfg.xml" File present in Path: C:\Users\bamboo_agent\bamboo-agent-home\bamboo-agent.cfg.xml

But no "bamboo-agent.cfg.template.xml" File is present, Does both the files same or is it different ? or we missing any configuration ?

 

Thank You

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2023

Hello @Mohammed.Ammar

The provided answer assumes you are using the stock images provided by Atlassian and that you are running a supported version of Bamboo. If you are running a customised version of that image or even a totally different one -- based on the C:\Users\Bamboo_agent instead of the default C:\Users\Bamboo -- you will have to adapt the instructions to your environment.

Unfortunately, we don't support customised images as every customer has their own version and that would become impossible to maintain.

Best regards,

 

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events