Please help enabling base: core22 for the WIP UC22 pi gadget snap recipes

Asked by Łukasz Zemczak

Hello!

We are working now on getting all the Ubuntu Core 22 builds started early. We already have a 'dummy' core22 snap in the store (in edge), tracks for gadget, kernel, and even working snaps and builds for amd64. We wanted to do the same for the pi platform (for arm*), but sadly we do not have a core22 based gadget set up yet.

I started preparing those here:
https://launchpad.net/~canonical-foundations/+snap/pi-arm64-22
https://launchpad.net/~canonical-foundations/+snap/pi-armhf-22

The branches in snapcraft.yaml use Base: core22. Sadly, due to the fact that core22 is not yet official, any build attempts are failing. That being said, I see that this is just a matter of Launchpad recipe configuration, as we already have a 22-based amd64 gadget:
https://launchpad.net/~canonical-foundations/+snap/pc-amd64-22

Could we get the same configuration applied for the two pi gadgets above? With the difference of the architectures, of course.

I tried doing it manually via LP API but changing distro_series to hirsute (same as we have for core22 snap) failed. And I saw no way of manually switching the base there. Could an LP admin help? Since it has to be possible if we did it once before!
It's very important as the earlier we start, the less likely we will slide and delay with UC22 release next year.

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Łukasz Zemczak
Solved:
Last query:
Last reply:
Revision history for this message
Colin Watson (cjwatson) said :
#1

The manual approach isn't really what we'd recommend here. How would it be if we were to just cause Launchpad to recognize `base: core22` and point it at hirsute or maybe even impish for now (expecting that it will become impish and then J in time)? Then you could just tell Launchpad to infer the series from snapcraft.yaml rather than having to configure it manually.

Revision history for this message
Łukasz Zemczak (sil2100) said :
#2

That would be even better!

If that would be possible I'd be more than happy to switch to using 'infer to the series in snapcraft.yaml'. I actually tried doing that already but got an error re: core22 base not recognized.

Thank you!

Revision history for this message
Sergio Schvezov (sergiusens) said :
#3

You can go with that path, but from the looks of the sources themselves you can probably just self serve by setting "build-base: core20".

That said, Colin's proposal would work, I would like it to be a bit more explicit, we could probably plan to have a denomination for using the latest devel series as a build-base (which this is the case), maybe if build-base is set to coreXX (or something like that) we can have launchpad point to the latest "devel" series.

Revision history for this message
Colin Watson (cjwatson) said :
#4

@sergiusens I think something like that would be fine from our point of view, but wouldn't it require a suitable coreXX (or whatever) snap to exist in the store? That doesn't quite feel like something we can do unilaterally - I'd prefer that to be a specification (not necessarily a formal one) from snapd or snapcraft or foundations or somebody.

core22 also already exists in the store, and we'll have to set it up as a base in Launchpad at some point. Are you saying that you would explicitly prefer that not to happen until Ubuntu 22.04 has released? It seems as though that would cause some scheduling difficulties.

(Note that some degree of explicitness would be required anyway, because core22 is only in edge at present so snap recipes using it would have to explicitly specify that in order to work.)

Revision history for this message
Sergio Schvezov (sergiusens) said :
#5

Hi Colin, I might have been a bit vague, this is the construct I see in my head that would setup an environment with the latest series under development:

   name: pi-arm64
   type: gadget
   base: core22
   build-base: coreXX
   ...

We already support constructs that allow bases to be created with definitions that look like (https://snapcraft.io/docs/base-snaps):

    name: core22
    type: base
    build-base: core20 # this could eventually be coreXX.

Snapcraft itself knows how to handle bases that have not yet matured into the stable channel, it sets the snaps built against those bases with "grade: devel".

I can work on a spec for this if Łukasz is not on a strict timeline (if he is we can go with your original proposal).

Revision history for this message
Łukasz Zemczak (sil2100) said :
#6

Hello Sergio, Colin!

What is the recommended way for me to proceed? I would like this gadget snap to be available for UC22 as soon as possible. Is there anything that I need to do? Should I switch to base: core22 and build-base: core20 for now?

Even though this is not *super priority*, we would like to get a working set of pi images for UC22 ASAP. The reason for that is that we need a working development environment to be able to iterate on in our road to UC22. The earlier we start, the less likely we'll delay UC22. So I'd like this somehow resolved quickly, if possible!

A related question to this is https://answers.launchpad.net/launchpad/+question/698179 , since I can't change any details of the snap as-is because of the manually set distro series.

Revision history for this message
Sergio Schvezov (sergiusens) said :
#7

If using bits from core20 (build-base: core20) to target a core22 based gadget solves your problem, then yes, you can freely do so.

If that does not solve your problem, Colin's proposal should work, but I would make it a one-time only thing to have a consistent expectation when building locally.

My longer-term proposal was to have a formal definition on this to be able to have a way to always target the development series for people to be able to self serve.

Revision history for this message
Colin Watson (cjwatson) said :
#8

I've done https://answers.launchpad.net/launchpad/+question/698179, and I'll work on changing a few constraints to permit core22 in the "source snap channels" dictionary.

Revision history for this message
Colin Watson (cjwatson) said :
#9

I've proposed https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/407080 and https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/407089 to update the constraints.

However, do you actually need to have "core22: edge" in the source snap channels in https://launchpad.net/~ubuntu-core-service/+snap/core22? I would have thought that if you're using "build-base: core20" then it shouldn't need to have a *source* channel for core22. I suspect that if you delete core22 from the source snap channels mapping, then validation will pass and you'll be able to set the series to "infer from snapcraft.yaml". This may require using the API - let me know if you want to go ahead with that but are having trouble.

Revision history for this message
Łukasz Zemczak (sil2100) said :
#10

Ok, I'll take a look at the core22 snap a bit later, because first I'd like to be able to get the UC22 core gadgets buildable, if possible.

So right now when trying to run builds of https://launchpad.net/~canonical-foundations/+snap/pi-arm64-22 I am still getting errors of "(No such base: 'core22'.)". I have tried maybe adding core22 to the list of auto_build_snaps, but I am getting precondition failed again - so possibly doing it wrong?

>>> snap.auto_build_channels.update({'core22': 'edge'})
>>> snap.lp_save()
(...)
lazr.restfulclient.errors.PreconditionFailed: HTTP Error 412: Precondition Failed
(...)

So we have a core22 snap in the store already - and the two pointed merge proposals seem to be merged, so I am wondering what else needs to happen for core22 to be unblocked as a base that I can use. Do I need to do anything to help with that? Or is it just a matter of the merged changes getting deployed in production?

Revision history for this message
Colin Watson (cjwatson) said :
#11

We just need to get the relevant code rolled out to production, which should happen this week.

Revision history for this message
Colin Watson (cjwatson) said :
#12

"(build-)base: core22" builds should work now, at least from Launchpad's point of view. Let us know if you have further problems that seem to be on us to fix.

Revision history for this message
Łukasz Zemczak (sil2100) said :
#13

Thank you for deploying this Colin!

I just tried running a build of the UC22 pi gadget (that uses core22 as base) and uh, sadly I'm getting the same error as before:
https://launchpad.net/~canonical-foundations/+snap/pi-arm64-22
"a moment ago (No such base: 'core22'.)"

I ran the build with the core22 snap targetted from edge, so it should be recognized? Am I forgetting something obvious? Thanks!

Revision history for this message
Colin Watson (cjwatson) said :
#14

Oh right, of course I missed a bit. I've created the SnapBase row in the database now, per my original proposal (I'll be very happy to help to enable coreXX or whatever once that exists, since that seems like a good idea). Try again?

Revision history for this message
Łukasz Zemczak (sil2100) said :
#15

Yay, now it seems to work! Thanks!