If you receive an error telling you that you do not have permissions to create a directory or to write a file to a directory then this is likely an indication that your script is attempting to write to a directory that the user running the build does not own.
This is a somewhat common pitfall that many users run into when the move into a CI environment.
The key thing to remember is that the builds run as the
distiller user on MacOS builds and typically
ubunutu on Linux builds. These users only have write permissions in their
$HOME folders and places like
/tmp. This is not unique to CI, this is true by default in almost all Linux/Unix environments.
To confirm which user your build runs as you can run the
whoami command as a part of your build process.
- Store things inside of a folder that the user running the build has permissions to.
- Change the ownership of the directory with the
chowncommand before trying to write to it.
We recommend the first solution. If you decide to go with the second solution then a command like this should work in both MacOS and Linux builds.
chown -R $USER:$USER /path/to/directory
$USER is a global environment variable that refers to the current logged in user.
/path/to/directory should be replaced with the path to where you want to write to.