Not able to preseed snaps from private snap store

Bug #2054768 reported by Aristo Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Image
Invalid
Medium
Unassigned

Bug Description

[Summary]
I was using ubuntu-image(Version: 3.2, revision: 702) snap to build a classic image for customer, and the gadget snap is in the customer's private store, and looks like the ubuntu-image is not able to download snaps from private store

[Steps]
1. Prepare model.assert that contains gadget snap from private store
2. Prepare a credential that is allowed to access the private store
3. Use the command
   $ sudo 'UBUNTU_STORE_AUTH_DATA_FILENAME=$(pwd)/store.auth' /snap/bin/ubuntu-image classic --debug -O out -w work yaml/server-arm64.yaml --disk-info buildstamp

[Result]
```
[8] clean_extra_ppas
duration: 2.651111ms
[9] install_extra_snaps
Fetching nvent-9400i-mod-0001-gadget-classic (5)
duration: 6.455209737s
Error: Error preparing image: received an unexpected http response code (404) when trying to download https://api.snapcraft.io/api/v1/snaps/download/zp3fpAbvfNg8DT0o5PZTcjZiwRzAeI1d_5.snap
```

[Other Info]
Previously with ubuntu-image 2.x, we can set UBUNTU_STORE_AUTH_DATA_FILENAME=store.auth as env variable for ubuntu-image to consume, then it will have the permission to download snaps from private store, but looks like ubuntu-image 3.x does not support this mechanism

Aristo Chen (aristochen)
description: updated
Revision history for this message
Paul Mars (upils) wrote :

Hey Aristo,

Ubuntu-image is preparing the snaps by using the snapd lib. From what I can see in the code, the env var UBUNTU_STORE_AUTH_DATA_FILENAME is still used in snapd, so this should still work.

We do not have test on this feature so I cannot confirm there is a bug without testing with a private store.

Are you sure the account you used is authorized to access the private store? Are you sure the macaroon in the store.auth file did not expire?

Revision history for this message
Aristo Chen (aristochen) wrote :

Hi @Paul

Yes, I am sure the credential is not expired.

In the same script that I was using for building the image, I need to use the credential to download the same gadget snap from the private store, and it succeed, so I assume ubuntu-image 3.x should be able to use the same credential without issue.

Paul Mars (upils)
Changed in ubuntu-image:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Aristo Chen (aristochen) wrote :

Hi,

it turns out that our build script is not handling the variables properly, so it is not a bug in ubuntu-image, sorry for bothering, and I will switch the bug status to invalid.

Changed in ubuntu-image:
status: Confirmed → Invalid
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.