diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76a5e9a3d79..54d04d2a20a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/internal/dnfjson/dnfjson_test.go b/internal/dnfjson/dnfjson_test.go index 67ec0304b67..ed6f310db99 100644 --- a/internal/dnfjson/dnfjson_test.go +++ b/internal/dnfjson/dnfjson_test.go @@ -86,6 +86,11 @@ func TestMakeDepsolveRequest(t *testing.T) { Name: "user-repo-2", BaseURLs: []string{"https://example.org/user-repo-2"}, } + modHotfixRepo := rpmmd.RepoConfig{ + Name: "nginx", + BaseURLs: []string{"https://example.org/nginx"}, + ModuleHotfixes: common.ToPtr(true), + } tests := []struct { packageSets []rpmmd.PackageSet args []transactionArgs @@ -171,6 +176,44 @@ func TestMakeDepsolveRequest(t *testing.T) { }, }, }, + // module hotfixes flag is passed + { + packageSets: []rpmmd.PackageSet{ + { + Include: []string{"pkg1"}, + Exclude: []string{"pkg2"}, + Repositories: []rpmmd.RepoConfig{baseOS, appstream, modHotfixRepo}, + }, + }, + args: []transactionArgs{ + { + PackageSpecs: []string{"pkg1"}, + ExcludeSpecs: []string{"pkg2"}, + RepoIDs: []string{baseOS.Hash(), appstream.Hash(), modHotfixRepo.Hash()}, + }, + }, + wantRepos: []repoConfig{ + { + ID: baseOS.Hash(), + Name: "baseos", + BaseURLs: []string{"https://example.org/baseos"}, + repoHash: "fdc2e5bb6cda8e113308df9396a005b81a55ec00ec29aa0a447952ad4248d803", + }, + { + ID: appstream.Hash(), + Name: "appstream", + BaseURLs: []string{"https://example.org/appstream"}, + repoHash: "71c280f63a779a8bf53961ec2f15d51d052021de024a4e06ae499b8029701808", + }, + { + ID: modHotfixRepo.Hash(), + Name: "nginx", + BaseURLs: []string{"https://example.org/nginx"}, + ModuleHotfixes: common.ToPtr(true), + repoHash: "6ab05f54094ff2a0ee86facecae3e75e4065a01cc8caffbbbeb7505c6bfac283", + }, + }, + }, // 2 transactions + no package set specific repos { packageSets: []rpmmd.PackageSet{ diff --git a/internal/store/store.go b/internal/store/store.go index fd9e3b6cd44..05984ffae93 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -584,10 +584,11 @@ func (s *Store) GetAllDistroSources(distro string) map[string]SourceConfig { func NewSourceConfig(repo rpmmd.RepoConfig, system bool) SourceConfig { sc := SourceConfig{ - Name: repo.Name, - System: system, - RHSM: repo.RHSM, - GPGKeys: repo.GPGKeys, + Name: repo.Name, + System: system, + RHSM: repo.RHSM, + GPGKeys: repo.GPGKeys, + ModuleHotfixes: repo.ModuleHotfixes, } if repo.CheckGPG != nil { diff --git a/test/cases/api.sh b/test/cases/api.sh index 2686bb68bd5..da242dfad74 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -33,8 +33,8 @@ export IMAGE_TYPE_OCI="oci" export IMAGE_TYPE_VSPHERE="vsphere" export IMAGE_TYPE_IOT_COMMIT="iot-commit" -if (( $# > 2 )); then - echo "$0 does not support more than two arguments" +if (( $# > 3 )); then + echo "$0 does not support more than three arguments" exit 1 fi @@ -46,6 +46,7 @@ fi set -euo pipefail IMAGE_TYPE="$1" +TEST_MODULE_HOTFIXES="${3:-0}" # select cloud provider based on image type # @@ -438,6 +439,39 @@ EOF ) export FIREWALL_CUSTOMIZATION_BLOCK +if [ "$TEST_MODULE_HOTFIXES" = "1" ]; then + if [ "$ARCH" = "x86_64" ]; then + NGINX_REPO_URL="https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-x86_64-nginx-20231207" + else + NGINX_REPO_URL="https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-aarch64-nginx-20231207" + fi + EXTRA_PAYLOAD_REPOS_BLOCK=$(cat < "$REQUEST_FILE2" @@ -590,6 +626,15 @@ greenprint "Sending compose: Fail test" sendCompose "$REQUEST_FILE2" waitForState "failure" +if [ "$TEST_MODULE_HOTFIXES" = "1" ]; then + cat "$REQUEST_FILE" + + jq 'del(.customizations.payload_repositories[] | select(.baseurl | match(".*public/el8/el8-.*-nginx-.*")) | .module_hotfixes)' "$REQUEST_FILE" > "$REQUEST_FILE2" + greenprint "Sending compose: Fail depsolve test" + sendCompose "$REQUEST_FILE2" + waitForState "failure" +fi + # crashed/stopped/killed worker should result in the job being retried greenprint "Sending compose: Retry test" sendCompose "$REQUEST_FILE" diff --git a/test/cases/api/aws.sh b/test/cases/api/aws.sh index d9f882fa92f..beb82d26403 100644 --- a/test/cases/api/aws.sh +++ b/test/cases/api/aws.sh @@ -47,11 +47,11 @@ function createReqFile() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { diff --git a/test/cases/api/common/s3.sh b/test/cases/api/common/s3.sh index 27abfa5bd6e..5d7d7223342 100644 --- a/test/cases/api/common/s3.sh +++ b/test/cases/api/common/s3.sh @@ -21,11 +21,11 @@ function createReqFileEdge() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { @@ -67,11 +67,11 @@ function createReqFileGuest() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { @@ -108,11 +108,11 @@ function createReqFileVSphere() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK} ${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK} },