Skip to content

Conversation

@woky
Copy link
Contributor

@woky woky commented May 15, 2023

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

  • Have you signed the CLA?

@woky woky force-pushed the pro-new/fips branch 2 times, most recently from 7c935d2 to 49eb38d Compare May 15, 2023 20:44
@woky woky mentioned this pull request May 15, 2023
@woky woky force-pushed the pro-new/fips branch 2 times, most recently from c6d8dee to 4889166 Compare May 16, 2023 08:18
@woky woky added the Priority Look at me first label May 16, 2023
@woky
Copy link
Contributor Author

woky commented May 16, 2023

The PR graph:
image

@woky woky force-pushed the pro-new/fips branch 7 times, most recently from 88f4b4e to 7be552c Compare May 24, 2023 20:12
Copy link

@rebornplusplus rebornplusplus left a 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.

@woky woky force-pushed the pro-new/fips branch 2 times, most recently from 1daec71 to 429a93c Compare May 31, 2023 17:02
Copy link
Collaborator

@cjdcordeiro cjdcordeiro left a 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

Copy link

@rebornplusplus rebornplusplus left a 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.

@woky woky force-pushed the pro-new/fips branch 4 times, most recently from 69b6e34 to 114d881 Compare June 8, 2023 13:05
@woky woky removed the Priority Look at me first label Jun 21, 2023
@woky woky force-pushed the pro-new/fips branch 2 times, most recently from cdb5478 to 20e79cb Compare June 21, 2023 18:05
@woky woky added the Blocked Waiting for something external label Jun 21, 2023
@woky woky force-pushed the pro-new/fips branch 2 times, most recently from ec11f41 to fcf970f Compare June 22, 2023 10:38
Copy link
Member

@TheSignPainter98 TheSignPainter98 left a 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
}

Copy link
Member

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) {
Copy link
Member

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?

@woky
Copy link
Contributor Author

woky commented Aug 7, 2023

@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.

@woky woky force-pushed the pro-new/fips branch 2 times, most recently from 15ef5e9 to 127599b Compare August 30, 2023 12:04
@woky woky force-pushed the pro-new/fips branch 3 times, most recently from 3561514 to 3b11012 Compare October 9, 2023 19:15
woky added 7 commits October 12, 2023 18:39
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.
@letFunny
Copy link
Collaborator

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.

@cjdcordeiro cjdcordeiro added the Decaying It's been a while, close or act on it label Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked Waiting for something external Decaying It's been a while, close or act on it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants