chdir %teamcity.build.checkoutDir% as first build step issue:

After doing an agent side checkout on RHEL Linux using TeamCity Professional Version 6.5.6, I need to change into the root folder of the checkout directory prior to running the "make" command.  So I setup the first build step the follows:

Runner: Command Line

Working directory: %teamcity.build.checkoutDir%

Run: Executable with parameters

Command executable: chdir

Command parameters: %teamcity.build.checkoutDir%

Unfortunately; when the first build step executes after a successful checkout from VCS into this same directory,  I receive the following error:

[15:12:01]: Checking for changes
[15:12:02]: Clean build enabled: removing old files from /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9
[15:12:02]: Clearing temporary directory: /home/villanux/software/TeamCity/TeamCity/buildAgent/temp/buildTmp
[15:12:02]: Checkout directory: /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9

[15:12:02]: Updating sources: agent side checkout... (3s)
[15:12:02]: [Updating sources: agent side checkout...] Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[15:12:02]: [Updating sources: agent side checkout...] Cleaning /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9
[15:12:02]: [Updating sources: agent side checkout...] VCS Root: MAS-Mapcpp (3s)
[15:12:02]: [VCS Root: MAS-Mapcpp] revision: 3544553
[15:12:02]: [VCS Root: MAS-Mapcpp] Updating sources for Perforce root MAS-Mapcpp (3s)
[15:12:02]: [Updating sources for Perforce root MAS-Mapcpp] Will use p4 executable from '/home/masdev/perforce/linux_64/p4'
[15:12:04]: [Updating sources for Perforce root MAS-Mapcpp] Running 'p4 sync -f'
[15:12:06]: [VCS Root: MAS-Mapcpp] Setting P4CLIENT environment variable to TC_p4_nybc111lxb08_Agent_176dab1334d337b9_402d593f88e2ef2a
[15:12:06]: Publishing internal artifacts
[15:12:06]: [Publishing internal artifacts] Sending build.start.properties.gz file
[15:12:06]: Step 1/2: Change into Root Directory (Command Line)
[15:12:06]: [Step 1/2] Starting: chdir /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9
[15:12:06]: [Step 1/2] in directory: /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9
[15:12:06]: [Step 1/2] Cannot run process chdir /home/villanux/software/TeamCity/TeamCity/buildAgent/work/176dab1334d337b9 : file not found
[15:12:06]: [Step 1/2] Step Change into Root Directory (Command Line) failed with unexpected error

[15:12:06]: Build step Build (Command Line) skipped because of previous step failure
[15:12:06]: Publishing internal artifacts
[15:12:06]: [Publishing internal artifacts] Sending build.finish.properties.gz file
[15:12:06]: Build finished


Why TeamCity can not change directory into the same location where the source files were checkout?
1 comment
Comment actions Permalink

Hi,

   Two issues here:
   1. there is no chdir command on Linux. There is 'cd' command
   2. There is no need to run 'cd' command. TeamCity runs command specifiled in the build step in the 'working directory' which is by default the same as checkout directory.

   I.e. you don't need the build step you're trying to create.
   Just create build step with 'make' command.

   HTH,
   KIR

0

Please sign in to leave a comment.