简体   繁体   中英

TeamCity The system cannot find the file specified

I was trying to run a customer script on TeamCity. This script is to rename a release tar file previous release to artifactory local directory. Remove the snapshot and date in the name of tar file:

ren %teamcity.build.checkoutDir%\target\project-%maven.project.version%-pkg.tar.gz project-%maven.project.version%-%build.counter%-pkg.tar.gz
ren %teamcity.build.checkoutDir%\target\project-%maven.project.version%-pkg.zip project-%maven.project.version%-%build.counter%-pkg.zip

For example, I have a tar file named project-3.0.18-20170324.190100-1.pom , i want to rename it to project-8.0.18.pom .

The problem i got now is :

Step 2/2: rename snapshot (Command Line)
[09:59:08][Step 2/2] Starting: C:\BuildAgent\temp\agentTmp\custom_script193311797169104291.cmd
[09:59:08][Step 2/2] in directory: C:\BuildAgent\work\46536700c4bd208f
[09:59:08][Step 2/2] The system cannot find the file specified.
[09:59:08][Step 2/2] The system cannot find the file specified.
[09:59:08][Step 2/2] Process exited with code 1
[09:59:08][Step 2/2] Process exited with code 1
[09:59:08][Step 2/2] Step rename snapshot (Command Line) failed

I am not sure what exactly is the problem. why teamcity is looking for the command line in C:\\BuildAgent\\temp\\agentTmp\\custom_script193311797169104291.cmd. And why it can not find it?

Thanks!

the custom_script193311797169104291.cmd - a temporary generated file with script you want to execute.

just add some echo commands into your command script to see if it works.

echo workdir=%teamcity.build.checkoutDir%
echo version=%maven.project.version%
echo %teamcity.build.checkoutDir%\target\project-%maven.project.version%-pkg.tar.gz

and check that source file exists...

actually the ren command reports that file not found.

nothing about scriptname

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM