From f188be3aff1b43517d8dd17969f2febe16f4aaa2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 28 Jan 2020 15:20:25 +0000 Subject: [PATCH] gcp: Fix invalid URL in metadata Get the URL from what mantle computed rather than trying to re-compute it here. Closes: https://github.com/coreos/coreos-assembler/issues/1078 --- src/cosalib/gcp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cosalib/gcp.py b/src/cosalib/gcp.py index 202830a71d..31539c43b1 100644 --- a/src/cosalib/gcp.py +++ b/src/cosalib/gcp.py @@ -48,6 +48,7 @@ def gcp_run_ore(build, args): if not re.fullmatch(GCP_NAMING_RE, gcp_name): raise Exception(f"{gcp_name} does match the naming rule: file a bug") + urltmp = os.path.join(build.tmpdir, "gcp-url") ore_args.extend([ 'gcloud', '--project', args.project, @@ -59,16 +60,13 @@ def gcp_run_ore(build, args): '--json-key', args.json_key, '--name', gcp_name, '--file', f"{build.image_path}", + '--write-url', urltmp, ]) run_verbose(ore_args) - url_path = urllib.parse.quote(( - "storage.googleapis.com/" - f"{args.bucket}/{build.build_name}/{build.image_name}" - )) build.meta['gcp'] = { 'image': gcp_name, - 'url': f"https://{url_path}", + 'url': open(urltmp).read().strip() } build.meta_write()