Repository navigation
feat!: new lockfile format with GitHub release support via Packslip (PoC) #497
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
base: main
Are you sure you want to change the base?
Changes from all commits
2488bf1
6da00bc
321d3e4
872fddb
c9bf517
a6f4fe3
2ba4715
3c731e2
3124acd
d293bcf
bc3efed
489f45a
32bb820
99f70aa
e460f74
a1a3380
0384af2
1e69d71
94a4b2d
cf5ed3b
f204f97
2f8ef69
7e6606f
d949d20
ee6a2ee
a648873
698faaf
ec75b25
db6ccde
f83240e
314910f
36ac874
14e8d35
4652122
4729a0f
da5d8e0
d261ade
336420d
5cf4a05
707ae04
e70db98
c8d1994
e209d33
91525f5
1a37d4d
d4af9b8
c0a4815
b5febf2
062575a
3a593c6
37d7f58
ff3126c
326922d
a99d42d
32c1fb0
f9e02fa
bd39de2
a44cbeb
61984ba
e6f8bc5
8abcf97
f1cf000
f45c8f0
5620cbd
959127c
4161cad
3a2ad61
f5e1214
51d62fb
3e89aec
492a5b4
10e92fe
00cd6cf
f0bb04c
86e5c7a
6e4e9c4
defab88
cbbde4d
0e594bf
e81f957
e81229f
149b7a4
62766e1
c90bbb6
edf7261
f12184c
4332790
259ff78
3a2ee13
8e23239
40eafd2
fb43031
004faa9
b5bbdd3
bec4eaf
2788fe9
25b688d
313a56f
5ba9a90
b7fe901
54ea2f5
9df705a
9d3de65
5ab685f
3ca8f47
8decc31
2be8340
c59c273
382be68
9be32ed
55a8953
bce2cdc
deb556f
b8a3efc
f11a4ae
a68a96a
33beb73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,6 +137,9 @@ func (c *Client) getDriverListFromIndex(ctx context.Context, index *Registry) ([ | |
| for i := range drivers.Drivers { | ||
| drivers.Drivers[i].Registry = index | ||
| } | ||
| if err := validateRegistryMetadata(drivers.Drivers); err != nil { | ||
| return nil, fmt.Errorf("failed to parse driver registry index: %w", err) | ||
| } | ||
|
|
||
| result := drivers.Drivers | ||
| sort.Slice(result, func(i, j int) bool { | ||
|
|
@@ -271,25 +274,56 @@ func (c *Client) Install(ctx context.Context, cfg config.Config, driverName stri | |
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get package for driver %s: %w", driverName, err) | ||
| } | ||
| expected, err := expectedRegistryPackageMetadata(pkg) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to install driver %s: %w", driverName, err) | ||
| } | ||
|
|
||
| f, err := c.downloadPackage(ctx, pkg) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to download driver %s: %w", driverName, err) | ||
| } | ||
| defer f.Close() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Defers run LIFO: RemoveAll before Close → temp leak on Windows. Swap them. |
||
| defer os.RemoveAll(filepath.Dir(f.Name())) | ||
|
|
||
| manifest, err := config.InstallDriver(cfg, driverName, f) | ||
| manifest, err := config.InstallPackage(cfg, expected.ID, f, expected, config.InstallOptions{ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Verify: func(stagingDir string, manifest config.Manifest) error { | ||
| return VerifyPackageSignature(stagingDir, manifest) | ||
| }, | ||
| }) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to install driver %s: %w", driverName, err) | ||
| } | ||
|
|
||
| if err := config.CreateManifest(cfg, manifest.DriverInfo); err != nil { | ||
| return nil, fmt.Errorf("failed to create manifest for driver %s: %w", driverName, err) | ||
| } | ||
|
|
||
| return &manifest, nil | ||
| } | ||
|
|
||
| func expectedRegistryPackageMetadata(pkg PkgInfo) (config.ExpectedPackageMetadata, error) { | ||
| hasHash := pkg.ArtifactHash != "" | ||
| if pkg.Version == nil { | ||
| return config.ExpectedPackageMetadata{}, errors.New("registry package metadata is missing its version") | ||
| } | ||
| if strings.TrimSpace(pkg.PlatformTuple) == "" { | ||
| return config.ExpectedPackageMetadata{}, errors.New("registry package metadata is missing its platform") | ||
| } | ||
| if pkg.Driver.Registry == nil || pkg.Driver.Registry.BaseURL == nil { | ||
| return config.ExpectedPackageMetadata{}, errors.New("registry package metadata is missing its source identity") | ||
| } | ||
| if strings.TrimSpace(pkg.Driver.Path) == "" { | ||
| return config.ExpectedPackageMetadata{}, errors.New("registry package metadata is missing its driver ID") | ||
| } | ||
| expected := config.ExpectedPackageMetadata{ | ||
| ID: pkg.Driver.Path, | ||
| Version: pkg.Version.String(), | ||
| Platform: pkg.PlatformTuple, | ||
| SourceType: "registry", SourceIdentity: pkg.Driver.Registry.BaseURL.String(), | ||
| } | ||
| if hasHash { | ||
| expected.ArchiveHash = pkg.ArtifactHash | ||
| } | ||
| return expected, nil | ||
| } | ||
|
|
||
| // Uninstall uninstalls a driver with the given name from the specified configuration. | ||
| func (c *Client) Uninstall(cfg config.Config, driverName string) error { | ||
| di, err := config.GetDriver(cfg, driverName) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One malformed package entry now fails the whole index; skip invalid entries instead.