chore: Ensure newly created files have a reasonable owner (#2465)
This commit is contained in:
parent
82d85805a8
commit
405800782c
|
@ -15,8 +15,16 @@ end
|
||||||
# so any previously created files don't pollute this and subsequent synth runs.
|
# so any previously created files don't pollute this and subsequent synth runs.
|
||||||
execute "git clean -df"
|
execute "git clean -df"
|
||||||
|
|
||||||
Dir.chdir "google-apis-generator"
|
# This script is generally run as a superuser in a container. As a result,
|
||||||
|
# newly generated files will have a superuser owner, and cannot easily be
|
||||||
|
# removed by the caller. Thus, we must ensure any files generated during this
|
||||||
|
# run are given a reasonable owner before the script exits.
|
||||||
|
at_exit do
|
||||||
|
user_group = ENV["USER_GROUP"]
|
||||||
|
execute "chown -R #{user_group} #{DIR}/generated" if user_group
|
||||||
|
end
|
||||||
|
|
||||||
|
Dir.chdir "google-apis-generator"
|
||||||
execute "bundle install"
|
execute "bundle install"
|
||||||
|
|
||||||
if ARGV.empty?
|
if ARGV.empty?
|
||||||
|
|
1
synth.py
1
synth.py
|
@ -31,6 +31,7 @@ command = [
|
||||||
f"-v{os.getcwd()}:/workspace",
|
f"-v{os.getcwd()}:/workspace",
|
||||||
"-v/var/run/docker.sock:/var/run/docker.sock",
|
"-v/var/run/docker.sock:/var/run/docker.sock",
|
||||||
"-w", "/workspace",
|
"-w", "/workspace",
|
||||||
|
"-e", f"USER_GROUP={os.getuid()}:{os.getgid()}",
|
||||||
"--entrypoint", "script/synth.rb",
|
"--entrypoint", "script/synth.rb",
|
||||||
"gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/autosynth"]
|
"gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/autosynth"]
|
||||||
if extra_args():
|
if extra_args():
|
||||||
|
|
Loading…
Reference in New Issue