File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,16 @@ def execute cmd
15
15
# so any previously created files don't pollute this and subsequent synth runs.
16
16
execute "git clean -df"
17
17
18
- Dir . chdir "google-apis-generator"
18
+ # This script is generally run as a superuser in a container. As a result,
19
+ # newly generated files will have a superuser owner, and cannot easily be
20
+ # removed by the caller. Thus, we must ensure any files generated during this
21
+ # run are given a reasonable owner before the script exits.
22
+ at_exit do
23
+ user_group = ENV [ "USER_GROUP" ]
24
+ execute "chown -R #{ user_group } #{ DIR } /generated" if user_group
25
+ end
19
26
27
+ Dir . chdir "google-apis-generator"
20
28
execute "bundle install"
21
29
22
30
if ARGV . empty?
Original file line number Diff line number Diff line change 31
31
f"-v{ os .getcwd ()} :/workspace" ,
32
32
"-v/var/run/docker.sock:/var/run/docker.sock" ,
33
33
"-w" , "/workspace" ,
34
+ "-e" , f"USER_GROUP={ os .getuid ()} :{ os .getgid ()} " ,
34
35
"--entrypoint" , "script/synth.rb" ,
35
36
"gcr.io/cloud-devrel-kokoro-resources/yoshi-ruby/autosynth" ]
36
37
if extra_args ():
You can’t perform that action at this time.
0 commit comments