JetBrains / teamcity-runas-plugin

The teamcity-runas plugin to run TeamCity build steps under a specified user account on Windows or Linux.
Apache License 2.0
22 stars 14 forks source link

Temporary Directory Is Created As root Without Write Permissions #32

Open kiler129 opened 6 years ago

kiler129 commented 6 years ago

Either I'm doing something really dumb, or RunAs plugin is unusable when you need to use temporary directory. The directory is created as root:root with 755 permissions, which makes build impossible to save anything.

Work directory is also inaccessible, so running e.g. php composer produces:

[14:16:12]  [Step 2/2]   [RuntimeException]                                                                                        
[14:16:12]  [Step 2/2]   /opt/jetbrains/TeamCity/buildAgent/work/f613c80626aaf1ff/vendor does not exist and could not be created.  
NikolayPianikov commented 6 years ago

@kiler129 could you provide more details. Steps to reproduce, build log file might be really helpful

KarlManong commented 2 years ago

I have the same issue using the latest nightly build Flink_Build_3.log

sresnik-e-courier commented 1 year ago

I have the same issue. I'm running my build agent as root, and relying on the runAs plugin. It appears that the temp directory under the build agents working directory (~/BuildAgent in my case) is deleted and recreated after every build. However, it is created using 755 permissions. This causes builds to fail if they require access to the temp directory while using the runAs feature.

beatmax commented 1 year ago

In my case, also the fact the git checkout is done as root was a problem. As a workaround I've configured the build to use a fixed directory (e.g. /home/teamcity/example), created a script with "chown -R user. /home/teamcity/example", added "user ALL=(root) NOPASSWD: /path/to/the/script.sh" to /etc/sudoers, and added "sudo /path/to/the/script.sh" as the first build step.