File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 2121from taskgraph .util import docker
2222from taskgraph .util .taskcluster import (
2323 get_artifact_url ,
24+ get_root_url ,
2425 get_session ,
2526 get_task_definition ,
2627)
@@ -295,7 +296,15 @@ def load_task(task_id, remove=True):
295296 image_task_id = task_def ["payload" ]["image" ]["taskId" ]
296297 image_tag = load_image_by_task_id (image_task_id )
297298
298- env = task_def ["payload" ].get ("env" )
299+ # Set some env vars the worker would normally set.
300+ env = {
301+ "RUN_ID" : "0" ,
302+ "TASK_GROUP_ID" : task_def .get ("taskGroupId" , "" ),
303+ "TASK_ID" : task_id ,
304+ "TASKCLUSTER_ROOT_URL" : get_root_url (False ),
305+ }
306+ # Add the task's environment variables.
307+ env .update (task_def ["payload" ].get ("env" , {}))
299308
300309 envfile = None
301310 initfile = None
Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ def test_load_task(run_load_task):
151151 "run" ,
152152 "-v" ,
153153 re .compile (f"{ tempfile .gettempdir ()} /tmp.*:/builds/worker/.bashrc" ),
154+ re .compile (f"--env-file={ tempfile .gettempdir ()} /tmp.*" ),
154155 "-it" ,
155156 "image/tag" ,
156157 "bash" ,
@@ -163,6 +164,8 @@ def test_load_task(run_load_task):
163164 mocks ["subprocess_run" ].assert_called_once ()
164165 actual = mocks ["subprocess_run" ].call_args [0 ][0 ]
165166
167+ print (expected )
168+ print (actual )
166169 assert len (expected ) == len (actual )
167170 for i , exp in enumerate (expected ):
168171 if isinstance (exp , re .Pattern ):
You can’t perform that action at this time.
0 commit comments