Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Unified Diff: appengine/swarming/handlers_bot.py

Issue 2958853002: Propagate name of system service account to the bot. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/swarming/handlers_bot_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_bot.py
diff --git a/appengine/swarming/handlers_bot.py b/appengine/swarming/handlers_bot.py
index d84e75fe8fa9131ad72dadd3f6d14677c03adfd6..f961b2cc8aae410dc31999441dfb5f93f72d3b67 100644
--- a/appengine/swarming/handlers_bot.py
+++ b/appengine/swarming/handlers_bot.py
@@ -678,7 +678,9 @@ class BotPollHandler(_BotBaseHandler):
bot_event(
'request_task', task_id=run_result.task_id,
task_name=request.name)
- self._cmd_run(request, secret_bytes, run_result.key, res.bot_id)
+ self._cmd_run(
+ request, secret_bytes, run_result.key,
+ res.bot_id, res.bot_group_cfg)
except:
logging.exception('Dang, exception after reaping')
raise
@@ -692,7 +694,8 @@ class BotPollHandler(_BotBaseHandler):
# https://code.google.com/p/swarming/issues/detail?id=130
self.abort(500, 'Deadline')
- def _cmd_run(self, request, secret_bytes, run_result_key, bot_id):
+ def _cmd_run(
+ self, request, secret_bytes, run_result_key, bot_id, bot_group_cfg):
logging.info('Run: %s', request.task_id)
out = {
'cmd': 'run',
@@ -725,7 +728,18 @@ class BotPollHandler(_BotBaseHandler):
'server': request.properties.inputs_ref.isolatedserver,
} if request.properties.inputs_ref else None,
'outputs': request.properties.outputs,
- 'service_account': request.service_account,
+ 'service_accounts': {
+ 'system': {
+ # 'none', 'bot' or email. Bot interprets 'none' and 'bot' locally.
+ # When it sees something else, it uses /oauth_token API endpoint to
+ # grab tokens through server.
+ 'service_account': bot_group_cfg.system_service_account or 'none',
+ },
+ 'task': {
+ # Same here.
+ 'service_account': request.service_account,
+ },
+ },
'task_id': task_pack.pack_run_result_key(run_result_key),
},
}
« no previous file with comments | « no previous file | appengine/swarming/handlers_bot_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698