Skip to content
Draft
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
107 changes: 105 additions & 2 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
job: tests
trigger: ignore
fmf_url: "https://gitlab.cee.redhat.com/oamg/leapp-tests"
fmf_ref: "main"
fmf_ref: "next"
use_internal_tf: True
labels:
- sanity
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
job: tests
trigger: ignore
fmf_url: "https://gitlab.cee.redhat.com/oamg/leapp-tests"
fmf_ref: "main"
fmf_ref: "next"
use_internal_tf: True
labels:
- sanity
Expand All @@ -460,6 +460,15 @@ jobs:
tmt:
plan_filter: 'tag:9to10'
environments:
- &tmt-env-settings-centos9to10
tmt:
context: &tmt-context-centos9to10
distro: "centos-9"
distro_target: "centos-10"
settings:
provisioning:
tags:
BusinessUnit: sst_upgrades@leapp_upstream_test
- &tmt-env-settings-96to100
tmt:
context: &tmt-context-96to100
Expand All @@ -478,6 +487,15 @@ jobs:
provisioning:
tags:
BusinessUnit: sst_upgrades@leapp_upstream_test
- &tmt-env-settings-centos9torhel101
tmt:
context: &tmt-context-centos9torhel101
distro: "centos-9"
distro_target: "rhel-10.1"
settings:
provisioning:
tags:
BusinessUnit: sst_upgrades@leapp_upstream_test
- &tmt-env-settings-98to102
tmt:
context: &tmt-context-98to102
Expand All @@ -487,6 +505,15 @@ jobs:
provisioning:
tags:
BusinessUnit: sst_upgrades@leapp_upstream_test
- &tmt-env-settings-centos9torhel102
tmt:
context: &tmt-context-centos9torhel102
distro: "centos-9"
distro_target: "rhel-10.2"
settings:
provisioning:
tags:
BusinessUnit: sst_upgrades@leapp_upstream_test

- &sanity-abstract-9to10-aws
<<: *sanity-abstract-9to10
Expand Down Expand Up @@ -705,3 +732,79 @@ jobs:
env:
<<: *env-98to102

# ###################################################################### #
# ########################## CentOS Stream ############################# #
# ###################################################################### #

# ###################################################################### #
# ###################### CentOS Stream > RHEL ########################## #
# ###################################################################### #

# ###################################################################### #
# ############################ 9 > 10.1 ################################ #
# ###################################################################### #

- &sanity-centos9torhel101
<<: *sanity-abstract-9to10
trigger: pull_request
identifier: sanity-CentOS9toRHEL10.1
targets:
epel-9-x86_64:
distros: [CentOS-Stream-9]
tf_extra_params:
test:
tmt:
plan_filter: 'tag:9to10 & tag:tier0 & enabled:true & tag:-rhsm'
environments:
- *tmt-env-settings-centos9torhel101
env: &env-centos9to101
SOURCE_RELEASE: "9"
TARGET_RELEASE: "10.1"

# ###################################################################### #
# ############################ 9 > 10.2 ################################ #
# ###################################################################### #

- &sanity-centos9torhel102
<<: *sanity-abstract-9to10
trigger: pull_request
identifier: sanity-CentOS9toRHEL10.2
targets:
epel-9-x86_64:
distros: [CentOS-Stream-9]
tf_extra_params:
test:
tmt:
plan_filter: 'tag:9to10 & tag:tier0 & enabled:true & tag:-rhsm'
name:
environments:
- *tmt-env-settings-centos9torhel102
env: &env-centos9torhel102
SOURCE_RELEASE: "9"
TARGET_RELEASE: "10.2"

# ###################################################################### #
# ################## CentOS Stream > CentOS Stream ##################### #
# ###################################################################### #

# ###################################################################### #
# ############################## 9 > 10 ################################ #
# ###################################################################### #

- &sanity-centos-9to10
<<: *sanity-abstract-9to10
trigger: pull_request
identifier: sanity-CentOS9to10
targets:
epel-9-x86_64:
distros: [CentOS-Stream-9]
tf_extra_params:
test:
tmt:
plan_filter: 'tag:9to10 & tag:tier0 & enabled:true & tag:-rhsm'
environments:
- *tmt-env-settings-centos9to10
env: &env-centos9to10
SOURCE_RELEASE: "9"
TARGET_RELEASE: "10"
TARGET_OS: "centos"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from leapp.actors import Actor
from leapp.libraries.actor import swapdistropackages
from leapp.models import DistributionSignedRPM, RpmTransactionTasks
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag


