-
Notifications
You must be signed in to change notification settings - Fork 52
Add support for Rocky and Alma Linux 8/9 #546
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f07ec82
Add support for Rocky and Alma Linux 8/9
cpuguy83 1054705
Re-arrange linux tests into some separate files for each target.
cpuguy83 829f0c9
test: fix lib paths
cpuguy83 72f88ec
Fix missing grep from test spec
cpuguy83 d01c433
Fix almalinux8 dnf cache key
cpuguy83 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package almalinux | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/Azure/dalec" | ||
| "github.com/Azure/dalec/frontend" | ||
| gwclient "github.com/moby/buildkit/frontend/gateway/client" | ||
| ) | ||
|
|
||
| var ( | ||
| builderPackages = []string{ | ||
| "rpm-build", | ||
| "ca-certificates", | ||
| } | ||
|
|
||
| targets = map[string]gwclient.BuildFunc{ | ||
| v8TargetKey: ConfigV8.Handle, | ||
| v9TargetKey: ConfigV9.Handle, | ||
| } | ||
|
|
||
| defaultPlatformConfig = dalec.RepoPlatformConfig{ | ||
| ConfigRoot: "/etc/yum.repos.d", | ||
| GPGKeyRoot: "/etc/pki/rpm-gpg", | ||
| ConfigExt: ".repo", | ||
| } | ||
| ) | ||
|
|
||
| func Handlers(ctx context.Context, client gwclient.Client, m *frontend.BuildMux) error { | ||
| return frontend.LoadBuiltinTargets(targets)(ctx, client, m) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package almalinux | ||
|
|
||
| import ( | ||
| "github.com/Azure/dalec/targets/linux/rpm/distro" | ||
| ) | ||
|
|
||
| const ( | ||
| v8TargetKey = "almalinux8" | ||
| dnfCacheNameV8 = "v8-dnf-cache" | ||
|
|
||
| // v8Ref is the image ref used for the base worker image | ||
| v8Ref = "mcr.microsoft.com/mirror/docker/library/almalinux:8" | ||
| v8FullName = "AlmaLinux 8" | ||
| // v8WorkerContextName is the build context name that can be used to lookup | ||
| v8WorkerContextName = "dalec-almalinux8-worker" | ||
| ) | ||
|
|
||
| var ConfigV8 = &distro.Config{ | ||
| ImageRef: v8Ref, | ||
| ContextRef: v8WorkerContextName, | ||
|
|
||
| CacheName: dnfCacheNameV8, | ||
| CacheDir: "/var/cache/dnf", | ||
|
|
||
| ReleaseVer: "8", | ||
| BuilderPackages: builderPackages, | ||
| BasePackages: []string{"almalinux-release", "tzdata"}, | ||
| RepoPlatformConfig: &defaultPlatformConfig, | ||
| InstallFunc: distro.DnfInstall, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package almalinux | ||
|
|
||
| import ( | ||
| "github.com/Azure/dalec/targets/linux/rpm/distro" | ||
| ) | ||
|
|
||
| const ( | ||
| v9TargetKey = "almalinux9" | ||
| dnfCacheNameV9 = "almalinux9-dnf-cache" | ||
|
|
||
| // v9Ref is the image ref used for the base worker image | ||
| v9Ref = "mcr.microsoft.com/mirror/docker/library/almalinux:9" | ||
| v9FullName = "AlmaLinux 9" | ||
| // v9WorkerContextName is the build context name that can be used to lookup | ||
| v9WorkerContextName = "dalec-almalinux9-worker" | ||
| ) | ||
|
|
||
| var ConfigV9 = &distro.Config{ | ||
| ImageRef: v9Ref, | ||
| ContextRef: v9WorkerContextName, | ||
|
|
||
| CacheName: dnfCacheNameV9, | ||
| CacheDir: "/var/cache/dnf", | ||
|
|
||
| ReleaseVer: "9", | ||
| BuilderPackages: builderPackages, | ||
| BasePackages: []string{"almalinux-release", "tzdata"}, | ||
| RepoPlatformConfig: &defaultPlatformConfig, | ||
| InstallFunc: distro.DnfInstall, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package rockylinux | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/Azure/dalec" | ||
| "github.com/Azure/dalec/frontend" | ||
| gwclient "github.com/moby/buildkit/frontend/gateway/client" | ||
| ) | ||
|
|
||
| var ( | ||
| builderPackages = []string{ | ||
| "rpm-build", | ||
| "ca-certificates", | ||
| } | ||
|
|
||
| targets = map[string]gwclient.BuildFunc{ | ||
| v8TargetKey: ConfigV8.Handle, | ||
| v9TargetKey: ConfigV9.Handle, | ||
| } | ||
|
|
||
| defaultPlatformConfig = dalec.RepoPlatformConfig{ | ||
| ConfigRoot: "/etc/yum.repos.d", | ||
| GPGKeyRoot: "/etc/pki/rpm-gpg", | ||
| ConfigExt: ".repo", | ||
| } | ||
| ) | ||
|
|
||
| func Handlers(ctx context.Context, client gwclient.Client, m *frontend.BuildMux) error { | ||
| return frontend.LoadBuiltinTargets(targets)(ctx, client, m) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package rockylinux | ||
|
|
||
| import ( | ||
| "github.com/Azure/dalec/targets/linux/rpm/distro" | ||
| ) | ||
|
|
||
| const ( | ||
| v8TargetKey = "rockylinux8" | ||
| dnfCacheNameV8 = "rockylinux8-dnf-cache" | ||
|
|
||
| // v8Ref is the image ref used for the base worker image | ||
| v8Ref = "mcr.microsoft.com/mirror/docker/library/rockylinux:8" | ||
| v8FullName = "rockyLinux 8" | ||
| // v8WorkerContextName is the build context name that can be used to lookup | ||
| v8WorkerContextName = "dalec-rockylinux8-worker" | ||
| ) | ||
|
|
||
| var ConfigV8 = &distro.Config{ | ||
| ImageRef: v8Ref, | ||
| ContextRef: v8WorkerContextName, | ||
|
|
||
| CacheName: dnfCacheNameV8, | ||
| CacheDir: "/var/cache/dnf", | ||
|
|
||
| ReleaseVer: "8", | ||
| BuilderPackages: builderPackages, | ||
| BasePackages: []string{"rocky-release", "tzdata"}, | ||
| RepoPlatformConfig: &defaultPlatformConfig, | ||
| InstallFunc: distro.DnfInstall, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package rockylinux | ||
|
|
||
| import ( | ||
| "github.com/Azure/dalec/targets/linux/rpm/distro" | ||
| ) | ||
|
|
||
| const ( | ||
| v9TargetKey = "rockylinux9" | ||
| dnfCacheNameV9 = "rockylinux9-dnf-cache" | ||
|
|
||
| // v9Ref is the image ref used for the base worker image | ||
| v9Ref = "mcr.microsoft.com/mirror/docker/library/rockylinux:9" | ||
| v9FullName = "rockyLinux 9" | ||
| // v9WorkerContextName is the build context name that can be used to lookup | ||
| v9WorkerContextName = "dalec-rockylinux9-worker" | ||
| ) | ||
|
|
||
| var ConfigV9 = &distro.Config{ | ||
| ImageRef: v9Ref, | ||
| ContextRef: v9WorkerContextName, | ||
|
|
||
| CacheName: dnfCacheNameV9, | ||
| CacheDir: "/var/cache/dnf", | ||
|
|
||
| ReleaseVer: "9", | ||
| BuilderPackages: append(builderPackages, "systemd-rpm-macros"), | ||
| BasePackages: []string{"rocky-release", "tzdata"}, | ||
| RepoPlatformConfig: &defaultPlatformConfig, | ||
| InstallFunc: distro.DnfInstall, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package test | ||
|
|
||
| import ( | ||
| "github.com/Azure/dalec" | ||
| "github.com/Azure/dalec/targets/linux/rpm/distro" | ||
| "github.com/moby/buildkit/client/llb" | ||
| ) | ||
|
|
||
| func createYumRepo(installer *distro.Config) func(rpms llb.State, opts ...llb.StateOption) llb.StateOption { | ||
| return func(rpms llb.State, opts ...llb.StateOption) llb.StateOption { | ||
| return func(in llb.State) llb.State { | ||
| localRepo := []byte(` | ||
| [Local] | ||
| name=Local Repository | ||
| baseurl=file:///opt/repo | ||
| gpgcheck=0 | ||
| priority=0 | ||
| enabled=1 | ||
| `) | ||
|
|
||
| pg := dalec.ProgressGroup("Install local repo for test") | ||
| withRepos := in. | ||
| Run(installer.Install([]string{"createrepo"}), pg). | ||
| File(llb.Mkdir("/opt/repo/RPMS", 0o755, llb.WithParents(true)), pg). | ||
| File(llb.Mkdir("/opt/repo/SRPMS", 0o755), pg). | ||
| File(llb.Mkfile("/etc/yum.repos.d/local.repo", 0o644, localRepo), pg). | ||
| Run( | ||
| llb.AddMount("/tmp/st", rpms, llb.Readonly), | ||
| dalec.ShArgs("cp /tmp/st/RPMS/$(uname -m)/* /opt/repo/RPMS/ && cp /tmp/st/SRPMS/* /opt/repo/SRPMS"), | ||
| pg, | ||
| ). | ||
| Run(dalec.ShArgs("createrepo --compatibility /opt/repo"), pg). | ||
| Root() | ||
|
|
||
| for _, opt := range opts { | ||
| withRepos = withRepos.With(opt) | ||
| } | ||
|
|
||
| return withRepos | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.