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

Add support for building snaps #307

Closed
wants to merge 1 commit into from
Closed

Add support for building snaps #307

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented May 15, 2019

Hi Steve,

Following up on what we briefly discussed, this is the PR for building a snap package of ponzu.

Build and test

You can use:

  • local system with snapcraft command line tool (basically this PR)
  • build/CI tool or system of your choice
  • our online, free build service (build.snapcraft.io)

Build locally

I used Ubuntu 18.04 for this.

snap install snapcraft --classic --beta
git clone https://github.com/igorljubuncic/ponzu.git
cd ponzu
git checkout add-snapcraft
snapcraft

This command will generate a .snap file, something like ponzu_1.0_amd64.snap.

Install locally

snap install ponzu_1.0_amd64.snap --dangerous

The --dangerous flag is necessary because the app (snap) does not originate from the snap store just yet and is not digitally signed.

Run ponzu

snap run ponzu "options"

Register dev account

You can do this here: https://snapcraft.io/account.

Register ponzu name in the store

This can be done on the command line with snapcraft:

snapcraft login
snapcraft register

Upload/push ponzu to the store

snapcraft push ponzu_1.0_amd64.snap --release edge

We use release channels to denote risk, as follows:

  • edge, typically for git master
  • beta, beta testing
  • candidate
  • stable

You can promote to different channels after testing and validation.

Install from store for (a second) test

snap install ponzu --edge

I think this covers it.

Once you land the PR, we can help you with the promotion of ponzu.

Feel free to ask any questions you may have.

Thanks!

@nilslice
Copy link
Contributor

Hi @igorljubuncic -

Thank you for this, it's extremely helpful!

Ponzu has a dev dependency on the Go toolchain. Is there a way to ensure through the snap install that Go (above some defined version) is also installed? and if not, to install it along with Ponzu?

@ghost
Copy link
Author

ghost commented May 16, 2019

Yes, absolutely. You can define that with the build-packages keyword - so if you need a package named foobar3-dev, you can add it. For instance, the snapcraft.yaml I uploaded has:

build-packages:
  - build-essential

You could have something like:

build-packages:
  - build-essential
  - foobar3-dev

Similarly, for runtime assets, you can use the stage-packages keyword.

I hope this answers your question.

@olliephillips
Copy link
Contributor

Hello @igorljubuncic, may I ask, in the context of a snap, can a package dependency be another Snap. I see there's Go already in the snapcraft store. That would seem to be a simple way to ensure Go is available?

@@ -0,0 +1,26 @@
name: ponzu
version: '1.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igorljubuncic - would it be safer to use the same version number as the one most recently tagged (in this case, 0.10.1)? Sorry, I'm not sure what a 1.0 version might imply to a snap user.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version string has no semantic meaning in snaps - you can use anything you like. You can even use the git tag if you like, or any naming scheme you want, whatever makes most sense to you.

https://docs.snapcraft.io/snapcraft-yaml-reference

Copy link
Contributor

@olliephillips olliephillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the basis that scope is limited to snap users and changes are restricted to a single new yaml file, this can be approved and make the 0.11.0 release hopefully.

@olliephillips olliephillips self-requested a review July 18, 2019 18:44
Copy link
Contributor

@olliephillips olliephillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that the PR is on master sorry, PRs are only accepted on "ponzu-dev" branch. Otherwise, previous comments stand.

@ghost
Copy link
Author

ghost commented Aug 12, 2019

Hi Ollie, do you need this resubmitted to the dev branch?

@olliephillips
Copy link
Contributor

@igorljubuncic if you could even though it's not a change that impacts the Ponzu code base that'd be great.

But is the file complete from your perspective? I don't think it factors in the golang build dependency discussed above, so would fail for some users?

Could that be added so you have a complete snap.yml?

@ghost
Copy link
Author

ghost commented Aug 13, 2019

Hey Ollie,

There are several options available:

  • You can use build packages so that ponzu is compiled with the right version.
  • You can also use stage packages (runtime deps) or even stage snaps.

https://forum.snapcraft.io/t/stage-snaps/11001

I believe this will fully satisfy your requirements.

I'm going to file a new PR - with the same text above, and reference this one.

@ghost ghost mentioned this pull request Aug 13, 2019
@olliephillips
Copy link
Contributor

Closing as PR superseded by #313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants