111 Commits

Author SHA1 Message Date
Alfonso Sánchez-Beato
d2f1a9ff2a image: support for local components 2024-07-11 15:11:21 -04:00
Miguel Pires
79c5ac14b2 many: remove usages of deprecated io/ioutil package (#13768)
* many: remove usages of deprecated io/ioutil package

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

* .golangci.yml: remove errcheck ignore rule for io/ioutil

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

* run-checks: prevent new usages of io/ioutil

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

---------

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-04-03 23:23:24 +02:00
Miguel Pires
29c9752d66 many: s/ioutil.WriteFile/os.WriteFile (#13217)
Replace ioutil.WriteFile with os.WriteFile since the former has been
deprecated since go1.16 and simply calls the latter.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-09-26 11:38:46 +01:00
Valentin David
bd642de304 image: relax version checks for preseeding 2023-06-23 16:27:34 +02:00
Philip Meulengracht
44dc7cfe8c image, store/tooling: correct how validation-sets were sent to store (#12763)
* image, store/tooling: fix how validation-sets and required revision was set for snaps that were controlled by validation-sets. Mirror how it's done for the snap validate --refresh.

* image: fix unit tests and optimize a bit how many times we call validationSetsAndRevisionForSnap

* image: wrong revision in comment

* image: review feedback, add TODO around missing logic for optional snaps, and add unit test for conflict logic that is now added

* image: review feedback, be a bit more consistent in naming between keys and actual validation-set objects
2023-04-26 15:42:00 +02:00
Philip Meulengracht
bdc82f35d7 image: pass validation-sets to store actions (#12692)
* image: pass validation-sets to store functions

* image: get fetched validation set assertions and use them for keys to store

* image: add additional check to unit test

* image: move seed database into imageSeeder structure

* image: fix unit test
2023-04-20 14:59:18 +02:00
Philip Meulengracht
4ccba690df image,seed/seedwriter: integrate manifest functionality into seed.Writer (3/3) (#12700)
* image: review feedback

add unit test case for the case where we end up downloading a different revision than we requested

* image: fix merge gone wrong

* image,seed/seedwriter: integrate SeedManifest into seedwriter.Writer

* seed/seedwriter: add a docstring to writer.SeedManifest()

* image,seed/seedwriter: fix uses of SeedManifest after rename

* seed/seedwriter: review feedback

don't copy ManifestPath as we already store a copy of options, but do keep a new instance of Manifest itself as we may initialize a new copy, fix docstring typo
move initManifest function to Options as a member function. Add seedwriter specific unit tests for manifest functionality.
rename initManifest() to manifest()
2023-04-17 21:42:20 +02:00
Philip Meulengracht
cd5bfe2c2c multiple: rename SeedManifest to Manifest after moving into seedwriter package (2/3) (#12732)
* image: review feedback

add unit test case for the case where we end up downloading a different revision than we requested

* image: fix merge gone wrong

* multiple: rename SeedManifest to Manifest for most references, unless it makes sense in the context to keep it as SeedManifest

* seed/seedwriter: rename tests from SeedManifest to Manifest

* multiple: review feedback

rename NewManifestForTest to MockManifest
2023-04-17 08:22:20 +02:00
Philip Meulengracht
7e676f7686 image,seed/seedwriter: move SeedManifest to the seedwriter package (1/3) (#12699)
* image: review feedback

add unit test case for the case where we end up downloading a different revision than we requested

* multiple: move SeedManifest into the seedwriter package.

* image: fix merge gone wrong
2023-04-14 12:54:07 +02:00
Philip Meulengracht
5977e58185 image: review feedback
Clarify error messages, move a few bits around so it makes more sense. Switch to snap.Revisions instead of integers.
2023-04-13 15:32:15 +02:00
Philip Meulengracht
fa68014de8 image: redo the seed manifest functionality, don't use interfaces and rely on the type system. Better support for validation sets, and don't output them when controlled by a validation set 2023-04-13 15:32:15 +02:00
Philip Meulengracht
a192d883eb image: update API a bit, add missing tests 2023-04-13 15:32:15 +02:00
Philip Meulengracht
294a417d1b image: split into Allowed/Used for validation-sets as well 2023-04-13 15:32:15 +02:00
Philip Meulengracht
ab325fc4bf image: fix unit tests, add additional unit tests 2023-04-13 15:32:15 +02:00
Philip Meulengracht
f18af073c3 cmd/snap,image: refactor image manifest code in preparation of validation-sets 2023-04-13 15:32:15 +02:00
Philip Meulengracht
c5bc938f80 image,seed: refactor RefAssertsFetcher (#12667)
* asserts,seed/seedwriter: refactor RefAssertsFetcher into a SeedAssertionFetcher with support for FetchSequence, and its own set of unit tests.

* seed/seedwriter: review feedback

Removed the TODO and updated docs for Writer.Start

* seed/seedwriter: review feedback

remove a line of the docs for SeedAssertionFetcher

* seed/seedwriter: review feedback

add additional case for calling FetchSequence with the default fetcher
2023-03-29 07:48:31 +02:00
Philip Meulengracht
cfef182fe7 image: fix odd output of fetching text and add a unit case to verify it looks ok now 2023-03-24 12:15:03 +01:00
Philip Meulengracht
8ad8d5914b image,tests: add snap architecture check against model architecture for prepare-image (#12603)
* image,tests: add architecture verification check as a part of prepare-image, for downloaded snaps and local snaps.

* tests: fix shellcheck warning

* image: review feedback

correct architecture detection, move the arch check from asserts fetching to before download step.

* image: use *image* instead of *seed* for determineImageArchitecture

* image: review feedback

fix incorrect logic in validateSnapArchs, which only happened to work since there was only one arch listed. Add additional unit test cases

* image: add a break, add some docs to unit test

* image: review feedback

separate out the arch-check logic from the loop itself.
2023-03-07 14:18:50 +01:00
Samuele Pedroni
3ade08b0af image: consider the kernel too for UC20+ to pick appropriate assert max formats (#12600) 2023-03-02 12:28:16 +01:00
Philip Meulengracht
b0848d7c77 image: review feedback
update docs for manifestFromLocalSnaps
2023-02-24 17:44:48 +01:00
Philip Meulengracht
2c88d68b31 image: review feedback
moved classic model check, rearranged the newImageSeeder function, rearranged members a bit inside imageSeeder
2023-02-24 17:44:48 +01:00
Philip Meulengracht
1baa049833 image: review feedback
extract used members from opts and remove options as an argument from functions that are part of imageSeeder
2023-02-24 17:44:48 +01:00
Philip Meulengracht
075beb6076 image: review feedback from @pedronis
Introduce start() and finish() concepts in imageSeeder that further encapsulates some functionality. Rearranged some o f the functions in the file.
2023-02-24 17:44:48 +01:00
Philip Meulengracht
9c50274d21 image: review feedback
introduce a new type imageSeeder to replace seedOptions, and move several members into that. Move some of the functions under the imageSeeder to utilize stored members.
2023-02-24 17:44:48 +01:00
Philip Meulengracht
4fd036d486 image: correct a doc comment 2023-02-24 17:44:48 +01:00