Skip to content
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

chore(pkg/generate): properly sort kernelurls before dumping them. #37

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions pkg/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestBuild(t *testing.T) {
RepoRoot: "./test",
Target: root.Target{
Distro: "centos",
KernelRelease: "5.14.0-368.el9.x86_64",
KernelRelease: "5.14.0-370.el9.x86_64",
KernelVersion: "1",
},
},
Expand All @@ -64,15 +64,15 @@ func TestBuild(t *testing.T) {
IgnoreErrors: false,
},
expectedLocalObjects: []string{
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
},
expectedBucketObjects: []string{
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
},
shouldCreate: true,
name: "build 5.0.1+driver centos 5.14.0-368.el9.x86_64",
name: "build 5.0.1+driver centos 5.14.0-370.el9.x86_64",
},
{
opts: Options{
Expand All @@ -83,7 +83,7 @@ func TestBuild(t *testing.T) {
RepoRoot: "./test",
Target: root.Target{
Distro: "centos",
KernelRelease: "5.14.0-370.el9.x86_64",
KernelRelease: "5.14.0-372.el9.x86_64",
KernelVersion: "1",
},
},
Expand All @@ -92,17 +92,17 @@ func TestBuild(t *testing.T) {
IgnoreErrors: false,
},
expectedLocalObjects: []string{
"falco_centos_5.14.0-372.el9.x86_64_1.ko",
"falco_centos_5.14.0-372.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
},
expectedBucketObjects: []string{
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
},
shouldCreate: false, // since it is not publishing
name: "build 5.0.1+driver centos 5.14.0-370.el9.x86_64",
name: "build 5.0.1+driver centos 5.14.0-372.el9.x86_64",
},
{
opts: Options{
Expand All @@ -113,7 +113,7 @@ func TestBuild(t *testing.T) {
RepoRoot: "./test",
Target: root.Target{
Distro: "centos",
KernelRelease: "5.14.0-368.el9.x86_64", // try to rebuild same object.
KernelRelease: "5.14.0-370.el9.x86_64", // try to rebuild same object.
KernelVersion: "1",
},
},
Expand All @@ -122,17 +122,17 @@ func TestBuild(t *testing.T) {
IgnoreErrors: false,
},
expectedLocalObjects: []string{
"falco_centos_5.14.0-372.el9.x86_64_1.ko",
"falco_centos_5.14.0-372.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
},
expectedBucketObjects: []string{
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
},
shouldCreate: false, // since objects are already present, nothing should be created
name: "rebuild 5.0.1+driver centos 5.14.0-368.el9.x86_64",
name: "rebuild 5.0.1+driver centos 5.14.0-370.el9.x86_64",
},
{
opts: Options{
Expand All @@ -143,7 +143,7 @@ func TestBuild(t *testing.T) {
RepoRoot: "./test",
Target: root.Target{
Distro: "centos",
KernelRelease: "5.14.0-368.el9.x86_64", // try to rebuild same object.
KernelRelease: "5.14.0-370.el9.x86_64", // try to rebuild same object.
KernelVersion: "1",
},
},
Expand All @@ -152,17 +152,17 @@ func TestBuild(t *testing.T) {
IgnoreErrors: false,
},
expectedLocalObjects: []string{
"falco_centos_5.14.0-372.el9.x86_64_1.ko",
"falco_centos_5.14.0-372.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
},
expectedBucketObjects: []string{
"falco_centos_5.14.0-368.el9.x86_64_1.ko",
"falco_centos_5.14.0-368.el9.x86_64_1.o",
"falco_centos_5.14.0-370.el9.x86_64_1.ko",
"falco_centos_5.14.0-370.el9.x86_64_1.o",
},
shouldCreate: true,
name: "rebuild and publish 5.0.1+driver centos 5.14.0-368.el9.x86_64",
name: "rebuild and publish 5.0.1+driver centos 5.14.0-370.el9.x86_64",
},
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"log/slog"
"os"
"path/filepath"
"slices"
)

var (
Expand Down Expand Up @@ -179,6 +180,9 @@ func dumpConfig(opts Options, dkYaml validate.DriverkitYaml) error {

dkYaml.Architecture = opts.Architecture.String()

// Sort kernelurls, so that we always get the same sorting for dbg configs.
slices.Sort(dkYaml.KernelUrls)

for _, driverVersion := range opts.DriverVersion {
dkYaml.FillOutputs(driverVersion, opts.Options)
yamlData, pvtErr := yaml.Marshal(&dkYaml)
Expand Down
Loading