From 133996de4565dc25236b7ad2a20d4271d6045f30 Mon Sep 17 00:00:00 2001 From: Omkar Khatavkar Date: Fri, 11 Oct 2024 18:43:42 +0530 Subject: [PATCH] [6.15.z] - changes to use the beaker urls for running upstream sanity (#16549) (#16623) changes to use the beaker urls for running upstream sanity (#16549) --- conf/capsule.yaml.template | 2 +- conf/dynaconf_hooks.py | 8 +++++-- conf/server.yaml.template | 2 +- pytest_fixtures/core/sat_cap_factory.py | 19 +++++++++++----- robottelo/config/validators.py | 6 +++-- tests/foreman/installer/test_installer.py | 27 ++++++++++++++--------- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/conf/capsule.yaml.template b/conf/capsule.yaml.template index aed01592162..62f517290b5 100644 --- a/conf/capsule.yaml.template +++ b/conf/capsule.yaml.template @@ -7,7 +7,7 @@ CAPSULE: # The snap version currently testing (if applicable) # SNAP: # The source of Capsule packages. Can be one of: - # internal, ga + # internal, ga, nightly SOURCE: "internal" # The base os rhel version where the capsule installed # RHEL_VERSION: diff --git a/conf/dynaconf_hooks.py b/conf/dynaconf_hooks.py index 0fb3734eeee..03807f5a211 100644 --- a/conf/dynaconf_hooks.py +++ b/conf/dynaconf_hooks.py @@ -11,8 +11,12 @@ def post(settings): - settings_cache_path = Path(f'settings_cache-{settings.server.version.release}.json') - if getattr(settings.robottelo.settings, 'get_fresh', True): + settings_cache_path = Path( + f'settings_cache-{settings.server.version.release}-{settings.server.version.snap}.json' + ) + if settings.server.version.source == 'nightly': + data = Box({'REPOS': {}}) + elif getattr(settings.robottelo.settings, 'get_fresh', True): data = get_repos_config(settings) write_cache(settings_cache_path, data) else: diff --git a/conf/server.yaml.template b/conf/server.yaml.template index 7abb7857b36..79a66757586 100644 --- a/conf/server.yaml.template +++ b/conf/server.yaml.template @@ -9,7 +9,7 @@ SERVER: # The snap version currently testing (if applicable) SNAP: 1.0 # The source of Satellite packages. Can be one of: - # internal, ga + # internal, ga, nightly SOURCE: "internal" # The RHEL Base OS Version(x.y) where the Satellite is installed RHEL_VERSION: '8' diff --git a/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 9209a08ec40..cee481d3337 100644 --- a/pytest_fixtures/core/sat_cap_factory.py +++ b/pytest_fixtures/core/sat_cap_factory.py @@ -370,12 +370,19 @@ def installer_satellite(request): for repo in sat.SATELLITE_CDN_REPOS.values(): sat.enable_repo(repo, force=True) else: - # get ohsnap repofile - sat.download_repofile( - product='satellite', - release=settings.server.version.release, - snap=settings.server.version.snap, - ) + if settings.server.version.source == 'nightly': + sat.create_custom_repos( + satellite_repo=settings.repos.satellite_repo, + satmaintenance_repo=settings.repos.satmaintenance_repo, + ) + else: + # get ohsnap repofile + sat.download_repofile( + product='satellite', + release=settings.server.version.release, + snap=settings.server.version.snap, + ) + if settings.robottelo.rhel_source == "internal": # disable rhel repos from cdn sat.disable_repo("rhel-*") diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index 89c7aa7e24a..9056b20358a 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -13,7 +13,7 @@ Validator('server.hostname', is_type_of=str), Validator('server.hostnames', must_exist=True, is_type_of=list), Validator('server.version.release', must_exist=True), - Validator('server.version.source', default='internal', is_in=['internal', 'ga']), + Validator('server.version.source', default='internal', is_in=['internal', 'ga', 'nightly']), Validator('server.version.rhel_version', must_exist=True, cast=str), Validator( 'server.xdist_behavior', must_exist=True, is_in=['run-on-one', 'balance', 'on-demand'] @@ -79,7 +79,9 @@ ], capsule=[ Validator('capsule.version.release', must_exist=True), - Validator('capsule.version.source', default='internal', is_in=['internal', 'ga']), + Validator( + 'capsule.version.source', default='internal', is_in=['internal', 'ga', 'nightly'] + ), Validator('capsule.deploy_workflows', must_exist=True, is_type_of=dict), Validator('capsule.deploy_workflows.product', must_exist=True), Validator('capsule.deploy_workflows.os', must_exist=True), diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 854409cb36c..f9aa419b10a 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -1449,21 +1449,28 @@ def setup_capsule_repos(satellite, capsule_host, org, ak): else: # configure internal source as custom repos product_capsule = satellite.api.Product(organization=org.id).create() - for repo_variant in ['capsule', 'maintenance']: - dogfood_repo = dogfood_repository( - ohsnap=settings.ohsnap, - repo=repo_variant, - product="capsule", - release=settings.capsule.version.release, - os_release=capsule_host.os_version.major, - snap=settings.capsule.version.snap, - ) + for repo_variant, repo_default_url in [ + ('capsule', 'capsule_repo'), + ('maintenance', 'satmaintenance_repo'), + ]: + if settings.capsule.version.source == 'nightly': + repo_url = getattr(settings.repos, repo_default_url) + else: + repo_url = dogfood_repository( + ohsnap=settings.ohsnap, + repo=repo_variant, + product="capsule", + release=settings.capsule.version.release, + os_release=capsule_host.os_version.major, + snap=settings.capsule.version.snap, + ).baseurl repo = satellite.api.Repository( organization=org.id, product=product_capsule, content_type='yum', - url=dogfood_repo.baseurl, + url=repo_url, ).create() + # custom repos need to be explicitly enabled ak.content_override( data={