-
Notifications
You must be signed in to change notification settings - Fork 55
Add support for Pro FIPS archives #61
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
Conversation
7c935d2 to
49eb38d
Compare
c6d8dee to
4889166
Compare
88f4b4e to
7be552c
Compare
rebornplusplus
left a comment
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.
It looks good to me overall. I have a few questions asking for more info.
1daec71 to
429a93c
Compare
cjdcordeiro
left a comment
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.
my comments from #53 were addressed here so this lgtm
rebornplusplus
left a comment
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.
Looks good to me now.
69b6e34 to
114d881
Compare
cdb5478 to
20e79cb
Compare
ec11f41 to
fcf970f
Compare
TheSignPainter98
left a comment
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.
Just spotted some code-style issues and what I think are a few semantic oddities :)
| } | ||
| archives[archiveName] = openArchive | ||
| } | ||
|
|
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.
As the code block above populates archives and the block here checks it, I think they're strongly-linked enough to merit removing this blank line
| var ErrNoArchiveCredentials = errors.New("no archive credentials") | ||
|
|
||
| func initProArchive(pro string, archive *ubuntuArchive) error { | ||
| if i := sort.SearchStrings(validPro, pro); !(i < len(validPro) && validPro[i] == pro) { |
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.
This is subjective, but to simplify the condition, would it be cleaner to use i >= len(validPro) || validPro[i] != pro?
|
@TheSignPainter98 Thank you very much for your suggestions. But as I said in #77 (comment), I have to postpone applying and responding to them until #60 is merged because of the way the PRs are structured. |
15ef5e9 to
127599b
Compare
3561514 to
3b11012
Compare
Currently we only test with the embedded base-files files package. This quite limits what we can test. But since commit a3315e3 ("testutil/pkgdata: Create deb programatically") we have the ability to define our own custom package content. Add support for testing with custom packages. These can be defined in each test case per archive name. The content can be defined directly in test case definition with the help of testutil.MustMakeDeb(). The package content is wrapped in the testPackage structure. This introduces one level of nesting in each test case package definition. In future, we will add package metadata to the package definition, namely version. So wrapping the package content in the structure now and later just adding a new field to it the structure later will make the future diff much smaller.
At some point we will need to get information about (deb) packages from (Go) packages other than archive, namely from the slicer package. For instance: - Package entries in Chisel DB will include version, digest and architecture. - Multi-archive package selection will need to know versions of a package in all configured archives. Add Info() method to the Archive interface that returns a new PackageInfo interface that contains accessors for the underlying control.Section of the package. Currently these accessors are Name(), Version(), Arch() and SHA256() methods. The reason to introduce PackageInfo interface instead of returing control.Section directly is keep the archive abstraction and not leak implementation details.
In the future, we'd like to support different kinds of archives which have a non-empty intersection of packages. In other words, we'd like to support archives that partly override the Ubuntu archive. Currently, each sliced package is tied to an archive via the "archive" property that defaults to the default archive. Drop this link from the sliced packages to the archives and select the latest available version of the package from all configured archives. This commit, in effect, doesn't change the current behavior because we don't allow archives to define their URLs. It's only preparation for future commits that will add support for different types of archives.
If a package to be downloaded exists in archive A and archive B, and archive A has higher priority than archive B, the package is downloaded from archive A even if archive B has a newer version. If two or more archives have the same priority, the most recent version of the package from all of them is selected, if any. Otherwise, lower priority archives are tried, if any.
When two or more archives with highest priority contain a package with the same version, the choice is effectively random, because the iteration order over options.Archives map is not defined. Get rid of this nondeterminism by sorting archives by their priority and then lexicographically by their labels (greater label wins) when the priorities are equal. Since archive labels are used as keys in YAML map, they should be unique and the order should be total.
Archive priority is currently defined as int. This can make chisel.yaml with very high/low priorities non-portable, e.g. from amd64 to arm32. Change archive priority definition to int32 data type.
Support Pro archives by a pro property in chisel.yaml. When the pro property is specified, it has to be either "fips" or "fips-updates". The repository URL is inferred from the value. Also, credentials for these URLs are searched. If credentials are not found, the corresponding pro archive is silently disabled. Otherwise, all requests to the archive are sent with the credentials found.
|
Per our offline discussion, I think our best way forward is to close this PR and discuss with @rebornplusplus to see if it is a priority right now, and how to amend the code here to make it compatible with the latest changes. We will take that discussion offline and we can always re-open the PRs or create new ones as we see fit. |

Support Pro archives by a pro property in chisel.yaml. When the pro
property is specified, it has to be either "fips" or "fips-updates". The
repository URL is inferred from the value. Also, credentials for these URLs
are searched. If credentials are not found, the corresponding pro archive
is silently disabled. Otherwise, all requests to the archive are sent with
the credentials found.
This PR depends on #60 and #59