-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support to publish Snaps using goreleaser #353
Conversation
72ceb0b
to
9903e38
Compare
9903e38
to
19e5460
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. 🙏🏼
.goreleaser.yml
Outdated
plugs: | ||
dot-kube-config: | ||
interface: personal-files | ||
write: [$HOME/.kube/config] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some people specify custom paths with >1 files. How would this work here?
.goreleaser.yml
Outdated
completer: completion/kubectx.bash | ||
plugs: | ||
- dot-kube-config | ||
environment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need $KUBECONFIG here as well.
I need to do some review in the code. I think I will need a special authorization to use the classic confinement instead of strict one. I already submit the request and if and when I get it, I will do changes in the code. Please stay tuned. |
Any updates? |
@ahmetb No updates yet. I need what we call a 'classic' confinement to snap, but it has been a little hard to get an answer about my request. |
@ahmetb Just to keep you on the loop: I'm still working on it. They answer me back some days ago, and now I'm trying to a new line of action to be approved. Permissions with Snap can be hard, but I think I will make it. Stay tuned. |
@ahmetb The process to get (or not) the final approval for classic confinement is almost done. I already submitted a version with the classic confinement to the store, and I will make the final code and submit the PR to your repo ASAP. |
19e5460
to
cd7baa5
Compare
@ahmetb Everything is now in place. I got the approval I needed, and now the PR is complete. We can discuss further how to deploy Snaps automagically as part of the pipeline, together with the other assets. |
Thanks. How do we do that? Is that something Goreleaser does or we need to authenticate and upload a different way? |
We can use GitHub Actions. Do you already use it to publish the assets? |
@mhalano yeah, we upload to GitHub Releases using GitHub Actions. What's involved here? Do we need to call an external API to upload assets? |
We need the command |
I sent to your email an invitation to manage with me the Snap in the Snap Store. Here there is a build system in place integrated with GitHub, but the problem it demands a |
Here it is a very interesting page about a GitHub Action that could solve the problem. What do you think? |
At that point I might question do we actually need this distribution method. So far I am spending zero effort on releases in the upstream repo and anyone packaging this software in apt/yum like repos are regularly picking up the releases from here.
Yeah, if we can't automate it with a GitHub Action then we probably should leave it out of this upstream repo. I'm happy to add a token or whatever to GitHub repo secrets, but you should probably first test this on your fork and send the changes here. |
b07ec17
to
f231501
Compare
@ahmetb I added a commit that adds the Snapcraft to the build system, and now it's building correctly. I just got a problem with bats execution in my local machine because absence of assets. Can you help me with that, triggering your pipeline? |
832895a
to
6694ac6
Compare
I think it's done. You will need to create an Ubuntu SSO account and to install
When you execute this command, it will open a webpage to login with your Ubuntu SSO account. That should be a no brainer. Then you have to create a secret called |
you should be able to run |
@mhalano I've started to think this alternative approach: What if you had a separate ~empty repository where you have a GitHub Action that runs once per day to see if there's a new tag on
Executing on this possibility probably depends on what goreleaser spits out here and whether you can repeat the same functionality on a separate repo. |
6694ac6
to
c55a2bf
Compare
@ahmetb I really like the way we are going to. I think the use of Goreleaser is a nice approach and in the future we could have packaging for other formats. I think this is important because sometimes if you depend on distro-packaging, like in kubectx case, to get the software installed nicely, using a package management solution, you probably need to sit and wait, dying in the process. I created the Snap version because I use kubectx/kubens and like them a lot, but Debian still didn't package and Ubuntu neither. Snap is nicer because is cross-distro and easier to create than Flatpak |
The problem seems to be the directory name. The directory present inside |
Ah it seems like goreleaser itself has changed. No idea where that _v1 comes from. master branch's probably broken too. |
opened goreleaser/goreleaser#3192 to track the binary name change issue, but feel free to send a PR to master pinning goreleaser version to 1.7.0 for the time being. |
0173f3e
to
025f341
Compare
@ahmetb I added a commit to change Goreleaser version from latest to 1.7.0 and at least the CI pipeline worked flawlessly (I didn't try the release pipeline). I read the answer for your Goreleaser issue and it seems a quite tricky problem to solve. Not impossible, just tricky. |
Hello, I saw you released a new version and now I'm working to rebase my changes on it and also release a new version on Snap Store. |
6dce805
to
407b9e4
Compare
@ahmetb please review my final PR. I also released on Snap Store the version 0.9.5 of kubectx. |
407b9e4
to
9d9f27b
Compare
.github/workflows/release.yml
Outdated
- name: Publish Snaps to the Snap Store (stable channel) | ||
run: for snap in $(ls dist/*.snap); do snapcraft upload --release=stable $snap; done | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized I added a $SNAPCRAFT_TOKEN
to the repo last year. Can we just use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
.github/workflows/release.yml
Outdated
- name: Setup Snapcraft | ||
run: | | ||
mkdir -p $HOME/.cache/snapcraft/download | ||
mkdir -p $HOME/.cache/snapcraft/stage-packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step feels odd. Why doesn't the action above (or the snap
command create these)? It doesn't seem you're using this cache between runs either? (we don't need, just asking.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These couple lines are necessary because of this problem. If it doesn't exist when snapcraft command is executed things go wild. Kidding. It just crash and burns. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had one more link about this as a comment in the file, but I think I lost that commit. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's add a comment as to why we're adding this step. I definitely won't remember this in a few months :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahmetb Do you have any other considerations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I clicked on "Run action" and CI seems to be failing. I think we need a way to configure goreleaser to skip snapcraft step while just building/packaging (and skip publishing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw it. I already have an idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahmetb Done. Please check again.
Thanks for the patience here. It’ll go out with the new release, hopefully not too far from now. |
Add support to publish Snaps using goreleaser
Closes #351