@@ -428,6 +428,15 @@ def get_shared_gcs_path(gcs_shared, use_shared_build):
428
428
build_file += 'build-location.txt'
429
429
return os .path .join (gcs_shared , os .getenv ('PULL_REFS' , '' ), build_file )
430
430
431
+ def inject_bazelrc (lines ):
432
+ if not lines :
433
+ return
434
+ with open ('/etc/bazel.bazelrc' , 'a' ) as fp :
435
+ fp .writelines (lines )
436
+ path = os .path .join (os .getenv ('HOME' ), '.bazelrc' )
437
+ with open (path , 'a' ) as fp :
438
+ fp .writelines (lines )
439
+
431
440
def main (args ):
432
441
"""Set up env, start kubekins-e2e, handle termination. """
433
442
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
@@ -447,6 +456,8 @@ def main(args):
447
456
if not os .path .isdir (artifacts ):
448
457
os .makedirs (artifacts )
449
458
459
+ inject_bazelrc (args .inject_bazelrc )
460
+
450
461
mode = LocalMode (workspace , artifacts )
451
462
452
463
for env_file in args .env_file :
@@ -639,6 +650,9 @@ def create_parser():
639
650
parser .add_argument (
640
651
'--build' , nargs = '?' , default = None , const = '' ,
641
652
help = 'Build kubernetes binaries if set, optionally specifying strategy' )
653
+ parser .add_argument (
654
+ '--inject-bazelrc' , default = [], action = 'append' ,
655
+ help = 'Inject /etc/bazel.bazelrc and ~/.bazelrc lines' )
642
656
parser .add_argument (
643
657
'--build-federation' , nargs = '?' , default = None , const = '' ,
644
658
help = 'Build federation binaries if set, optionally specifying strategy' )
0 commit comments