New install/refresh API with the store

We had discussed during the Rally to consider changing our json field names to using dashes instead of underscores to align with how things are presented in snapd and assertions.

afaik that is what we are doing (also as seen in code) but the discussion here is often using _ still:

Yes, all fields (input and output) will use - instead of _ if theyā€™re multi-word names.

@pedronis are you ok with changing the input ā€˜nameā€™ parameter to ā€˜snap-nameā€™ (for consistency reasons mostly).

Iā€™m not even 100% sure about ā€œsnap-nameā€ in the output, seems a topic for when Gustavo is back

@pedronis okā€¦ I will pre-emptively change the input field to snap-name (for consistency reasons) and we can review this (globally) when @niemeyer comes back.

I would have left it aloneā€¦ but let me know, I need to update the top post, giving that this is input

@pedronis letā€™s define the new API for getting details for a snap here or you will open a new thread? thanks!

The consistent version of this in the snap world is actually ā€œnameā€.

Thatā€™s true in more places than I can count, but just of the top of my mind:

  • snapd API
  • snap info command output
  • snap list command output
  • snapd code, all of it
  • client library
  • snap.yaml
  • snapcraft.yaml
  • ā€¦

@pedronis @chipaca , do we need pagination on this endpoint?

Furthermore, is pagination possible? (Iā€™m in doubt, because that would mean that after considering all the context and all proper validations, returning ā€œonly the first Nā€ responses it would mean that the client would apply part of the ā€œresulting stateā€ā€¦

I donā€™t think pagination makes sense for this API (if we really reach payload size issues in a while will need to think, but donā€™t think pagination alone would be an answer)

Maybe we should remove the snap id and name from here, as those already are part of the mandatory external information where these fields will be includedā€¦ what do you think?

So, weā€™ll leave snap_id and package_name out of internal fields, as itā€™s alredy in the mandatory data ā€œoutsideā€

@pedronis @chipaca Questionā€¦

If revision is specified (in the ā€œinstallā€ and/or ā€œrefreshā€ sections), the Store should try to answer that revision if that revision is currently released or was released at some point in the past in the specified channel? Or ā€˜channelā€™ becomes irrelevant if ā€˜revisionā€™ is specified?

Thanks!!

@pedronis @niemeyer questionā€¦ if the revision is specified in the ā€œinstallā€ or ā€œrefreshā€ request, all the ā€œcontrolsā€ apply? I mean if even if the client specify a revision X, the server needs to check ā€œif that revision is validated because itā€™s a gated snapā€ or ā€œif the revision complies with the stepped updates rulesā€ā€¦

Or if a revision is specified we should just return it and thatā€™s all?

One detail to consider in this case is what would happen if we just return the requested revision, and then an auto-refresh happens and the revision is changedā€¦

For the record, for the Stepped Updates (Epoch) analysis we took the decision of returning 404 if a revision is requested but it ā€œbreaksā€ the rules to get to that revisionā€¦

Thanks!

We can live with either behavior I think, because at least for ā€œrefreshā€ snapd will check the refresh-control constraints and also epoch (once we have them). Checking unless ignore-validation is sent would be more consistent though.

started proposing PRs for this work:

https://github.com/snapcore/snapd/pull/4770
https://github.com/snapcore/snapd/pull/4771
https://github.com/snapcore/snapd/pull/4772

proposed PRs:

https://github.com/snapcore/snapd/pull/4896

and this for actually using the new API:

https://github.com/snapcore/snapd/pull/4900

Support and switch to this is now on master.

Backport for 2.32.x has been prepared here:

https://github.com/snapcore/snapd/pull/5002

support and use have landed in 2.32.4

1 Like