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

How to retrieve source code from Bit Bucket repository via Bamboo

tomrode December 7, 2018

Is it possible to have Bamboo pull Source code from a Repository of my choosing and then place this into a local folder on my host Desktop computer? I need this function to bring on these source files and folders to a specific location on my "C" drive  (i.e. C:\rtc_workspaces\TmlVcmMasterBuildDefBamboo)  Place code here? Does Bamboo work this way?  I tried to add a task called "Source Code Checkout" inside of my Job.  

Thanks,

-Tom

1 answer

0 votes
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 11, 2018

Hi Thomas,

The Source Code Checkout task will allow you to checkout your code only to subdirectories of the plan working directory. It is where the plan will run your tasks. By default this location is configured to: <Bamboo_Home>\xml-data\build-dir\ . This location can be set to a different folder as descried in this document: Specifying Bamboo's working directory

If you just want this change for a specific plan I would suggest you using a script task to copy or move your files after the checkout.

tomrode December 13, 2018

Hi Daniel thanks for the reply, In my list of Task within my job I first ran a Source Code Checkout which as you said it placed the Repo contents in the Bamboo_Home\xml-data\build-dir, this was a good step. Next I used another task called Script and added a couple of Inline MSDOS batch file commands to change the directory to a place where I want these repos to go then I issued a Copy. So now the last thing I need is a batch file to run to start the regression process. I initially added a MSDOS command “call TmlVcmMasterBuildScript003.bat” but that did not seem to do any thing. What I do in this circumstance to have Bamboo call an external MS batch file? I just need this last piece and I got it. Thanks again.  

Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 13, 2018

Hi Thomas, I'm glad we have some progress here.
What is the content inside the TmlVcmMasterBuildScript003.bat script?
What did you see in the build logs when you try to run that command?
I just tested a simple batch file called from a script task and it worked fine. I used the following config:

  • Interpreter:
    • Shell
    • /bin/sh or cmd.exe)
      (i)Tested with both
  • Script location: Inline 
  • Script body: 
    • c:<path>\script.bath
    • call c:<path>\script.bath
      (i)Tested with both

Please check the build logs and the agent logs in case you run this plan on a remote agent. You should at least see an error in your logs in case there is something failing. You can also try to change the content of your batch file to something that will allow you to easier to check if the script was run or not.

Please keep us posted. =]

tomrode December 13, 2018

Hi Daniel, 

Well I added another Task Script with these setting:

    Interpreter:

  •         Shell

    Script location

  •         inline

Here is the script body:

cd \vcast-buildsystem-orig
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%
set stamp=Regression_%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%
md %stamp%
copy Regression-Original-Scripts\*.* %stamp%
@echo ON
cd %stamp%
call StartRegression.bat

I was hoping to call TmlVcmMasterBuildScript003.bat  in which this is the above commands but this inline approach worked. 

This time it went further. I did notice in my previous task Script 

the Interpreter was set as:

  •    Windows PowerShell

in which I also had a couple lines in the Script body.

But Your example I think got me over the hump....So thank you very much   ;-)

 

Kind regards,

-Tom  

Like Daniel Santos likes this
Daniel Santos
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 13, 2018

Hi Tom,
Thank you for sharing those details.
I'm glad to see that you are now good to go! =]

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events