aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra
diff options
context:
space:
mode:
authorGravatar Ravi Mistry <rmistry@google.com>2017-03-20 10:43:26 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-20 16:14:01 +0000
commit25d540fa6e53a4a02afab55fc75da4588b799a8a (patch)
treedbd5b8c9fba675887e4d83330aa166a92dec5e17 /infra
parent480951f618822433874ae45c1ac084419bb79f9d (diff)
Enable CIPD automatic GCE authentication and fix upload_skps.py
BUG=skia:6385 Change-Id: I4bb278f99eb3131138a37b7f8752ef404766811e Reviewed-on: https://skia-review.googlesource.com/9824 Reviewed-by: Eric Boren <borenet@google.com> Commit-Queue: Ravi Mistry <rmistry@google.com>
Diffstat (limited to 'infra')
-rw-r--r--infra/bots/assets/asset_utils.py13
-rw-r--r--infra/bots/upload_skps.py7
2 files changed, 11 insertions, 9 deletions
diff --git a/infra/bots/assets/asset_utils.py b/infra/bots/assets/asset_utils.py
index 3dd34ba2ad..244502e51c 100644
--- a/infra/bots/assets/asset_utils.py
+++ b/infra/bots/assets/asset_utils.py
@@ -56,7 +56,7 @@ class CIPDStore(object):
def _check_setup(self):
"""Verify that we have the CIPD binary and that we're authenticated."""
try:
- subprocess.check_call([self._cipd, 'auth-info'])
+ self._run(['auth-info'], specify_service_url=False)
except OSError:
raise Exception('CIPD binary not found on your path (typically in '
'depot_tools). You may need to update depot_tools.')
@@ -64,12 +64,19 @@ class CIPDStore(object):
raise Exception('CIPD not authenticated. You may need to run:\n\n'
'$ %s auth-login' % self._cipd)
- def _run(self, cmd):
+ def _run(self, cmd, specify_service_url=True):
"""Run the given command."""
+ cipd_args = []
+ if specify_service_url:
+ cipd_args.extend(['--service-url', self._cipd_url])
+ if os.getenv('USE_CIPD_GCE_AUTH'):
+ # Enable automatic GCE authentication. For context see
+ # https://bugs.chromium.org/p/skia/issues/detail?id=6385#c3
+ cipd_args.extend(['-service-account-json', ':gce'])
subprocess.check_call(
[self._cipd]
+ cmd
- + ['--service-url', self._cipd_url]
+ + cipd_args
)
def _json_output(self, cmd):
diff --git a/infra/bots/upload_skps.py b/infra/bots/upload_skps.py
index a1833dfc0f..dab91303c8 100644
--- a/infra/bots/upload_skps.py
+++ b/infra/bots/upload_skps.py
@@ -27,12 +27,6 @@ SKIA_REPO = 'https://skia.googlesource.com/skia.git'
def main(target_dir, gitcookies):
with git_utils.NewGitCheckout(repository=SKIA_REPO):
- # Download CIPD.
- cipd_sha1 = os.path.join(os.getcwd(), 'infra', 'bots', 'tools', 'luci-go',
- 'linux64', 'cipd.sha1')
- subprocess.check_call(['download_from_google_storage', '-s', cipd_sha1,
- '--bucket', 'chromium-luci'])
-
# First verify that there are no gen_tasks diffs.
gen_tasks = os.path.join(os.getcwd(), 'infra', 'bots', 'gen_tasks.go')
try:
@@ -45,6 +39,7 @@ def main(target_dir, gitcookies):
# Skip GCE Auth in depot_tools/gerrit_utils.py. Use gitcookies instead.
os.environ['SKIP_GCE_AUTH_FOR_GIT'] = 'True'
os.environ['GIT_COOKIES_PATH'] = gitcookies
+ os.environ['USE_CIPD_GCE_AUTH'] = 'True'
# Upload the new version, land the update CL as the update-skps user.
config_dict = {
'user.name': SKIA_COMMITTER_NAME,