From f685680a9b1422b2feac82695a5b30f0b826f8f3 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 15:24:12 -0800 Subject: [PATCH 1/7] Update set of terminal statuses for v4 `COMPLETE` and `ERROR` are now deprecated. Bug: 415365146 --- .../cvd/cuttlefish/host/libs/web/android_build_api.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp index e77c35aed09..eaa5fc8c726 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp +++ b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp @@ -58,7 +58,15 @@ namespace { bool StatusIsTerminal(const std::string& status) { const static std::set terminal_statuses = { - "abandoned", "complete", "error", "ABANDONED", "COMPLETE", "ERROR", + "abandoned", + "ABANDONED", + "built", + "BUILT", + // deprecated in v4, but kept around for compatibility until removed + "complete", + "COMPLETE", + "error", + "ERROR", }; return terminal_statuses.count(status) > 0; } From f4930be948ce811155212914839af6d843fd0a8a Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 15:25:45 -0800 Subject: [PATCH 2/7] Move build API base URL into the relevant file All of the other URL handling was moved into this file previously. Bug: 415365146 --- base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel | 2 +- base/cvd/cuttlefish/host/commands/cvd/fetch/build_api_flags.h | 2 +- base/cvd/cuttlefish/host/libs/web/android_build_api.h | 3 --- base/cvd/cuttlefish/host/libs/web/android_build_url.h | 3 +++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel index dccfd3e974a..6103283a4b0 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel @@ -13,7 +13,7 @@ cf_cc_library( "//cuttlefish/common/libs/utils:flag_parser", "//cuttlefish/host/commands/cvd/cache", "//cuttlefish/host/commands/cvd/fetch:credential_flags", - "//cuttlefish/host/libs/web:android_build_api", + "//cuttlefish/host/libs/web:android_build_url", "//cuttlefish/host/libs/web/cas:cas_flags", "//cuttlefish/result", "//libbase", diff --git a/base/cvd/cuttlefish/host/commands/cvd/fetch/build_api_flags.h b/base/cvd/cuttlefish/host/commands/cvd/fetch/build_api_flags.h index f586298a79e..a356bdac1e9 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/fetch/build_api_flags.h +++ b/base/cvd/cuttlefish/host/commands/cvd/fetch/build_api_flags.h @@ -22,7 +22,7 @@ #include "cuttlefish/host/commands/cvd/cache/cache.h" #include "cuttlefish/host/commands/cvd/fetch/credential_flags.h" -#include "cuttlefish/host/libs/web/android_build_api.h" +#include "cuttlefish/host/libs/web/android_build_url.h" #include "cuttlefish/host/libs/web/cas/cas_flags.h" namespace cuttlefish { diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_api.h b/base/cvd/cuttlefish/host/libs/web/android_build_api.h index 9f5e5a550e8..3e8503fe242 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_api.h +++ b/base/cvd/cuttlefish/host/libs/web/android_build_api.h @@ -35,9 +35,6 @@ namespace cuttlefish { -inline constexpr char kAndroidBuildServiceUrl[] = - "https://www.googleapis.com/android/internal/build/v3"; - class AndroidBuildApi : public BuildApi { public: AndroidBuildApi() = delete; diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_url.h b/base/cvd/cuttlefish/host/libs/web/android_build_url.h index 7bd29805099..4fdcb202e7c 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_url.h +++ b/base/cvd/cuttlefish/host/libs/web/android_build_url.h @@ -21,6 +21,9 @@ namespace cuttlefish { +inline constexpr char kAndroidBuildServiceUrl[] = + "https://www.googleapis.com/android/internal/build/v3"; + class AndroidBuildUrl { public: AndroidBuildUrl(std::string api_base_url, std::string api_key, From 560a67c0888e12bbae7ff601524b4bd159e5c0ef Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 15:36:41 -0800 Subject: [PATCH 3/7] Update to the v4 base URL Bug: 415365146 --- base/cvd/cuttlefish/host/libs/web/android_build_url.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_url.h b/base/cvd/cuttlefish/host/libs/web/android_build_url.h index 4fdcb202e7c..21098fbf7fa 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_url.h +++ b/base/cvd/cuttlefish/host/libs/web/android_build_url.h @@ -22,7 +22,7 @@ namespace cuttlefish { inline constexpr char kAndroidBuildServiceUrl[] = - "https://www.googleapis.com/android/internal/build/v3"; + "https://androidbuild-pa.googleapis.com/v4"; class AndroidBuildUrl { public: From 928e674642b21114f5f4bb87ae2662495a0d5e5d Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 16:04:19 -0800 Subject: [PATCH 4/7] Update builds.list request parameters Match new names of parameters and enums. Bug: 415365146 --- base/cvd/cuttlefish/host/libs/web/android_build_url.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp b/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp index 356e2d53648..7516b9ac106 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp +++ b/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp @@ -118,12 +118,12 @@ AndroidBuildUrl::AndroidBuildUrl(std::string api_base_url, std::string api_key, std::string AndroidBuildUrl::GetLatestBuildIdUrl(std::string_view branch, std::string_view target) { UrlBuilder builder = UrlBuilder::GetLatestBuildIdBaseUrl(api_base_url_); - builder.AddQueryParameter("buildAttemptStatus", "complete"); + builder.AddQueryParameter("buildAttemptStatus", "built"); builder.AddQueryParameter("buildType", "submitted"); - builder.AddQueryParameter("maxResults", "1"); + builder.AddQueryParameter("pageSize", "1"); builder.AddQueryParameter("successful", "true"); - builder.AddQueryParameter("branch", branch); - builder.AddQueryParameter("target", target); + builder.AddQueryParameter("branches", branch); + builder.AddQueryParameter("targets", target); builder.AddApiKeyAndProjectId(api_key_, project_id_); return builder.GetUrl(); From c26a49df23b23894443bd89504571f88dcebef99 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 16:21:11 -0800 Subject: [PATCH 5/7] Update build response handling Match the new field name. Bug: 415365146 --- base/cvd/cuttlefish/host/libs/web/android_build_api.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp index eaa5fc8c726..d9eddc0403c 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp +++ b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp @@ -221,8 +221,8 @@ Result AndroidBuildApi::GetBuildInfo( << no_auth_error_message); bool is_signed = false; - if (json.isMember("signed")) { - is_signed = json["signed"].asBool(); + if (HasValue(json, {"buildSigned"})) { + is_signed = CF_EXPECT(GetValue(json, {"buildSigned"})); } return AndroidBuildApi::BuildInfo{ From 45fb64ff9dc8de60e030b03a3abc443b12a074b5 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 16:24:18 -0800 Subject: [PATCH 6/7] Update builds.attempts.artifacts/list URL Match the updated parameter for number of results. Bug: 415365146 --- base/cvd/cuttlefish/host/libs/web/android_build_url.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp b/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp index 7516b9ac106..6975013b57a 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp +++ b/base/cvd/cuttlefish/host/libs/web/android_build_url.cpp @@ -143,7 +143,7 @@ std::string AndroidBuildUrl::GetArtifactUrl( std::string_view page_token) { UrlBuilder builder = UrlBuilder::GetArtifactBaseUrl(api_base_url_, id, target); - builder.AddQueryParameter("maxResults", "100"); + builder.AddQueryParameter("pageSize", "100"); // maximum value allowed by API if (!artifact_filenames.empty()) { builder.AddQueryParameter("nameRegexp", BuildNameRegexp(artifact_filenames)); From 40e452e7ac9ec2fb3701babaac20be0ef90973d2 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Mon, 24 Nov 2025 16:14:25 -0800 Subject: [PATCH 7/7] DO NOT MERGE add debug output --- base/cvd/cuttlefish/host/libs/web/android_build_api.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp index d9eddc0403c..6afe180252f 100644 --- a/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp +++ b/base/cvd/cuttlefish/host/libs/web/android_build_api.cpp @@ -275,6 +275,7 @@ Result> AndroidBuildApi::LatestBuildId( "Error fetching last known good build " "id for:\nbranch \"{}\", target \"{}\"", branch, target); + LOG(INFO) << "\n\n TODO CJR \n\n" << "LatestBuildId response:\n" << json; if (!json.isMember("builds")) { return std::nullopt; }