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

[Enhancement]: fix/rewrite/rework the build-pr action #244

Closed
popey opened this issue Oct 13, 2023 · 3 comments · Fixed by #255
Closed

[Enhancement]: fix/rewrite/rework the build-pr action #244

popey opened this issue Oct 13, 2023 · 3 comments · Fixed by #255

Comments

@popey
Copy link
Contributor

popey commented Oct 13, 2023

What changes would you like?

The build-prs GitHub action fails to build sometimes, when the snap builds fine in Launchpad.

A quick and dirty workaround could be to disable arm64 in the action yaml (the same way armhf is disabled)

A better solution might be to use snapcraft remote-build which actually builds in Launchpad which is a way more consistent way to build, given that's how we actually publish builds from.

Any extra information?

No response

@popey popey mentioned this issue Oct 13, 2023
@merlijn-sebrechts
Copy link
Member

merlijn-sebrechts commented Oct 13, 2023

I really dislike touching Launchpad, but remote-build seems like a reasonable UX.

Though the docs aren't clear about how to use remote-build in a headless manner. How do we get a token and supply it to remote-build?

@popey
Copy link
Contributor Author

popey commented Oct 14, 2023

You can snapcraft export-login creds on your workstation, do get a credentials file, which is your secret for the snap store.

This can be put in a GitHub Action as a 'secret'. When snapcraft runs, it uses an environment variable called SNAPCRAFT_STORE_CREDENTIALS, which contains the contents of the secret you generated above.

This gets store access, but I does not give Launchpad access to do the remote-build. Ideally, it would need a dummy launchpad account called "snapcrafters-build", for example, that someone had the credentials for. The first time you run snapcraft remote-build on a workstation, it asks you to oath with launchpad, asking you to click a URL like this:

/temp# snapcraft remote-build
snapcraft remote-build is experimental and is subject to change - use with caution.                                                                            
All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
Using build ID snapcraft-my-snap-name-ee290312019f620c78fc612ecdc41945
The authorization page:
 (https://launchpad.net/+authorize-token?oauth_token=mQ2DHwv2LZghs6sthNPG&allow_permission=DESKTOP_INTEGRATION)
should be opening in your browser. Use your browser to authorize
this program to access Launchpad on your behalf.
Waiting to hear from Launchpad about your decision...

Click the URL and you can then authorise this in launchpad:

image

Once authorised, you can run snapcraft remote-build from that machine, and launchpad will build under that account on the launchpad build farm.

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Sending build data to Launchpad... (https://popey:<token>@git.launchpad.net/~popey/+git/snapcraft-my-snap-name-ee290312019f620c78fc612ecdc41945/)
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 549 bytes | 549.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
To https://git.launchpad.net/~popey/+git/snapcraft-my-snap-name-ee290312019f620c78fc612ecdc41945/
 * [new branch]      HEAD -> master
If interrupted, resume with: 'snapcraft remote-build --recover --build-id snapcraft-my-snap-name-ee290312019f620c78fc612ecdc41945'
Building snap package for amd64. This may take some time to finish.
Build status as of 2023-10-14 09:16:41.340915:
	arch=amd64	state=Needs building
Build status as of 2023-10-14 09:17:11.706574:
	arch=amd64	state=Currently building

You can see the code has been pushed to launchpad:

image

The build runs on launchpad for whichever architectures are specified, which you can see at https://launchpad.net/builders

image

The machine running snapcraft remote-build will keep posting updates every 30 seconds until it finishes, receiving the snap and a log file, or just the log file if it fails.

Build status as of 2023-10-14 09:18:12.355951:
	arch=amd64	state=Currently building
Build status as of 2023-10-14 09:18:42.777392:
	arch=amd64	state=Currently building
Build status as of 2023-10-14 09:19:13.139419:
	arch=amd64	state=Successfully built
Snapped my-snap-name_0.1_amd64.snap
Build log available at 'my-snap-name_amd64.txt'
Build complete.

The access token and access secret for snapcraft to talk to launchpad will be in ~/.local/share/snapcraft/provider/launchpad/credentials on the workstation doing the remote build.

These credentials could also be put in github, to enable a headless call from a github action to do a remote-build.

@jnsgruk
Copy link
Member

jnsgruk commented Mar 27, 2025

Hi there! We recently merged a big overhaul of the GIMP snap, keeping us up to date with the latest 3.0 feature release.

The snap has been rebased on core24, has migrated to a much improved GNOME extension & content snap, and is now using many more components from the Ubuntu archive. Given either the version stated in this issue, or the last time the issue was updated, it's highly likely that the issue is resolved or is no longer relevant to the supported version of GIMP.

As part of getting the snap and the repo back on track, and to help us prioritise ongoing issues, I'm working through all issues that refer to older versions or haven't been updated in a while.

I'm closing this issue for now, but please comment if the issue still persists, and I'll reopen and prioritise getting it fixed, or at least get you an update!

@jnsgruk jnsgruk closed this as completed Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants