summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2022-03-24 14:39:21 -0700
committerDan Albert <danalbert@google.com>2022-03-24 14:39:51 -0700
commit18c740e8f8fa3992e23672ba8d67701f0f5a90c8 (patch)
tree9931b1610fe5a120324a3f1460f42b085502c59d
parent2778556ebb574c1da3e31f3dd858ec3621909bae (diff)
downloadndk-18c740e8f8fa3992e23672ba8d67701f0f5a90c8.tar.gz
Update script to work on off-corp machines.
Test: Used this Bug: None Change-Id: I94bc599401b10409810ed304452404b28278d36e
-rwxr-xr-xupdate.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/update.py b/update.py
index c8c821c3e..73e5d086d 100755
--- a/update.py
+++ b/update.py
@@ -41,10 +41,22 @@ def remove(path):
os.remove(path)
-def fetch_artifact(branch, build, pattern):
- fetch_artifact_path = '/google/data/ro/projects/android/fetch_artifact'
- cmd = [fetch_artifact_path, '--branch', branch, '--target=linux',
- '--bid', build, pattern]
+def fetch_artifact(branch: str, build: str, pattern: str) -> None:
+ """Fetches an artifact from the build server.
+
+ Use OAuth2 authentication and the gLinux android-fetch-artifact package,
+ which work with both on-corp and off-corp workstations."""
+ fetch_artifact_path = shutil.which('fetch_artifact')
+ if fetch_artifact_path is None:
+ raise RuntimeError(
+ 'error: cannot find fetch_artifact in PATH. Install it using:\n'
+ ' sudo glinux-add-repo android\n'
+ ' sudo apt update\n'
+ ' sudo apt install android-fetch-artifact\n')
+ cmd = [
+ fetch_artifact_path, '--use_oauth2', '--branch', branch,
+ '--target=linux', '--bid', build, pattern
+ ]
check_call(cmd)