You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using ORAS from snap can't authenticate with gcloud credential helper #1079
If I use oras from snap, authentication fails, but if I use the downloaded oras binary it works fine
What did you expect to happen?
Authentication doesn't depend on
How can we reproduce it?
Since this requires authenticating with google cloud platform, replicating my setup isn't the easiest. I can help someone setup a similar environment if necessary
@jteichroeb-oanda snap apps uses separated config file. You should add cred helper to the docker config in snap's virtual environment ~/snap/oras/current/.docker/config.json and it should work.
@qweeah that doesn't quite work either, it doesn't have a way to call the credential helper:
Error: failed to resolve latest: GET "https://us-central1-docker.pkg.dev/v2/[...]/manifests/latest": error getting credentials - err: docker-credential-gcloud resolves to executable in current directory (./docker-credential-gcloud), out: ``
changed the title [-]Using ORAS from snap can't authenticate with gcloud[/-][+]Using ORAS from snap can't authenticate with gcloud credential helper[/+]on Aug 29, 2023
Looks like the credential helper needss to be accessible within the snap sandbox. I tried --classic installation and get the same error
Error: error storing credentials - err: docker-credential-pass resolves to executable in current directory (./docker-credential-pass), out: ...
@FeynmanZhou Maybe we should suggest user not to use snap release if they are using credstore or credhelpers, or even remove snap from the installation guide.
@qweeah If there is no workaround for the issue caused by the Snap sandbox environment, we can consider removing the Snap installation from the installation guide and dropping its maintenance for future releases.
@SamirPS Do you have any suggestions on this issue?
One thing that confuses me, I have the gcloud command installed from snap as well, if it can access files outside of the sandbox environment, can't oras do the same thing?
oras can access the files outside of the sandbox. For example, oras push <ref> file1 file2 where file1 and file2 can be at any place. However, oras cannot find docker-credential-gcloud in $PATH as $PATH has been modified by snap.
BTW, the error message docker-credential-gcloud resolves to executable in current directory (./docker-credential-gcloud) of oras v1.0.0 might be confusing. It is fixed in v1.0.1 as exec: "docker-credential-gcloud": executable file not found in $PATH.
I'm not sure if setting confinement level to classic and install using --classic works or not. Noto to @qweeah, --classic flag does not work as it is not declared as classic.
Another thing we can try is the snap interfaces, mounting :home to oras:home.
@SamirPS I don't think using the personal file interface will be a good solution since user might use any config file via --config and specify any cred helper in the configuration. During build time, we cannot list out every possible path.
I'm not sure if setting confinement level to classic and install using --classic works or not. Noto to @qweeah, --classic flag does not work as it is not declared as classic.
Tried building a snapcraft version locally with confinement level set to classic and it worked: both config file and cred binaries can be successfully invoked. I think this is the most ideal solution we currently have.
Activity
qweeah commentedon Aug 25, 2023
Can you attach the debug log of failed oras push? You can get that with --debug flag set.
jteichroeb-oanda commentedon Aug 25, 2023
Here's the debug log, overall not the most helpful. I've redacted some URLs with [...]
The only difference on a successful debug log is that the second request has an additional header
The debug logs don't show how it gets this header
qweeah commentedon Aug 28, 2023
Thank @jteichroeb-oanda The logs at least show snap build doesn't pick up the stored creds from credHelper.
qweeah commentedon Aug 28, 2023
@jteichroeb-oanda Just to confirm when you using downloaded oras binary and it succeeds, is it
1.0.0orv1.0.1?jteichroeb-oanda commentedon Aug 28, 2023
@qweeah both 1.0.0 and 1.0.1 work. I can't try 1.0.1 with snap since the lastest I see is 1.0.0.
qweeah commentedon Aug 28, 2023
Got it, taking a look. Thanks for the input. @jteichroeb-oanda
FeynmanZhou commentedon Aug 29, 2023
Upgrading the ORAS installer to v1.0.1 on Snap is still in WIP and tracked in #965 .
qweeah commentedon Aug 29, 2023
@jteichroeb-oanda snap apps uses separated config file. You should add cred helper to the docker config in snap's virtual environment
~/snap/oras/current/.docker/config.jsonand it should work.jteichroeb-oanda commentedon Aug 29, 2023
@qweeah that doesn't quite work either, it doesn't have a way to call the credential helper:
[-]Using ORAS from snap can't authenticate with gcloud[/-][+]Using ORAS from snap can't authenticate with gcloud credential helper[/+]qweeah commentedon Aug 30, 2023
Looks like the credential helper needss to be accessible within the snap sandbox. I tried
--classicinstallation and get the same error@FeynmanZhou Maybe we should suggest user not to use snap release if they are using credstore or credhelpers, or even remove snap from the installation guide.
FeynmanZhou commentedon Aug 30, 2023
@qweeah If there is no workaround for the issue caused by the Snap sandbox environment, we can consider removing the Snap installation from the installation guide and dropping its maintenance for future releases.
@SamirPS Do you have any suggestions on this issue?
1 remaining item
jteichroeb-oanda commentedon Aug 30, 2023
One thing that confuses me, I have the gcloud command installed from snap as well, if it can access files outside of the sandbox environment, can't oras do the same thing?
shizhMSFT commentedon Aug 30, 2023
orascan access the files outside of the sandbox. For example,oras push <ref> file1 file2wherefile1andfile2can be at any place. However,orascannot finddocker-credential-gcloudin$PATHas$PATHhas been modified bysnap.BTW, the error message docker-credential-gcloud resolves to executable in current directory (./docker-credential-gcloud) of
oras v1.0.0might be confusing. It is fixed inv1.0.1as exec: "docker-credential-gcloud": executable file not found in $PATH.shizhMSFT commentedon Aug 30, 2023
Currently,
orasis configured tostrictconfinement level.oras/snapcraft.yaml
Line 20 in 999ac38
I'm not sure if setting confinement level to
classicand install using--classicworks or not. Noto to @qweeah,--classicflag does not work as it is not declared asclassic.Another thing we can try is the snap interfaces, mounting
:hometooras:home.shizhMSFT commentedon Aug 30, 2023
Oh. The
:homeis already connected.SamirPS commentedon Sep 1, 2023
can it's been link to this ? https://forum.snapcraft.io/t/kubectl-wrong-gcloud-path-when-doing-any-operations/18848
i'm checking with other people to know the issue
SamirPS commentedon Sep 3, 2023
Normally, with this interface, the snap will work: https://snapcraft.io/docs/personal-files-interface , I will update the snapcraft.yaml file and let's you test it.
qweeah commentedon Sep 4, 2023
@SamirPS I don't think using the personal file interface will be a good solution since user might use any config file via
--configand specify any cred helper in the configuration. During build time, we cannot list out every possible path.qweeah commentedon Sep 4, 2023
Tried building a snapcraft version locally with confinement level set to
classicand it worked: both config file and cred binaries can be successfully invoked. I think this is the most ideal solution we currently have.SamirPS commentedon Sep 4, 2023
thanks for the head up, i let you do the PR and publish it then :)
github-actions commentedon Nov 4, 2023
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
qweeah commentedon Nov 6, 2023
Putting it to future milestone to avoid being flagged as stale. To resolve issue here, we tried to convert oras a classic snap app and it's pending snapcraft's approval, see https://forum.snapcraft.io/t/request-for-classic-confinement-oras-and-oras-test/36826