Skip to content

emu_downloads: put the build id back in the download url - #420

Draft
rootkiller6788 wants to merge 2 commits into
google:masterfrom
rootkiller6788:fix-download-build-id-url
Draft

rootkiller6788 wants to merge 2 commits into
google:masterfrom
rootkiller6788:fix-download-build-id-url

Conversation

@rootkiller6788

Copy link
Copy Markdown

The create subcommand is documented as taking a build id (emu-docker create 12345678 "C google_apis x86_64"), but download_build() builds the ci.android.com url with a literal {0} where the id should go, so it always asks for build 0. That 404s and you just end up with an error page saved as sdk-repo-linux-emulator-<id>.zip.

It's a leftover from c70f927, where this line went from "...submitted/{0}/...emulator-{0}.zip".format(build_id) to an f-string and only the second placeholder got replaced. cloud-build calls the same helper, so it was broken there too.

Put {build_id} in the path and added a test that pins the url, so the same thing can't quietly come back.

Ran pytest tests/ --ignore=tests/e2e -q (43 passed). The new test fails against the old line, which is how I know it's actually covering this.

download_build() asks ci.android.com for a build by id, but the url it
builds has a literal "{0}" in the path where the id should go, so it
always requests build 0 and never downloads the build the user asked
for.

That {0} was a .format() placeholder that got missed when the line was
rewritten as an f-string in c70f927. Both placeholders wanted the build
id.
Locks down the url so a placeholder can't silently survive a rewrite
of that line again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant