I have a build plan that should run on any agent (Linux or Windows)
In the plan I have a Script Task which calls a script file on the server. For this I have to provide the filename of my script.
Script file is called gradlew for Linux and gradlew.bat for Windows. Both files are present in the working directory when checking out the git repo.
After some troubleshooting I replaced "gradlew" by "gradlew.bat" in the script task.
This worked! But not for linux of course
I thought using an inline script could solve the problem but then I would have to call /bin/sh gradlew on Linux which won't work on Windows again.
Any ideas how to handle this?
What might work is adding a capability to each agent. For Windows agents the value would be .bat, for Linux agents it will be empty. Let's call it file.extension
In the script task we can set gradlew${bamboo.capabilities.file.extension}}} as file name
Linux does not care about extension names, in the sense that they have magic meanings. Rename gradlew to gradlew.bat on linux
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You mean the file itself in the working directory?
Can't really do that as gradlew.bat already exists for Windows. Both files are being checked out of GIT on each OS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, but then again. The sylmlink has to be created at the beginning of each build because we're starting from a clean directory. The ln command would work on Linux but throw an error on Windows
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This might help, if the script using this trick is used the appropriate script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I removed the symlink comment when I thought the same thing you did. But, perhaps if the symlink was created by a different user (not as part of the build) and bamboo was not given permission to delete (chmod 755) it might work. Sort of depends on how bamboo cleans directory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok thanks for clarifying and your suggestion.
I will ask the developers using the build plan if that stackoverflow idea helps them out. I had another idea myself that might be easier but not ideal. Adding it in a minute
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bamboo has settings to clean or not clean directories. This may cause problems. If so, adding a task to the script to clean directories instead of bamboo before the loading of the repository data might work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.