Team City not find build.sh file
Answered
I have configured a new build in Team City which make use of the Cake Build. I have configured my build to use a command line and it points to build.sh file.
When then build executes , I get an error
[Step 1/1] Cannot run process /home/gary/BuildAgent/work/dfc2ba41612b9ef7/build.sh : file not found
[15:12:50][Step 1/1] Step Run Cake Build Script (Command Line) failed with unexpected error
However when I actually navigate to the folder on the build agent server I can see the build.sh file in the directory.
I have found this
How have tried to change permissions on the file itself in the directory i.e. running chmod x+ build.sh
I have also tried convert the line endings as suggested. However still no joy!
Please sign in to leave a comment.
Hi Gary,
The file not found error is common when permissions aren't there. As the first response on SO points out, it doesn't necessarily mean that the file itself doesn't have them, but you might also need to make sure that the user that runs the teamcity build agent has rx access to all the folders in the path. If the user running the build agent cannot access "/home/gary" for example, it won't be able to access any of its subfolders. Also take into account, that if the files get changed/removed, the permissions are likely to be returned to the repository version.
Another option, if you are running the command line and the user has, again, read access to the full path, is to instead of trying to call the "sh" file directly, try to call it through bash (or your shell of choice).
If this doesn't work, you could, instead of using the command line step by passing a path to a file, use the command line step to pass commands so that you cd into the directory and then try to run the script, and see what error you get from there.