Skip to content

Commit

Permalink
Use cipd ensure instead of cipd install -f
Browse files Browse the repository at this point in the history
The ONLY supported way to get cipd packages on machines is via
`cipd ensure`.

Bug: 1245099
Change-Id: I5c316571c92b4e0d0f4af85cd4eeb18cba2c30c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3134387
Auto-Submit: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Cr-Commit-Position: refs/heads/main@{#917130}
  • Loading branch information
ukai authored and Chromium LUCI CQ committed Sep 1, 2021
1 parent bc3c9ea commit 2d49310
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions buildtools/reclient_cfgs/fetch_reclient_cfgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ def NaclRevision():
cwd= nacl_dir,
).decode('utf-8').strip()

def CipdInstall(pkg_name, ref, directory):
print('install %s %s in %s' % (pkg_name, ref, directory))
if not os.path.exists(directory):
os.makedirs(directory, mode=0o755)
if not os.path.exists(os.path.join(directory, '.cipd')):
subprocess.check_call(['cipd', 'init', '-force'], cwd=directory)
subprocess.check_call(
['cipd', 'install', '-force', pkg_name, ref],
cwd=directory)
def CipdEnsure(pkg_name, ref, directory):
print('ensure %s %s in %s' % (pkg_name, ref, directory))
output = subprocess.check_output(
['cipd', 'ensure', '-root', directory,
'-ensure-file', '-'],
input=('%s %s' % (pkg_name, ref)).encode('utf-8'))
print(output)

def RbeProjectFromEnv():
instance = os.environ.get('RBE_instance')
Expand Down Expand Up @@ -79,7 +77,7 @@ def main():
print('failed to detect %s revision' % toolchain)
continue

CipdInstall(posixpath.join(cipd_prefix, toolchain),
CipdEnsure(posixpath.join(cipd_prefix, toolchain),
ref='revision/' + revision,
directory=os.path.join(THIS_DIR, toolchain))
if os.path.exists(os.path.join(THIS_DIR,
Expand Down

0 comments on commit 2d49310

Please sign in to comment.