-
Notifications
You must be signed in to change notification settings - Fork 164
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
Fix get-deps tool to handle non LinuxKit containers #4168
Conversation
I realized that it is easier to check that the |
tools/get-deps/main.go
Outdated
for _, s := range deps { | ||
// We are just interested on packages from lfegde (those that we | ||
// published) | ||
if reLF.MatchString(s) { | ||
matches := rePkg.FindStringSubmatch(s) |
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.
I am not sure I get what this is doing. I think that it is:
- before: if it matched
lfedge/eve-:.*
then assume that it ispkg/<everything between eve-and tag :>
- after: if it matched
lfedge/eve-:<sha256>
then assume that it ispkg/<everything between eve-and tag :>
Is that it?
If so:
- Do you mind adding a README to this? You actually figured out how this works, it is good to capture it. Something that just describes what this does (in a sentence or two) and more importantly, by what logic it filters (the important part).
- Is that solid enough? I can see other things following that path that do not come out of here.
- Should we add a check for the path? Meaning, instead of (or in addition to), "if it is
lfedge/eve-.*:<sha256>
", maybe also check ifpkg/$1
exists, and, if not, clearly it doesn't belong as part of get-deps, so skip it?
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.
3. Should we add a check for the path? Meaning, instead of (or in addition to), "if it is
lfedge/eve-.*:<sha256>
", maybe also check ifpkg/$1
exists, and, if not, clearly it doesn't belong as part of get-deps, so skip it?
yes, this is what I wrote above. Maybe the easiest way.
Do you mind adding a README to this
I would, but not now. I fixed this one because it was a show stopper for my 'eve visibility' task
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.
Aw, no big deal. Two paragraphs. You know it never will get done otherwise. Who is going to take time to write it later?
yes, this is what I wrote above. Maybe the easiest way
Go for it.
for _, target := range targets { | ||
foundMap[target] = true | ||
expected := []string{"pkg/alpine", "pkg/xen-tools"} | ||
sort.Strings(expected) |
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 is guaranteed that filterPkg
returns a sorted array?
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.
@christoph-zededa no, this is why I sort them at lines 63,66
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.
ah, now I see; then it is okay
tools/get-deps/main.go
Outdated
version := matches[versionIndex] | ||
// lf-edge version can be sha256 or variable substitution for parse-pkg.sh | ||
// in later case it will be empty | ||
reSha256 := regexp.MustCompile("^[[:xdigit:]]{1,40}(-amd64|-arm64)?$") |
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.
I guess risc V is missing here, isn't it?
Yeah, it should be easier, FWIW (for other reviewers), the main goal of the tool is to scan Dockerfile files looking for dependencies of all eve-* packages that we built inside eve, so they will be under pkg/. With the introduction of the eve-rust (which AFAIK is now the only one that we build "outside" EVE) the parser wasn't prepared for this new use case and will consider a non-existent pkg/eve-rust, so it must be fixed.... |
33998a8
to
a6c953f
Compare
there is another broken case |
If the package is built outside EVE source tree the tool still adds it to dependencies and later Makefile fails to find target. We have lfedge/eve-rust container that is affected but this bug We just check that the package really exists in EVE source tree This commit also fixes the following incorrect dependency pkg/external-boot-image: pkg/kernel Also add some tests Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
a6c953f
to
c23efbc
Compare
For now 😁 |
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.
Much simpler and cleaner.
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.
LGTM
pkg/external-boot-image (kubevirt related) is still built by our Makefile (and has a directory under pkg/), so is valid to check this dependency... pkg/kernel was the old kernel package, but I see that a kind of workaround was introduced here: 6cff366 |
my fix fixes this incorrect dependency |
Merging, although there is one test failing. I don't see how it can be related to the PR. |
The tool assumed that all lfedge/... docker images are LinuxKit images and there must be pkg/ directory which it not true for e.g. eve-rust container
lfedge/eve-rust:1.80.1
Improve version parsing algorithm@jsfakian I think you also need this PR