Skip to content

fix: parse string and file credentials in uniform way#280

Open
cmatsuoka wants to merge 1 commit intomasterfrom
work/accept-authorized-user-credentials
Open

fix: parse string and file credentials in uniform way#280
cmatsuoka wants to merge 1 commit intomasterfrom
work/accept-authorized-user-credentials

Conversation

@cmatsuoka
Copy link
Collaborator

@cmatsuoka cmatsuoka commented Mar 9, 2026

Update the Google backend credential parsing so JSON credentials provided
inline as a string are handled the same way as credentials read from a file
(via GOOGLE_APPLICATION_CREDENTIALS), enabling authorized user
credentials for string keys as well.

Signed-off-by: Claudio Matsuoka claudio.matsuoka@canonical.com

@cmatsuoka
Copy link
Collaborator Author

cmatsuoka commented Mar 9, 2026

Execution of tests fails in this PR because tests run with a pinned commit of spread. The pinned commit will be updated to after this PR lands, allowing future tests to execute successfully.

Local test execution results using this PR and authorized user credentials:

2026-03-09 09:44:35 Project content is packed for delivery (16.20MB).
2026-03-09 09:44:35 Sequence of jobs produced with -seed=1773060275
2026-03-09 09:44:35 If killed, discard servers with: spread -reuse-pid=1544168 -discard
2026-03-09 09:44:35 Allocating google:ubuntu-20.04-64...
2026-03-09 09:45:00 Waiting for google:ubuntu-20.04-64 (mar091244-642328) to boot at 34.23.140.199...
2026-03-09 09:45:44 Allocated google:ubuntu-20.04-64 (mar091244-642328).
2026-03-09 09:45:44 Connecting to google:ubuntu-20.04-64 (mar091244-642328)...
2026-03-09 09:45:45 Connected to google:ubuntu-20.04-64 (mar091244-642328) at 34.23.140.199.
2026-03-09 09:45:45 Sending project content to google:ubuntu-20.04-64 (mar091244-642328)...
2026-03-09 09:45:49 Preparing google:ubuntu-20.04-64 (mar091244-642328)...
2026-03-09 09:48:03 Preparing google:ubuntu-20.04-64:tests/nomatch (mar091244-642328)...
2026-03-09 09:48:04 Executing google:ubuntu-20.04-64:tests/nomatch (mar091244-642328) (1/10)...
2026-03-09 09:48:47 Preparing google:ubuntu-20.04-64:tests/reboot (mar091244-642328)...
2026-03-09 09:48:47 Executing google:ubuntu-20.04-64:tests/reboot (mar091244-642328) (2/10)...
2026-03-09 09:49:12 Preparing google:ubuntu-20.04-64:tests/repack (mar091244-642328)...
2026-03-09 09:49:12 Executing google:ubuntu-20.04-64:tests/repack (mar091244-642328) (3/10)...
2026-03-09 09:49:13 Preparing google:ubuntu-20.04-64:tests/artifacts (mar091244-642328)...
2026-03-09 09:49:14 Executing google:ubuntu-20.04-64:tests/artifacts (mar091244-642328) (4/10)...
2026-03-09 09:49:15 Restoring google:ubuntu-20.04-64:tests/artifacts (mar091244-642328)...
2026-03-09 09:49:16 Preparing google:ubuntu-20.04-64:tests/adhoc (mar091244-642328)...
2026-03-09 09:49:16 Executing google:ubuntu-20.04-64:tests/adhoc (mar091244-642328) (5/10)...
2026-03-09 09:49:17 Preparing google:ubuntu-20.04-64:tests/match (mar091244-642328)...
2026-03-09 09:49:17 Executing google:ubuntu-20.04-64:tests/match (mar091244-642328) (6/10)...
2026-03-09 09:49:18 Preparing google:ubuntu-20.04-64:tests/envs (mar091244-642328)...
2026-03-09 09:49:18 Executing google:ubuntu-20.04-64:tests/envs (mar091244-642328) (7/10)...
2026-03-09 09:49:19 Preparing google:ubuntu-20.04-64:tests/lxd (mar091244-642328)...
2026-03-09 09:49:20 Executing google:ubuntu-20.04-64:tests/lxd (mar091244-642328) (8/10)...
2026-03-09 09:53:26 Executing google:ubuntu-20.04-64:tests/manual (mar091244-642328) (9/10)...
2026-03-09 09:53:27 Preparing google:ubuntu-20.04-64:tests/qemu (mar091244-642328)...
2026-03-09 09:57:25 Executing google:ubuntu-20.04-64:tests/qemu (mar091244-642328) (10/10)...
2026-03-09 09:58:12 Discarding google:ubuntu-20.04-64 (mar091244-642328)...
2026-03-09 09:58:14 Successful tasks: 10
2026-03-09 09:58:14 Aborted tasks: 0

@cmatsuoka cmatsuoka marked this pull request as ready for review March 9, 2026 12:58
@cmatsuoka cmatsuoka requested a review from Copilot March 9, 2026 12:59

This comment was marked as outdated.

The Google backend key parsing implementation used JWTConfigFromJSON()
when the key is specified as a JSON string, and this only works with
service account credentials. In contrast, when setting the key to the
path of a file containing the JSON credentials we use the environment
GOOGLE_APPLICATION_CREDENTIALS, which also accepts authorized
user credentials. Change the JSON string key parsing to use
CredentialsFromJSON() to match the functionality of reading the
JSON from a file, allowing the use of authorized user credentials
with string keys.

Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
@cmatsuoka cmatsuoka force-pushed the work/accept-authorized-user-credentials branch from b47af27 to e75651c Compare March 9, 2026 13:03
@cmatsuoka cmatsuoka requested a review from niemeyer March 9, 2026 13:07
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.

2 participants