Add support for snapcraft 7 credentials

Bug #1984014 reported by Tony Espy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Image
Fix Released
Undecided
Unassigned
snapd
Fix Released
High
Samuele Pedroni
snapd (Ubuntu)
New
Undecided
Unassigned

Bug Description

Snapcraft 7 introduced a new format for credentials generated by the export-login command, however the latest version of ubuntu-image (2.2+snap9) isn't able to parse the new format. This means someone who wants to build an Ubuntu Core 22 image that requires access to snaps in a brand store must install snapcraft 6 to export login credentials.

For reference: https://forum.snapcraft.io/t/snapcraft-authentication-options/30473

Steps to reproduce:
1. Install snapcraft 7.1.1 from latest/stable
2. Export login credentials: snapcraft export-login --acls package_access mycreds
3. Download a core22 reference model assertion from: https://github.com/snapcore/models
4. Install ubuntu-image from latest/stable
5. Build the image:

UBUNTU_STORE_AUTH_DATA_FILENAME=./mycreds ubuntu-image snap <your-model-assertion>
Error: Error preparing image: cannot decode auth file "./mycreds"

That said, I should've looked closer at the error, it looks like this is probably a snapd bug (i.e. in 'snap prepare-image') vs. a bug in ubuntu-image. If you agree, I'll move the bug.

Tags: fr-2636
Tony Espy (awe)
description: updated
Revision history for this message
William Wilson (jawn-smith) wrote :

Thanks for the steps to reproduce! This appears to be a bug in snapd's image.Prepare function. It seems to need updating to use the snapcraft v7 credentials. I've tried recompiling ubuntu-image with snapd 2.57 but that did not resolve the issue. As soon as this is fixed in snapd I can update go.mod to pull in the change.

Revision history for this message
Samuele Pedroni (pedronis) wrote :
Changed in snapd:
assignee: nobody → Samuele Pedroni (pedronis)
importance: Undecided → High
status: New → In Progress
tags: added: fr-2636
Changed in snapd:
status: In Progress → Fix Committed
Revision history for this message
Samuele Pedroni (pedronis) wrote :

the fix will be in 2.57.2

snapd will now also support UBUNTU_STORE_AUTH that accepts the same values (the creds/auth string, not a file) like SNAPCRAFT_STORE_CREDENTIALS

Revision history for this message
William Wilson (jawn-smith) wrote :

The ubuntu-image in latest/edge (rev 317) should have this fix.

Changed in ubuntu-image:
status: New → Fix Committed
Revision history for this message
Tony Espy (awe) wrote :

I tested ubuntu-image (r317 from edge) along with snapd 2.57.2 (r17029) from latest/beta and can confirm that credentials exported from snapcraft 7 now work!

Changed in snapd:
status: Fix Committed → Fix Released
Changed in ubuntu-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.