class SwapDistroPackages(Actor):
"""
Swap distribution specific packages.

Does nothing if not converting.
"""

name = 'swap_distro_packages'
consumes = (DistributionSignedRPM,)
produces = (RpmTransactionTasks,)
tags = (IPUWorkflowTag, ChecksPhaseTag)

def process(self):
swapdistropackages.process()
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
from leapp.libraries.common.config import get_source_distro_id, get_target_distro_id
from leapp.libraries.common.config.version import get_target_major_version
from leapp.libraries.common.rpms import has_package
from leapp.libraries.stdlib import api
from leapp.models import DistributionSignedRPM, RpmTransactionTasks

_CONFIG = {
("centos", "rhel"): {
"swap": {
"centos-logos": "redhat-logos",
"centos-logos-httpd": "redhat-logos-httpd",
"centos-logos-ipa": "redhat-logos-ipa",
"centos-indexhtml": "redhat-indexhtml",
"centos-backgrounds": "redhat-backgrounds",
"centos-stream-release": "redhat-release",
},
"remove": {
"centos-gpg-keys",
"centos-stream-repos",
# various release packages, typically contain repofiles
"centos-release-automotive",
"centos-release-automotive-experimental",
"centos-release-autosd",
"centos-release-ceph-pacific",
"centos-release-ceph-quincy",
"centos-release-ceph-reef",
"centos-release-ceph-squid",
"centos-release-ceph-tentacle",
"centos-release-cloud",
"centos-release-gluster10",
"centos-release-gluster11",
"centos-release-gluster9",
"centos-release-hyperscale",
"centos-release-hyperscale-experimental",
"centos-release-hyperscale-experimental-testing",
"centos-release-hyperscale-spin",
"centos-release-hyperscale-spin-testing",
"centos-release-hyperscale-testing",
"centos-release-isa-override",
"centos-release-kmods",
"centos-release-kmods-kernel",
"centos-release-kmods-kernel-6",
"centos-release-messaging",
"centos-release-nfs-ganesha4",
"centos-release-nfs-ganesha5",
"centos-release-nfs-ganesha6",
"centos-release-nfs-ganesha7",
"centos-release-nfs-ganesha8",
"centos-release-nfv-common",
"centos-release-nfv-openvswitch",
"centos-release-okd-4",
"centos-release-openstack-antelope",
"centos-release-openstack-bobcat",
"centos-release-openstack-caracal",
"centos-release-openstack-dalmatian",
"centos-release-openstack-epoxy",
"centos-release-openstack-yoga",
"centos-release-openstack-zed",
"centos-release-openstackclient-xena",
"centos-release-opstools",
"centos-release-ovirt45",
"centos-release-ovirt45-testing",
"centos-release-proposed_updates",
"centos-release-rabbitmq-38",
"centos-release-samba414",
"centos-release-samba415",
"centos-release-samba416",
"centos-release-samba417",
"centos-release-samba418",
"centos-release-samba419",
"centos-release-samba420",
"centos-release-samba421",
"centos-release-samba422",
"centos-release-samba423",
"centos-release-storage-common",
"centos-release-virt-common",
# present on Centos (not Stream) 8, let's include them if they are potentially leftover
"centos-linux-release",
"centos-linux-repos",
"centos-obsolete-packages",
},
},
}


def _get_config(source_distro, target_distro, target_major):
key = (source_distro, target_distro, target_major)
config = _CONFIG.get(key)
if config:
return config

key = (source_distro, target_distro)
return _CONFIG.get(key)


def _make_transaction_tasks(config):
to_install = []
to_remove = []
for source_pkg, target_pkg in config.get("swap", {}).items():
if has_package(DistributionSignedRPM, source_pkg):
to_remove.append(source_pkg)
to_install.append(target_pkg)

for pkg in config.get("remove", {}):
# this has_package call isn't strictly necessary as the actor
# processing RpmTransactionTasks checks if the package is present, but
# keeping it for consistency with the above
if has_package(DistributionSignedRPM, pkg):
to_remove.append(pkg)

return RpmTransactionTasks(to_install=to_install, to_remove=to_remove)


def process():
source_distro = get_source_distro_id()
target_distro = get_target_distro_id()

if source_distro == target_distro:
return

config = _get_config(source_distro, target_distro, get_target_major_version())
if not config:
api.current_logger().warning(
"Could not find config for handling distro specific packages for {}->{} upgrade.".format(
source_distro, target_distro
)
)
return

task = _make_transaction_tasks(config)
api.produce(task)
Loading