Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cf_cc_library(
"//cuttlefish/common/libs/utils:result",
"//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",
"//libbase",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 12 additions & 3 deletions base/cvd/cuttlefish/host/libs/web/android_build_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ namespace {

bool StatusIsTerminal(const std::string& status) {
const static std::set<std::string> 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;
}
Expand Down Expand Up @@ -213,8 +221,8 @@ Result<AndroidBuildApi::BuildInfo> 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<bool>(json, {"buildSigned"}));
}

return AndroidBuildApi::BuildInfo{
Expand Down Expand Up @@ -267,6 +275,7 @@ Result<std::optional<std::string>> 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;
}
Expand Down
3 changes: 0 additions & 3 deletions base/cvd/cuttlefish/host/libs/web/android_build_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions base/cvd/cuttlefish/host/libs/web/android_build_url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions base/cvd/cuttlefish/host/libs/web/android_build_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

namespace cuttlefish {

inline constexpr char kAndroidBuildServiceUrl[] =
"https://androidbuild-pa.googleapis.com/v4";

class AndroidBuildUrl {
public:
AndroidBuildUrl(std::string api_base_url, std::string api_key,
Expand Down
Loading