feat: add support for SUPPORT_END in /etc/os-release (#1612)

Signed-off-by: Benji Visser <benji@093b.org>
This commit is contained in:
Benji Visser 2023-02-27 11:43:19 -07:00 committed by GitHub
parent fbda21f4f4
commit 9e953b1da3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1670 additions and 18 deletions

View File

@ -6,5 +6,5 @@ const (
// JSONSchemaVersion is the current schema version output by the JSON encoder // JSONSchemaVersion is the current schema version output by the JSON encoder
// This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment. // This is roughly following the "SchemaVer" guidelines for versioning the JSON schema. Please see schema/json/README.md for details on how to increment.
JSONSchemaVersion = "7.0.0" JSONSchemaVersion = "7.0.1"
) )

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ type LinuxRelease struct {
BugReportURL string `json:"bugReportURL,omitempty"` BugReportURL string `json:"bugReportURL,omitempty"`
PrivacyPolicyURL string `json:"privacyPolicyURL,omitempty"` PrivacyPolicyURL string `json:"privacyPolicyURL,omitempty"`
CPEName string `json:"cpeName,omitempty"` CPEName string `json:"cpeName,omitempty"`
SupportEnd string `json:"supportEnd,omitempty"`
} }
func (s *IDLikes) UnmarshalJSON(data []byte) error { func (s *IDLikes) UnmarshalJSON(data []byte) error {

View File

@ -62,6 +62,7 @@ func toLinuxReleaser(d *linux.Release) model.LinuxRelease {
BugReportURL: d.BugReportURL, BugReportURL: d.BugReportURL,
PrivacyPolicyURL: d.PrivacyPolicyURL, PrivacyPolicyURL: d.PrivacyPolicyURL,
CPEName: d.CPEName, CPEName: d.CPEName,
SupportEnd: d.SupportEnd,
} }
} }

View File

@ -53,6 +53,7 @@ func toSyftLinuxRelease(d model.LinuxRelease) *linux.Release {
BugReportURL: d.BugReportURL, BugReportURL: d.BugReportURL,
PrivacyPolicyURL: d.PrivacyPolicyURL, PrivacyPolicyURL: d.PrivacyPolicyURL,
CPEName: d.CPEName, CPEName: d.CPEName,
SupportEnd: d.SupportEnd,
} }
} }

View File

@ -125,6 +125,7 @@ func parseOsRelease(contents string) (*Release, error) {
BugReportURL: values["BUG_REPORT_URL"], BugReportURL: values["BUG_REPORT_URL"],
PrivacyPolicyURL: values["PRIVACY_POLICY_URL"], PrivacyPolicyURL: values["PRIVACY_POLICY_URL"],
CPEName: values["CPE_NAME"], CPEName: values["CPE_NAME"],
SupportEnd: values["SUPPORT_END"],
} }
// don't allow for empty contents to result in a Release object being created // don't allow for empty contents to result in a Release object being created

View File

@ -89,19 +89,20 @@ func TestIdentifyRelease(t *testing.T) {
{ {
fixture: "test-fixtures/os/fedora", fixture: "test-fixtures/os/fedora",
release: &Release{ release: &Release{
PrettyName: "Fedora 31 (Container Image)", PrettyName: "Fedora Linux 36 (Container Image)",
Name: "Fedora", Name: "Fedora Linux",
ID: "fedora", ID: "fedora",
IDLike: nil, IDLike: nil,
Version: "31 (Container Image)", Version: "36 (Container Image)",
VersionID: "31", VersionID: "36",
Variant: "Container Image", Variant: "Container Image",
VariantID: "container", VariantID: "container",
HomeURL: "https://fedoraproject.org/", HomeURL: "https://fedoraproject.org/",
SupportURL: "https://fedoraproject.org/wiki/Communicating_and_getting_help", SupportURL: "https://ask.fedoraproject.org/",
BugReportURL: "https://bugzilla.redhat.com/", BugReportURL: "https://bugzilla.redhat.com/",
PrivacyPolicyURL: "https://fedoraproject.org/wiki/Legal:PrivacyPolicy", PrivacyPolicyURL: "https://fedoraproject.org/wiki/Legal:PrivacyPolicy",
CPEName: "cpe:/o:fedoraproject:fedora:31", CPEName: "cpe:/o:fedoraproject:fedora:36",
SupportEnd: "2023-05-16",
}, },
}, },
{ {

View File

@ -19,6 +19,7 @@ type Release struct {
BugReportURL string BugReportURL string
PrivacyPolicyURL string PrivacyPolicyURL string
CPEName string // A CPE name for the operating system, in URI binding syntax CPEName string // A CPE name for the operating system, in URI binding syntax
SupportEnd string // The date at which support for this version of the OS ends.
} }
func (r *Release) String() string { func (r *Release) String() string {

View File

@ -1,21 +1,22 @@
NAME=Fedora NAME="Fedora Linux"
VERSION="31 (Container Image)" VERSION="36 (Container Image)"
ID=fedora ID=fedora
VERSION_ID=31 VERSION_ID=36
VERSION_CODENAME="" VERSION_CODENAME=""
PLATFORM_ID="platform:f31" PLATFORM_ID="platform:f36"
PRETTY_NAME="Fedora 31 (Container Image)" PRETTY_NAME="Fedora Linux 36 (Container Image)"
ANSI_COLOR="0;34" ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:31" CPE_NAME="cpe:/o:fedoraproject:fedora:36"
HOME_URL="https://fedoraproject.org/" HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help" SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/" BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=31 REDHAT_BUGZILLA_PRODUCT_VERSION=36
REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=31 REDHAT_SUPPORT_PRODUCT_VERSION=36
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
SUPPORT_END=2023-05-16
VARIANT="Container Image" VARIANT="Container Image"
VARIANT_ID=container VARIANT_ID=container