Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b38f3d3
Resolve boot issues in hybrid azure during upgrades from RHEL 7 > 8 > 9.
dkubek Aug 20, 2024
42fc2f6
Restructure hybrid image detection
dkubek Aug 22, 2024
a411b45
Point to leapp-repository contribution guidelines
bocekm Jul 1, 2025
fa6b877
Read the DNF config by module.py library
karolinku Jul 3, 2025
ee93fa3
Disable localpkg_gpgcheck parameter from plugin data
karolinku Jul 7, 2025
f92f585
PR welcome msg: update link to contrib guidelines (#1399)
bocekm Jul 8, 2025
75b0500
Change IPU and supported versions
yuravk Jul 9, 2025
7c126b6
Fix: skip checking ownership of files in .../directory-hash/ dir
matejmatuska Jul 11, 2025
b7967c0
fixup! Fix: skip checking ownership of files in .../directory-hash/ dir
matejmatuska Jul 11, 2025
f9405de
Add test
matejmatuska Jul 11, 2025
e1c45d1
fixup! Add test
matejmatuska Jul 11, 2025
0f0225c
Add test for non-recursive
matejmatuska Jul 14, 2025
11ac4be
el8to9: actors: mysql: Add MySQL actor with recommendations (#1335)
SlouchyButton Jul 16, 2025
f261c8c
Fix target version format checks
matejmatuska Jul 2, 2025
01aec98
Drop el7toel8 leapp repository
tomasfratrik Jun 4, 2025
2a4642c
libs(rhui): add rhel10 targets for upgrades
Jun 15, 2025
81a19b9
userspacegen: do not repolist source & debug repos
Jun 15, 2025
0b887a3
actor(checkrhui): do not boostrap client on AWS 9>10
Jun 17, 2025
73e761c
add azure, aws, alibaba client repositories to repomapping
Jul 2, 2025
74a5d60
rhui(azure): add target client's GPG key to mandatory files
Jul 4, 2025
8249181
feat(alibaba): support rhel9 upgrade to rhel10 using rhui on alibaba …
Jun 16, 2025
f4c5a07
Inhibit upgrade on systems with cgroupsv1 on 9to10 (#1392)
matejmatuska Jul 17, 2025
22fddea
data: update PES data file (#1388)
leapp-bot Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/pr-welcome-msg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
body: |
## **Thank you for contributing to the Leapp project!**
Please note that every PR needs to comply with the [Leapp Guidelines](https://leapp.readthedocs.io/en/latest/contributing.html#) and must pass all tests in order to be mergeable.
Please note that every PR needs to comply with the [leapp-repository contribution and development guidelines](https://leapp-repository.readthedocs.io/latest/contrib-and-devel-guidelines.html) and must pass all tests in order to be mergeable.
If you want to request a review or rebuild a package in copr, you can use following commands as a comment:
- **`review please @oamg/developers`** to notify leapp developers of the review request
- **`/packit copr-build`** to submit a public copr build using packit
Expand All @@ -39,6 +39,6 @@ jobs:

See other labels for particular jobs defined in the `.packit.yaml` file.

Please [open ticket](https://url.corp.redhat.com/oamg-ci-issue) in case you experience technical problem with the CI. (RH internal only)
Please [open ticket](https://red.ht/rhel-upgrades-ci-issue) in case you experience technical problem with the CI. (RH internal only)

**Note:** In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
See the [Contribution guidelines](https://leapp.readthedocs.io/en/latest/contributing.html)
See the [contribution guidelines](https://leapp-repository.readthedocs.io/latest/contrib-and-devel-guidelines.html).
58 changes: 22 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL=/bin/bash

__PKGNAME=$${_PKGNAME:-leapp-repository}
VENVNAME ?= tut
DIST_VERSION ?= 7
DIST_VERSION ?= 8
PKGNAME=leapp-repository
DEPS_PKGNAME=leapp-el7toel8-deps
VERSION=`grep -m1 "^Version:" packaging/$(PKGNAME).spec | grep -om1 "[0-9].[0-9.]**"`
Expand All @@ -23,7 +23,7 @@ PYLINT_ARGS ?=
FLAKE8_ARGS ?=

# python version to run test with
_PYTHON_VENV=$${PYTHON_VENV:-python2.7}
_PYTHON_VENV=$${PYTHON_VENV:-python3.6}

ifdef ACTOR
TEST_PATHS=`$(_PYTHON_VENV) utils/actor_path.py $(ACTOR)`
Expand Down Expand Up @@ -55,9 +55,9 @@ _TEST_CONTAINER=$${TEST_CONTAINER:-rhel8}

# In case just specific CHROOTs should be used for the COPR build, you can
# set the multiple CHROOTs separated by comma in the COPR_CHROOT envar, e.g.
# "epel-7-x86_64,epel-8-x86_64". But for the copr-cli utility, each of them
# "epel-8-x86_64,epel-9-x86_64". But for the copr-cli utility, each of them
# has to be specified separately for the -r option; So we transform it
# automatically to "-r epel-7-x86_64 -r epel-8-x86_64" (without quotes).
# automatically to "-r epel-8-x86_64 -r epel-9-x86_64" (without quotes).
ifdef COPR_CHROOT
_COPR_CHROOT=`echo $${COPR_CHROOT} | grep -o "[^,]*" | sed "s/^/-r /g"`
endif
Expand Down Expand Up @@ -111,7 +111,7 @@ help:
@echo " packaging"
@echo " srpm create the SRPM"
@echo " build_container create the RPM in container"
@echo " - set BUILD_CONTAINER to el7, el8 or el9"
@echo " - set BUILD_CONTAINER to el8 or el9"
@echo " - don't run more than one build at the same time"
@echo " since containers operate on the same files!"
@echo " copr_build create the COPR build using the COPR TOKEN"
Expand Down Expand Up @@ -154,7 +154,7 @@ help:
@echo " COPR_CONFIG path to the COPR config with API token"
@echo " (default: ~/.config/copr_rh_oamg.conf)"
@echo " COPR_CHROOT specify the CHROOT which should be used for"
@echo " the build, e.g. 'epel-7-x86_64'. You can"
@echo " the build, e.g. 'epel-8-x86_64'. You can"
@echo " specify multiple CHROOTs separated by comma."
@echo ""
@echo "Possible use:"
Expand Down Expand Up @@ -189,7 +189,6 @@ source: prepare
@git archive --prefix "$(PKGNAME)-$(VERSION)/" -o "packaging/sources/$(PKGNAME)-$(VERSION).tar.gz" HEAD
@echo "--- PREPARE DEPS PKGS ---"
mkdir -p packaging/tmp/
@__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=7 _build_subpkg
@__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=8 _build_subpkg
@__TIMESTAMP=$(TIMESTAMP) $(MAKE) DIST_VERSION=9 _build_subpkg
@tar -czf packaging/sources/deps-pkgs.tar.gz -C packaging/RPMS/noarch `ls -1 packaging/RPMS/noarch | grep -o "[^/]*rpm$$"`
Expand Down Expand Up @@ -250,11 +249,8 @@ _build_local: source
@mv packaging/$(PKGNAME).spec.bak packaging/$(PKGNAME).spec

build_container:
echo "--- Build RPM ${PKGNAME}-${VERSION}-${RELEASE}.el$(DIST_VERSION).rpm in container ---"; \
echo "--- Build RPM ${PKGNAME}-${VERSION}-${RELEASE}.el$(DIST_VERSION).rpm in container ---";
case "$(BUILD_CONTAINER)" in \
el7) \
CONT_FILE="utils/container-builds/Containerfile.centos7"; \
;; \
el8) \
CONT_FILE="utils/container-builds/Containerfile.ubi8"; \
;; \
Expand All @@ -266,7 +262,7 @@ build_container:
exit 1; \
;; \
*) \
echo "Available containers are el7, el8, el9"; \
echo "Available containers are el8, el9"; \
exit 1; \
;; \
esac && \
Expand Down Expand Up @@ -375,13 +371,15 @@ lint_fix:
echo "--- isort inplace fixing done. ---;"

test_no_lint:
. $(VENVNAME)/bin/activate; \
@. $(VENVNAME)/bin/activate; \
snactor repo find --path repos/; \
cd repos/system_upgrade/el7toel8/; \
snactor workflow sanity-check ipu && \
cd - && \
for dir in repos/system_upgrade/*/; do \
echo "Running sanity-check in $$dir"; \
(cd $$dir && snactor workflow sanity-check ipu); \
done; \
$(_PYTHON_VENV) -m pytest $(REPORT_ARG) $(TEST_PATHS) $(LIBRARY_PATH) $(PYTEST_ARGS)


test: lint test_no_lint

# container images act like a cache so that dependencies can only be downloaded once
Expand All @@ -396,9 +394,6 @@ _build_container_image:
# tests one IPU, leapp repositories irrelevant to the tested IPU are deleted
_test_container_ipu:
@case $$TEST_CONT_IPU in \
el7toel8) \
export REPOSITORIES="common,el7toel8"; \
;; \
el8toel9) \
export REPOSITORIES="common,el8toel9"; \
;; \
Expand All @@ -409,7 +404,7 @@ _test_container_ipu:
echo "TEST_CONT_IPU must be set"; exit 1; \
;; \
*) \
echo "Only supported TEST_CONT_IPUs are el7toel8, el8toel9, el9toel10"; exit 1; \
echo "Only supported TEST_CONT_IPUs are el8toel9, el9toel10"; exit 1; \
;; \
esac && \
$(_CONTAINER_TOOL) exec -w /repocopy $$_CONT_NAME make clean && \
Expand All @@ -421,25 +416,20 @@ lint_container:
@_TEST_CONT_TARGET="lint" $(MAKE) test_container

lint_container_all:
@for container in "f34" "rhel7" "rhel8"; do \
@for container in "f34" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) lint_container || exit 1; \
done

# Runs tests in a container
# Builds testing image first if it doesn't exist
# On some Python versions, we need to test both IPUs,
# because e.g. RHEL7 to RHEL8 IPU must work on python2.7 and python3.6
# and RHEL8 to RHEL9 IPU must work on python3.6 and python3.9.
# because e.g RHEL8 to RHEL9 IPU must work on python3.6 and python3.9.
test_container:
@case $(_TEST_CONTAINER) in \
f34) \
export CONT_FILE="utils/container-tests/Containerfile.f34"; \
export _VENV="python3.9"; \
;; \
rhel7) \
export CONT_FILE="utils/container-tests/Containerfile.rhel7"; \
export _VENV="python2.7"; \
;; \
rhel8) \
export CONT_FILE="utils/container-tests/Containerfile.rhel8"; \
export _VENV="python3.6"; \
Expand All @@ -449,7 +439,7 @@ test_container:
export _VENV="python3.9"; \
;; \
*) \
echo "Error: Available containers are: f34, rhel7, rhel8"; exit 1; \
echo "Error: Available containers are: f34, rhel8, rhel9"; exit 1; \
;; \
esac; \
export TEST_IMAGE="leapp-repo-tests-$(_TEST_CONTAINER)"; \
Expand All @@ -461,11 +451,7 @@ test_container:
$(_CONTAINER_TOOL) exec $$_CONT_NAME rsync -aur --delete --exclude "tut*" /repo/ /repocopy && \
export res=0; \
case $$_VENV in \
python2.7) \
TEST_CONT_IPU=el7toel8 $(MAKE) _test_container_ipu || res=1; \
;;\
python3.6) \
echo "INFO: Skipping testing of el7toel8 repository. Obsoleted"; \
TEST_CONT_IPU=el8toel9 $(MAKE) _test_container_ipu || res=1; \
;; \
python3.9) \
Expand All @@ -485,22 +471,22 @@ test_container:
exit $$res

test_container_all:
@for container in "f34" "rhel7" "rhel8" "rhel9"; do \
@for container in "f34" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) test_container || exit 1; \
done

test_container_no_lint:
@_TEST_CONT_TARGET="test_no_lint" $(MAKE) test_container

test_container_all_no_lint:
@for container in "f34" "rhel7" "rhel8" "rhel9"; do \
@for container in "f34" "rhel8" "rhel9"; do \
TEST_CONTAINER=$$container $(MAKE) test_container_no_lint || exit 1; \
done

# clean all testing and building containers and their images
clean_containers:
@for i in "leapp-repo-tests-f34" "leapp-repo-tests-rhel7" "leapp-repo-tests-rhel8" \
"leapp-repo-tests-rhel9" "leapp-repo-build-el7" "leapp-repo-build-el8"; do \
@for i in "leapp-repo-tests-f34" "leapp-repo-tests-rhel8" \
"leapp-repo-tests-rhel9" "leapp-repo-build-el8"; do \
$(_CONTAINER_TOOL) kill "$$i-cont" || :; \
$(_CONTAINER_TOOL) rm "$$i-cont" || :; \
$(_CONTAINER_TOOL) rmi "$$i" || :; \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Before doing anything, please read the upstream [documentation](https://leapp-repository.readthedocs.io/).**
**Before doing anything, please read the [leapp-repository documentation](https://leapp-repository.readthedocs.io/).**

Also, you could find useufl to read [Leapp framework documentation](https://leapp.readthedocs.io/).
Also, you could find the [Leapp framework documentation](https://leapp.readthedocs.io/) useful to read.

---

Expand All @@ -17,7 +17,7 @@ Also, you could find useufl to read [Leapp framework documentation](https://leap
- *All files in /var/log/leapp*
- */var/lib/leapp/leapp.db*
- *journalctl*
- If you want, you can optionally send anything else would you like to provide (e.g. storage info)
- If you want, you can optionally send any other relevant information (e.g. storage, network)

**For your convenience you can pack all logs with this command:**

Expand Down
28 changes: 18 additions & 10 deletions commands/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def assert_version_format(version_str, desired_format, version_kind):
:raises: CommandError
"""
if not re.match(desired_format.regex, version_str):
error_str = 'Unexpected format of target version: {0}. The required format is \'{1}\'.'
error_str = (
'Unexpected format of target version: {0}. The required format is \'{1}\'.'
)
raise CommandError(error_str.format(version_str, desired_format.human_readable))


Expand Down Expand Up @@ -182,26 +184,32 @@ def get_target_version(flavour):
return target_versions[-1] if target_versions else None


def vet_upgrade_path(args):
def get_target_release(args):
"""
Make sure the user requested upgrade_path is a supported one.
If LEAPP_DEVEL_TARGET_RELEASE is set then it's value is not vetted against upgrade_paths_map but used as is.
Return the user selected target release or choose one from config.

A target release can be specified, ordered by priority, by the
LEAPP_DEVEL_TARGET_RELEASE or args.target (--target cmdline arg) or in the
config file.

NOTE: when specified via the env var or cmdline arg, the version isn't
checked against supported versions, this is done later by an actor in the
upgrade process.

:return: `tuple` (target_release, flavor)
"""
flavor = get_upgrade_flavour()
env_version_override = os.getenv('LEAPP_DEVEL_TARGET_RELEASE')

if env_version_override:
target_ver = env_version_override or args.target
if target_ver:
os_release_contents = _retrieve_os_release_contents()
distro_id = os_release_contents.get('ID', '')
expected_version_format = _DISTRO_VERSION_FORMATS.get(distro_id, VersionFormats.MAJOR_MINOR).value
assert_version_format(env_version_override, expected_version_format, _VersionKind.TARGET)

return (env_version_override, flavor)
assert_version_format(target_ver, expected_version_format, _VersionKind.TARGET)
return (target_ver, flavor)

target_release = args.target or get_target_version(flavor)
return (target_release, flavor)
return (get_target_version(flavor), flavor)


def set_resource_limits():
Expand Down
54 changes: 37 additions & 17 deletions commands/tests/test_upgrade_paths.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import resource

import mock
Expand Down Expand Up @@ -29,34 +30,53 @@ def test_get_target_version(mock_open, monkeypatch):
assert command_utils.get_target_version('default') == '9.0'


@mock.patch("leapp.cli.commands.command_utils.get_upgrade_paths_config",
return_value={"default": {"7.9": ["8.4"], "8.6": ["9.0"], "7": ["8.4"], "8": ["9.0"]}})
def test_vet_upgrade_path(mock_open, monkeypatch):
@mock.patch(
"leapp.cli.commands.command_utils.get_upgrade_paths_config",
return_value={
"default": {
"7.9": ["8.4"],
"8.6": ["9.0", "9.2"],
"7": ["8.4"],
"8": ["9.0", "9.2"],
}
},
)
def test_get_target_release(mock_open, monkeypatch): # do not remove mock_open
monkeypatch.setattr(command_utils, 'get_os_release_version_id', lambda x: '8.6')

# make sure env var LEAPP_DEVEL_TARGET_RELEASE takes precedence
# when env var set to a bad version - abort the upgrade
args = mock.Mock(target='9.0')
monkeypatch.setenv('LEAPP_DEVEL_TARGET_RELEASE', '1.2badsemver')
with pytest.raises(CommandError) as err:
command_utils.vet_upgrade_path(args)
assert 'Unexpected format of target version' in err
# MAJOR.MINOR.PATCH is considered as bad version, only MAJOR.MINOR is accepted
args = mock.Mock(target='9.0')
monkeypatch.setenv('LEAPP_DEVEL_TARGET_RELEASE', '9.2')
print(os.getenv('LEAPP_DEVEL_TARGET_RELEASE'))
assert command_utils.get_target_release(args) == ('9.2', 'default')

# when env var set to a bad version, expect an error
monkeypatch.setenv('LEAPP_DEVEL_TARGET_RELEASE', '9.0.0')
with pytest.raises(CommandError) as err:
command_utils.vet_upgrade_path(args)
command_utils.get_target_release(args)
assert 'Unexpected format of target version' in err

# when env var set to a version not in upgrade_paths map - go on and use it
# this is checked by an actor in the IPU
monkeypatch.setenv('LEAPP_DEVEL_TARGET_RELEASE', '1.2')
assert command_utils.vet_upgrade_path(args) == ('1.2', 'default')
# no env var set, --target is set to proper version
assert command_utils.get_target_release(args) == ('1.2', 'default')

# no env var set, --target is set to proper version - use it
args = mock.Mock(target='9.0')
monkeypatch.delenv('LEAPP_DEVEL_TARGET_RELEASE', raising=False)
assert command_utils.vet_upgrade_path(args) == ('9.0', 'default')
# env var is set to proper version, --target is set to a bad one - use env var and go on with the upgrade
assert command_utils.get_target_release(args) == ('9.0', 'default')

# --target set with incorrectly formatted version, env var not set, fail
args = mock.Mock(target='9.0a')
with pytest.raises(CommandError) as err:
command_utils.get_target_release(args)
assert 'Unexpected format of target version' in err

# env var is set to proper version, --target set to a bad one:
# env var has priority, use it and go on with the upgrade
monkeypatch.setenv('LEAPP_DEVEL_TARGET_RELEASE', '9.0')
args = mock.Mock(target='1.2')
assert command_utils.vet_upgrade_path(args) == ('9.0', 'default')
args = mock.Mock(target='9.0.0')
assert command_utils.get_target_release(args) == ('9.0', 'default')


def _mock_getrlimit_factory(nofile_limits=(1024, 4096), fsize_limits=(1024, 4096)):
Expand Down
4 changes: 2 additions & 2 deletions commands/upgrade/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def prepare_configuration(args):
if args.nogpgcheck:
os.environ['LEAPP_NOGPGCHECK'] = '1'

# Check upgrade path and fail early if it's unsupported
target_version, flavor = command_utils.vet_upgrade_path(args)
# Check upgrade path and fail early if it's invalid
target_version, flavor = command_utils.get_target_release(args)
os.environ['LEAPP_UPGRADE_PATH_TARGET_RELEASE'] = target_version
os.environ['LEAPP_UPGRADE_PATH_FLAVOUR'] = flavor

Expand Down
3 changes: 1 addition & 2 deletions docs/source/contrib-and-devel-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contribution and development guidelines
## Code guidelines

Your code should follow the [Python Coding Guidelines](https://leapp.readthedocs.io/en/latest/python-coding-guidelines.html) used for the leapp project. On top of these rules follow instructions
Your code should follow the [Python Coding Guidelines](https://leapp.readthedocs.io/en/latest/contributing.html#follow-python-coding-guidelines) used for the leapp project. On top of these rules follow instructions
below.

### Retrieving information about the source system should be separated from its use
Expand Down Expand Up @@ -51,7 +51,6 @@ can be used.
Here is the list of repositories in this project with the Python compatibility
requirements:
* `system_upgrade/common` - 3.6, 3.9, 3.12 (_you can start to ignore Python 2.7_)
* _`system_upgrade/el7toel8` - 2.7, 3.6 (deprecated)_
* `system_upgrade/el8toel9` - 3.6, 3.9
* `system_upgrade/el9toel10` - 3.9, 3.12

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation-and-building.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To build the RPM e.g. for RHEL 8 systems, execute:
```bash
$ BUILD_CONTAINER=el8 make container_build
```
Possible values for BUILD_CONTAINER are `el7`,`el8`, `el9`.
Possible values for BUILD_CONTAINER are `el8`, `el9`.

The built packages can be found under the `packaging/RPMS/` directory.

Expand Down
Loading