Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify export and login instructions #3441

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@bcardiff
Copy link

commented Jun 12, 2019

Description

Simplify export and login instructions without explicitly creating files.
Bonus: use a token that can push only to a specific channel.

Reasons

Less hardcoded stuff that will work if the snapcraft tool is run in other than ~/project.

@michelle-luna michelle-luna requested a review from felicianotech Jun 12, 2019

@felicianotech
Copy link
Contributor

left a comment

Hey.

This looks good but the related documentation for these commands will need to be changed as well. If we merged this PR right now, the docs wouldn't make sense since they refer to base64.

@bcardiff

This comment has been minimized.

Copy link
Author

commented Jun 13, 2019

@felicianotech I also change the env variable to $SNAPCRAFT_TOKEN since it seems more appropriate.

@felicianotech

This comment has been minimized.

Copy link
Contributor

commented Jun 17, 2019

Hi @bcardiff,

Thank you. So This morning I went through these steps myself and I found a few issues.

  1. Personally I don't think limiting the token to a specific release channel is useful in our environment. Ideally the CI process is publishing to multiple channels. Maybe master to edge and tagged releases to stable. The same could be said for snap name when using CircleCI Context. I publish over 5 snaps via CircleCI for example.
  2. snapcraft export-login requires user input, so we can't pass it directly to xsel. This seems to be a change to Snapcraft though because I don't remember it doing that before. I'm running Snapcraft v3.6.
  3. Passing the token to snapcraft login --with - doesn't seem to work for me unless the file/token is base64 encoded.

Are you not seeing these issues? Do you have a working build with these changes that I can look at?

My info:

Snapcraft v3.6
Snap v2.39
OS local: Ubuntu 19.04
OS CircleCI: Ubuntu 16.04 based Snapcraft Docker Image

@bcardiff

This comment has been minimized.

Copy link
Author

commented Jun 18, 2019

Hi @felicianotech

  1. I'm ok if you prefer to leave it as before regarding the channel restriction. In our use case the automated build will always push to edge. Tagged releases will be tagged with grade stable and they are manually pushed to stable once the other artifacts of the release are ready. Having the least required scope in the CI seems appropriate. But is definitely your call what you want to advertise in the docs.

  2. You are right. The xsel should not be used. I only used the first part of the command since I'm on mac. Would it be better to give the complete output to guide the user? This is what I actually use.

$ snapcraft export-login --snaps my-snap-name --channels edge,edge/* -
Enter your Ubuntu One e-mail address and password.
If you do not have an Ubuntu One account, you can create one at https://snapcraft.io/account
Email: jdoe@example.org
Password: *******

Exported login starts on next line:
W5y... (stripped) ...BeK

Login successfully exported and printed above. This can now be used with

    echo "<login>" | snapcraft login --with -

to log in to this account with no password and have these
capabilities:

snaps:       ['my-snap-name']
channels:    ['edge', 'edge/*']
permissions: ['package_access', 'package_manage', 'package_push', 'package_register', 'package_release', 'package_update']
expires:     2020-06-17T17:01:10.405759
  1. As shown in the previous output the exported login W5y... (stripped) ...BeK should be able to be used with the snapcraft login --with -. We are using it already in our workflow. Maybe the xsel issue added some extra information in the value set in the $SNAPCRAFT_TOKEN.

I'm happy to keep iterating, but if this PR is more a nudge to bring the snap instructions up to date with a different approach & phrasing I'm also happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.