-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 CoreOS RHEL flavor #7589
base: main
Are you sure you want to change the base?
Conversation
c703a0c
to
6868d15
Compare
6868d15
to
9fc8de3
Compare
9fc8de3
to
93c3356
Compare
@knqyf263 Could you please have a look at this one ? 🙇 |
@knqyf263 @DmitriyLewen Could you please take a look at this one please ? |
split := strings.SplitN(result[2], ".", 4) | ||
major, _ = strconv.Atoi(split[0]) | ||
if len(split) > 1 { | ||
minor, _ = strconv.Atoi(split[1]) | ||
} | ||
if len(split) > 2 { | ||
rel, _ = strconv.Atoi(split[2]) | ||
} |
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.
Can you add a comment with examples why we need this split?
It seems we can just use semver.Parse on result[2]
} | ||
|
||
coreosVersion, err := semver.Parse(fmt.Sprintf("%d.%d.%d", major, minor, rel)) | ||
if err == nil { |
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.
We need to return error here.
if coreos4_16, _ := semver.Parse("4.16.0"); coreosVersion.GreaterThanOrEqual(coreos4_16) { | ||
rhelVersion = "9.4" | ||
} else if coreos4_13, _ := semver.Parse("4.13.0"); coreosVersion.GreaterThanOrEqual(coreos4_13) { | ||
rhelVersion = "9.2" | ||
} else if coreos4_11, _ := semver.Parse("4.11.0"); coreosVersion.GreaterThanOrEqual(coreos4_11) { | ||
rhelVersion = "8.6" | ||
} else if coreos4_7_24, _ := semver.Parse("4.7.24"); coreosVersion.GreaterThanOrEqual(coreos4_7_24) { | ||
rhelVersion = "8.4" | ||
} else if coreos4_7_0, _ := semver.Parse("4.7.0"); coreosVersion.GreaterThanOrEqual(coreos4_7_0) { | ||
rhelVersion = "8.3" | ||
} else if coreos4_6_0, _ := semver.Parse("4.6.0"); coreosVersion.GreaterThanOrEqual(coreos4_6_0) { | ||
rhelVersion = "8.2" | ||
} else { | ||
return types.OS{}, xerrors.Errorf("coreos: invalid redhat-release") | ||
} |
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'm worried it will grow with each new version.
What if create map with versions and use constrains
e.g.: 8.6: ">= 4.11, >= 4.12"
Description
CoreOS is based on RHEL but the parsing done for /etc/redhat-release reports the version of OpenShift instead of the version of RHEL, preventing vulnerability matching.
Related issues
Related PRs
Remove this section if you don't have related PRs.
Checklist