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

feat: add support for "v2-archives" in "v1" format #23

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

rebornplusplus
Copy link

v2-archives defines the archives, the same as archives. It is added to define Ubuntu Pro archives in chisel-releases with pro and priority fields (see canonical#160 and canonical#167), while supporting Chisel<=v1.0.0 and chisel-releases format<=v1. Since Chisel ignores unknown fields, archives defined in v2-archives will be ignored by v1.0.0 but picked up by later versions.

Introducing the Pro archives in chisel.yaml will make all Chisel versions <=v1.0.0 break, since Chisel will parse all the archives regardless of the default field, and map every archive entry to archives.ubuntu.com, thus failing due to invalid keys and suites.

As we previously did for v1-public-keys, let’s now add v2-archives such that older versions of Chisel keep working. Later on, with the newest chisel-release we can bump the format version to v2 .

v1 will nonetheless be maintained, so v2-archives will linger in the Chisel codebase for a long time.

-- ROCKS-1729

"v2-archives" defines the archives, same as "archives". It is added to
define Ubuntu Pro archives in chisel-releases with "pro" and "priority"
fields (see canonical#160 and canonical#167), while supporting Chisel<=v1.0.0 and
chisel-releases "format"<=v1. Since Chisel ignores unknown fields,
archives defined in "v2-archives" will be ignored by v1.0.0 but picked
up by later versions.
Copy link
Owner

@letFunny letFunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this Rafid! Almost ready, just added some light improvements.

internal/setup/setup_test.go Outdated Show resolved Hide resolved
internal/setup/setup_test.go Outdated Show resolved Hide resolved
internal/setup/setup_test.go Outdated Show resolved Hide resolved
internal/setup/yaml.go Outdated Show resolved Hide resolved
Copy link

@zhijie-yang zhijie-yang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks overall good to me. Just one nitpick besides Alberto's reviews.

@@ -161,7 +172,7 @@ func parseRelease(baseDir, filePath string, data []byte) (*Release, error) {
if yamlVar.Format != "v1" {
return nil, fmt.Errorf("%s: unknown format %q", fileName, yamlVar.Format)
}
if len(yamlVar.Archives) == 0 {
if len(yamlVar.Archives)+len(yamlVar.V2Archives) == 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temporal variable len(yamlVar.Archives)+len(yamlVar.V2Archives) is used twice, can we give it a name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's that big of a deal to have a variable for this. Let me know if you have strong preferences for this.

Copy link
Owner

@letFunny letFunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two very very minor comments Rafid, thanks for this!

internal/setup/setup_test.go Outdated Show resolved Hide resolved
internal/slicer/slicer_test.go Outdated Show resolved Hide resolved
@letFunny letFunny merged commit 3fa5d2f into letFunny:main Dec 13, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants