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

cloudapi: Add module_hotfixes flag #3831

Merged
merged 3 commits into from
Dec 20, 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
26 changes: 26 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,32 @@ API:
- aws/rhel-9.2-ga-aarch64
INTERNAL_NETWORK: ["true"]

API-module-hotfixes:
stage: test
extends: .terraform
rules:
- !reference [.upstream_rules_all, rules]
# note: cloud API is not supported for on-prem installations so
# don't run this test case for nightly trees
script:
- schutzbot/deploy.sh
- /usr/libexec/tests/osbuild-composer/api.sh "${IMAGE_TYPE}" "" "${TEST_MODULE_HOTFIXES}"
parallel:
matrix:
- IMAGE_TYPE:
- aws
RUNNER:
- aws/rhel-8.8-ga-x86_64
- aws/rhel-8.8-ga-aarch64
INTERNAL_NETWORK: ["true"]
TEST_MODULE_HOTFIXES: [1]
- IMAGE_TYPE:
- vsphere
RUNNER:
- aws/rhel-8.8-ga-x86_64
INTERNAL_NETWORK: ["true"]
TEST_MODULE_HOTFIXES: [1]

.libvirt_integration:
stage: test
extends: .terraform/gcp
Expand Down
46 changes: 24 additions & 22 deletions cmd/osbuild-pipeline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ import (
)

type repository struct {
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
BaseURL string `json:"baseurl,omitempty"`
Metalink string `json:"metalink,omitempty"`
MirrorList string `json:"mirrorlist,omitempty"`
GPGKey string `json:"gpgkey,omitempty"`
CheckGPG bool `json:"check_gpg,omitempty"`
CheckRepoGPG bool `json:"repo_check_gpg,omitempty"`
IgnoreSSL bool `json:"ignore_ssl,omitempty"`
PackageSets []string `json:"package_sets,omitempty"`
RHSM bool `json:"rhsm,omitempty"`
Id string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
BaseURL string `json:"baseurl,omitempty"`
Metalink string `json:"metalink,omitempty"`
MirrorList string `json:"mirrorlist,omitempty"`
GPGKey string `json:"gpgkey,omitempty"`
CheckGPG bool `json:"check_gpg,omitempty"`
CheckRepoGPG bool `json:"repo_check_gpg,omitempty"`
IgnoreSSL bool `json:"ignore_ssl,omitempty"`
ModuleHotfixes *bool `json:"module_hotfixes,omitempty"`
PackageSets []string `json:"package_sets,omitempty"`
RHSM bool `json:"rhsm,omitempty"`
}

type ostreeOptions struct {
Expand Down Expand Up @@ -159,17 +160,18 @@ func main() {
}
checkGPG := repo.CheckGPG
repos[i] = rpmmd.RepoConfig{
Id: repoId,
Name: repoName,
BaseURLs: urls,
Metalink: repo.Metalink,
MirrorList: repo.MirrorList,
GPGKeys: keys,
CheckGPG: &checkGPG,
CheckRepoGPG: common.ToPtr(false),
IgnoreSSL: common.ToPtr(false),
PackageSets: repo.PackageSets,
RHSM: repo.RHSM,
Id: repoId,
Name: repoName,
BaseURLs: urls,
Metalink: repo.Metalink,
MirrorList: repo.MirrorList,
GPGKeys: keys,
CheckGPG: &checkGPG,
CheckRepoGPG: common.ToPtr(false),
IgnoreSSL: common.ToPtr(false),
ModuleHotfixes: repo.ModuleHotfixes,
PackageSets: repo.PackageSets,
RHSM: repo.RHSM,
}
}

Expand Down
5 changes: 5 additions & 0 deletions dnf-json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ class Solver():
# we set the expiration to a short time period, rather than 0.
repo.metadata_expire = desc.get("metadata_expire", "20s")

# This option if True disables modularization filtering. Effectively
# disabling modularity for given repository.
if "module_hotfixes" in desc:
repo.module_hotfixes = desc["module_hotfixes"]

return repo

@staticmethod
Expand Down
4 changes: 4 additions & 0 deletions internal/cloudapi/v2/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ func (request *ComposeRequest) GetBlueprintWithCustomizations() (blueprint.Bluep
repoCustomization.Priority = repo.Priority
}

if repo.ModuleHotfixes != nil {
repoCustomization.ModuleHotfixes = repo.ModuleHotfixes
}

repoCustomizations = append(repoCustomizations, repoCustomization)
}
bp.Customizations.Repositories = repoCustomizations
Expand Down
36 changes: 20 additions & 16 deletions internal/cloudapi/v2/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
Openscap: &OpenSCAP{ProfileId: "B 263-59"},
CustomRepositories: &[]CustomRepository{
CustomRepository{
Id: "custom repo",
Metalink: common.ToPtr("http://example.org/metalink"),
CheckGpg: common.ToPtr(true),
Enabled: common.ToPtr(true),
Id: "custom repo",
Metalink: common.ToPtr("http://example.org/metalink"),
CheckGpg: common.ToPtr(true),
Enabled: common.ToPtr(true),
ModuleHotfixes: common.ToPtr(true),
},
},
Firewall: &FirewallCustomization{
Expand Down Expand Up @@ -188,10 +189,11 @@ func TestGetBlueprintWithCustomizations(t *testing.T) {
},
Repositories: []blueprint.RepositoryCustomization{
blueprint.RepositoryCustomization{
Id: "custom repo",
Metalink: "http://example.org/metalink",
Enabled: common.ToPtr(true),
GPGCheck: common.ToPtr(true),
Id: "custom repo",
Metalink: "http://example.org/metalink",
Enabled: common.ToPtr(true),
GPGCheck: common.ToPtr(true),
ModuleHotfixes: common.ToPtr(true),
},
},
Firewall: &blueprint.FirewallCustomization{
Expand Down Expand Up @@ -249,20 +251,22 @@ func TestGetPayloadRepositories(t *testing.T) {
cr = ComposeRequest{Customizations: &Customizations{
PayloadRepositories: &[]Repository{
Repository{
Baseurl: common.ToPtr("http://example.org/pub/linux/repo"),
CheckGpg: common.ToPtr(true),
PackageSets: &[]string{"build", "archive"},
Rhsm: common.ToPtr(false),
Baseurl: common.ToPtr("http://example.org/pub/linux/repo"),
CheckGpg: common.ToPtr(true),
PackageSets: &[]string{"build", "archive"},
Rhsm: common.ToPtr(false),
ModuleHotfixes: common.ToPtr(true),
},
},
}}

expected := []Repository{
Repository{
Baseurl: common.ToPtr("http://example.org/pub/linux/repo"),
CheckGpg: common.ToPtr(true),
PackageSets: &[]string{"build", "archive"},
Rhsm: common.ToPtr(false),
Baseurl: common.ToPtr("http://example.org/pub/linux/repo"),
CheckGpg: common.ToPtr(true),
PackageSets: &[]string{"build", "archive"},
Rhsm: common.ToPtr(false),
ModuleHotfixes: common.ToPtr(true),
},
}
repos = cr.GetPayloadRepositories()
Expand Down
3 changes: 3 additions & 0 deletions internal/cloudapi/v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,9 @@ func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
if repo.CheckRepoGpg != nil {
repoConfig.CheckRepoGPG = repo.CheckRepoGpg
}
if repo.ModuleHotfixes != nil {
repoConfig.ModuleHotfixes = repo.ModuleHotfixes
}

if repoConfig.CheckGPG != nil && *repoConfig.CheckGPG && len(repoConfig.GPGKeys) == 0 {
return nil, HTTPError(ErrorNoGPGKey)
Expand Down
Loading
Loading