Executing NUKE Build Scripts on Linux Machines with Correct File Permissions

Georg Dangl by Georg Dangl in Linux Sunday, February 16, 2020

Sunday, February 16, 2020

I've blogged before about the NUKE build system, a great tool written by Matthias Koch that allows you to define all your build steps in a C# project, complete with full IDE integration and lots of helpers to get you started quickly. Since work on NUKE has begun almost three years ago, it's grown to be a fully featured build system with a great community. We're using it in all of our projects at DanglIT, and the experience so far has been great!

One thing, though, that's always bugged us was that when we invoked the build on Linux machines, we always had to explicitly prefix it with the shell command, like bash build.sh Test -Configuration Debug

We could never directly invoke the build scripts comfortably on Linux, no matter if we were using a project that has had NUKE added over 2 years ago or for a fresh install. First, we thought it might have been related to line ending differences, since all our development happens on Windows machines. That could quickly be checked, and it wasn't the case - checkout worked as expected on Linux.

After some digging to find out what we were doing wrong, it turned out that the culprit was the executable permissions of the scripts. If you're on Linux or Mac, git will recognize scripts as executable files and mark them as such. If you're on Windows, however, they're simply added as regular files. The answer from Antwane at StackOverflow explains it quite nice, but in short, you just set the chmod permission via git: git update-index --chmod=+x build.cmd​

Before, we saw that the file permissions were 644, or read/write:

Wrong file permissions in git for executable scripts

After updating the index, we get the correct permissions, including executable 755:

Build script permissions in git with executable enabled

After you've done that, commit your changes. Now, your scripts should also work on Linux as expected. At least, it worked for us!

Happy building!


Share this post


comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.

DanglIT

Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

Dangl.Blog();
// Just 💗 Coding

Social Links