From 7ca25b5a52338bbd55824798e4e6753f588c5543 Mon Sep 17 00:00:00 2001 From: Yuriy Kohut Date: Thu, 22 Aug 2024 12:39:07 +0300 Subject: [PATCH] Implement ELevate vendors support Package version: 0.21.0-2.elevate.1 --- SOURCES/leapp-repository-0.21.0-elevate.patch | 5474 +++++++++++++++++ SPECS/leapp-repository.spec | 12 +- 2 files changed, 5483 insertions(+), 3 deletions(-) create mode 100644 SOURCES/leapp-repository-0.21.0-elevate.patch diff --git a/SOURCES/leapp-repository-0.21.0-elevate.patch b/SOURCES/leapp-repository-0.21.0-elevate.patch new file mode 100644 index 0000000..c9369d4 --- /dev/null +++ b/SOURCES/leapp-repository-0.21.0-elevate.patch @@ -0,0 +1,5474 @@ +diff --git a/.gitignore b/.gitignore +index 0bb92d3d..a04c7ded 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -115,6 +115,7 @@ ENV/ + + # visual studio code configuration + .vscode ++*.code-workspace + + # pycharm + .idea +diff --git a/ci/.gitignore b/ci/.gitignore +new file mode 100644 +index 00000000..e6f97f0f +--- /dev/null ++++ b/ci/.gitignore +@@ -0,0 +1 @@ ++**/.vagrant +diff --git a/ci/ansible/ansible.cfg b/ci/ansible/ansible.cfg +new file mode 100644 +index 00000000..d5c13036 +--- /dev/null ++++ b/ci/ansible/ansible.cfg +@@ -0,0 +1,4 @@ ++[defaults] ++callbacks_enabled=ansible.posix.profile_tasks ++stdout_callback=community.general.yaml ++pipelining=True +diff --git a/ci/ansible/docker-ce.yaml b/ci/ansible/docker-ce.yaml +new file mode 100644 +index 00000000..bba5f3df +--- /dev/null ++++ b/ci/ansible/docker-ce.yaml +@@ -0,0 +1,6 @@ ++--- ++- name: Docker CE configuration ++ hosts: all ++ become: yes ++ roles: ++ - docker-ce +diff --git a/ci/ansible/minimal.yaml b/ci/ansible/minimal.yaml +new file mode 100644 +index 00000000..517cc81b +--- /dev/null ++++ b/ci/ansible/minimal.yaml +@@ -0,0 +1,6 @@ ++--- ++- name: Minimal configuration ++ hosts: all ++ become: yes ++ roles: ++ - minimal +diff --git a/ci/ansible/requirements.yaml b/ci/ansible/requirements.yaml +new file mode 100644 +index 00000000..13ca0224 +--- /dev/null ++++ b/ci/ansible/requirements.yaml +@@ -0,0 +1,3 @@ ++collections: ++ - name: community.general ++ - name: ansible.posix +diff --git a/ci/ansible/roles/docker-ce/README.md b/ci/ansible/roles/docker-ce/README.md +new file mode 100644 +index 00000000..860444b1 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/README.md +@@ -0,0 +1,43 @@ ++Docker CE Install and configuration ++========= ++ ++Install latest version of Docker CE Engine form upstream repository. Start and enable services after installation. ++ ++Requirements ++------------ ++ ++Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. ++ ++Role Variables ++-------------- ++ ++`docker_ce_repo_checksum` in defaults/main.yaml. SHA512 Checksum of the docker-ce.repo file. ++A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. ++ ++Dependencies ++------------ ++ ++A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. ++ ++Example Playbook ++---------------- ++ ++Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: ++ ++ - hosts: all ++ become: yes ++ roles: ++ - role: docker ++ vars: ++ docker_ce_repo_checksum: sha512:XXXX # You can provide the new checksum if the default one not actual ++ ++ ++License ++------- ++ ++GPL-3.0-or-later ++ ++Author Information ++------------------ ++ ++AlmaLinux OS Foundation +diff --git a/ci/ansible/roles/docker-ce/defaults/main.yaml b/ci/ansible/roles/docker-ce/defaults/main.yaml +new file mode 100644 +index 00000000..d0fd0c09 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/defaults/main.yaml +@@ -0,0 +1,3 @@ ++--- ++# defaults file for docker-ce ++docker_ce_repo_checksum: sha512:1de0b99cbb427e974144f226451711dc491caef6b1256cb599ff307a687ba2d7dd959a016d4e4cfdd4acbd83423ba1f78fa89db61bab35351e35f1152aedaf5c +diff --git a/ci/ansible/roles/docker-ce/handlers/main.yaml b/ci/ansible/roles/docker-ce/handlers/main.yaml +new file mode 100644 +index 00000000..a7236219 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/handlers/main.yaml +@@ -0,0 +1,2 @@ ++--- ++# handlers file for docker-ce +diff --git a/ci/ansible/roles/docker-ce/meta/main.yaml b/ci/ansible/roles/docker-ce/meta/main.yaml +new file mode 100644 +index 00000000..aa67ded8 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/meta/main.yaml +@@ -0,0 +1,25 @@ ++galaxy_info: ++ author: AlmaLinux OS Community ++ description: Install and configure Docker CE Engine ++ company: AlmaLinux OS Foundation ++ ++ license: GPL-3.0-or-later ++ ++ min_ansible_version: 2.11 ++ ++ platforms: ++ - name: EL ++ versions: ++ - 7 ++ - 8 ++ - 9 ++ ++ galaxy_tags: ++ - docker ++ - el7 ++ - el8 ++ - el9 ++ - almalinux ++ ++dependencies: ++ - minimal +diff --git a/ci/ansible/roles/docker-ce/tasks/install_docker_el7.yaml b/ci/ansible/roles/docker-ce/tasks/install_docker_el7.yaml +new file mode 100644 +index 00000000..320477af +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tasks/install_docker_el7.yaml +@@ -0,0 +1,11 @@ ++--- ++# Install Docker ++- name: Install Docker CE Stable ++ ansible.builtin.yum: ++ name: ++ - docker-ce ++ - docker-ce-cli ++ - containerd.io ++ - docker-compose-plugin ++ update_cache: yes ++ state: present +diff --git a/ci/ansible/roles/docker-ce/tasks/install_docker_el8.yaml b/ci/ansible/roles/docker-ce/tasks/install_docker_el8.yaml +new file mode 100644 +index 00000000..d44a202a +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tasks/install_docker_el8.yaml +@@ -0,0 +1,11 @@ ++--- ++# Install Docker ++- name: Install Docker CE Stable ++ ansible.builtin.dnf: ++ name: ++ - docker-ce ++ - docker-ce-cli ++ - containerd.io ++ - docker-compose-plugin ++ update_cache: yes ++ state: present +diff --git a/ci/ansible/roles/docker-ce/tasks/main.yaml b/ci/ansible/roles/docker-ce/tasks/main.yaml +new file mode 100644 +index 00000000..989af23f +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tasks/main.yaml +@@ -0,0 +1,38 @@ ++--- ++# tasks file for docker-ce ++- name: Add Docker CE repository ++ ansible.builtin.get_url: ++ url: https://download.docker.com/linux/centos/docker-ce.repo ++ dest: /etc/yum.repos.d/docker-ce.repo ++ checksum: "{{ docker_ce_repo_checksum }}" ++ owner: root ++ group: root ++ mode: '0644' ++ seuser: system_u ++ serole: object_r ++ setype: system_conf_t ++ ++- name: Remove older versions of Docker on EL7 ++ ansible.builtin.include_tasks: remove_old_docker_el7.yaml ++ when: ansible_facts['distribution_major_version'] == '7' ++ ++- name: Remove older versions of Docker on >= EL8 ++ ansible.builtin.include_tasks: remove_old_docker_el8.yaml ++ when: ansible_facts['distribution_major_version'] == '8' ++ ++- name: Install Docker CE Stable on EL7 ++ ansible.builtin.include_tasks: install_docker_el7.yaml ++ when: ansible_facts['distribution_major_version'] == '7' ++ ++- name: Install Docker CE Stable on >= EL8 ++ ansible.builtin.include_tasks: install_docker_el8.yaml ++ when: ansible_facts['distribution_major_version'] == '8' ++ ++- name: Start and Enable Docker services ++ ansible.builtin.systemd: ++ name: "{{ item }}" ++ enabled: yes ++ state: started ++ loop: ++ - docker.service ++ - containerd.service +diff --git a/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el7.yaml b/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el7.yaml +new file mode 100644 +index 00000000..db9e0960 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el7.yaml +@@ -0,0 +1,15 @@ ++--- ++# Remove older versions of Docker ++- name: Uninstall older versions of Docker ++ ansible.builtin.yum: ++ name: ++ - docker ++ - docker-client ++ - docker-client-latest ++ - docker-common ++ - docker-latest ++ - docker-latest-logrotate ++ - docker-logrotate ++ - docker-engine ++ autoremove: yes ++ state: absent +diff --git a/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el8.yaml b/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el8.yaml +new file mode 100644 +index 00000000..88f860cf +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tasks/remove_old_docker_el8.yaml +@@ -0,0 +1,15 @@ ++--- ++# Remove older versions of Docker ++- name: Uninstall older versions of Docker ++ ansible.builtin.dnf: ++ name: ++ - docker ++ - docker-client ++ - docker-client-latest ++ - docker-common ++ - docker-latest ++ - docker-latest-logrotate ++ - docker-logrotate ++ - docker-engine ++ autoremove: yes ++ state: absent +diff --git a/ci/ansible/roles/docker-ce/tests/inventory b/ci/ansible/roles/docker-ce/tests/inventory +new file mode 100644 +index 00000000..878877b0 +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tests/inventory +@@ -0,0 +1,2 @@ ++localhost ++ +diff --git a/ci/ansible/roles/docker-ce/tests/test.yaml b/ci/ansible/roles/docker-ce/tests/test.yaml +new file mode 100644 +index 00000000..789ba96e +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/tests/test.yaml +@@ -0,0 +1,5 @@ ++--- ++- hosts: localhost ++ remote_user: root ++ roles: ++ - docker-ce +diff --git a/ci/ansible/roles/docker-ce/vars/main.yaml b/ci/ansible/roles/docker-ce/vars/main.yaml +new file mode 100644 +index 00000000..7ff8a18f +--- /dev/null ++++ b/ci/ansible/roles/docker-ce/vars/main.yaml +@@ -0,0 +1,2 @@ ++--- ++# vars file for docker-ce +diff --git a/ci/ansible/roles/minimal/README.md b/ci/ansible/roles/minimal/README.md +new file mode 100644 +index 00000000..225dd44b +--- /dev/null ++++ b/ci/ansible/roles/minimal/README.md +@@ -0,0 +1,38 @@ ++Role Name ++========= ++ ++A brief description of the role goes here. ++ ++Requirements ++------------ ++ ++Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. ++ ++Role Variables ++-------------- ++ ++A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. ++ ++Dependencies ++------------ ++ ++A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. ++ ++Example Playbook ++---------------- ++ ++Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: ++ ++ - hosts: servers ++ roles: ++ - { role: username.rolename, x: 42 } ++ ++License ++------- ++ ++BSD ++ ++Author Information ++------------------ ++ ++An optional section for the role authors to include contact information, or a website (HTML is not allowed). +diff --git a/ci/ansible/roles/minimal/defaults/main.yaml b/ci/ansible/roles/minimal/defaults/main.yaml +new file mode 100644 +index 00000000..4a5a46cd +--- /dev/null ++++ b/ci/ansible/roles/minimal/defaults/main.yaml +@@ -0,0 +1,2 @@ ++--- ++# defaults file for minimal +diff --git a/ci/ansible/roles/minimal/handlers/main.yaml b/ci/ansible/roles/minimal/handlers/main.yaml +new file mode 100644 +index 00000000..89105fec +--- /dev/null ++++ b/ci/ansible/roles/minimal/handlers/main.yaml +@@ -0,0 +1,2 @@ ++--- ++# handlers file for minimal +diff --git a/ci/ansible/roles/minimal/meta/main.yaml b/ci/ansible/roles/minimal/meta/main.yaml +new file mode 100644 +index 00000000..ecc81ab7 +--- /dev/null ++++ b/ci/ansible/roles/minimal/meta/main.yaml +@@ -0,0 +1,23 @@ ++galaxy_info: ++ author: AlmaLinux OS Community ++ description: Minimal configuration for ELevate ++ company: AlmaLinux OS Foundation ++ ++ license: GPL-3.0-or-later ++ ++ min_ansible_version: 2.11 ++ ++ platforms: ++ - name: EL ++ versions: ++ - 7 ++ - 8 ++ - 9 ++ ++ galaxy_tags: ++ - elevate ++ - upgrade ++ - cleanup ++ - el7 ++ - el8 ++ - el9 +diff --git a/ci/ansible/roles/minimal/tasks/cleanup_el7.yaml b/ci/ansible/roles/minimal/tasks/cleanup_el7.yaml +new file mode 100644 +index 00000000..1b4af7c6 +--- /dev/null ++++ b/ci/ansible/roles/minimal/tasks/cleanup_el7.yaml +@@ -0,0 +1,10 @@ ++--- ++# Remove old kernels ++- name: Install the yum-utils ++ ansible.builtin.yum: ++ name: yum-utils ++ state: present ++ update_cache: yes ++ ++- name: Remove the old kernels on EL7 ++ ansible.builtin.command: package-cleanup -y --oldkernels --count=1 +diff --git a/ci/ansible/roles/minimal/tasks/cleanup_el8.yaml b/ci/ansible/roles/minimal/tasks/cleanup_el8.yaml +new file mode 100644 +index 00000000..56aeefd3 +--- /dev/null ++++ b/ci/ansible/roles/minimal/tasks/cleanup_el8.yaml +@@ -0,0 +1,7 @@ ++--- ++# Remove old kernels ++- name: Remove old kernels on EL8 ++ ansible.builtin.command: dnf -y remove --oldinstallonly ++ register: removeoldkernels ++ changed_when: removeoldkernels.rc == 0 ++ failed_when: removeoldkernels.rc > 1 +diff --git a/ci/ansible/roles/minimal/tasks/main.yaml b/ci/ansible/roles/minimal/tasks/main.yaml +new file mode 100644 +index 00000000..8c1b35bd +--- /dev/null ++++ b/ci/ansible/roles/minimal/tasks/main.yaml +@@ -0,0 +1,21 @@ ++--- ++# tasks file for minimal ++- name: Upgrade the packages on EL7 ++ ansible.builtin.include_tasks: upgrade_el7.yaml ++ when: ansible_facts['distribution_major_version'] == '7' ++ ++- name: Upgrade the packages on EL8 ++ ansible.builtin.include_tasks: upgrade_el8.yaml ++ when: ansible_facts['distribution_major_version'] == '8' ++ ++- name: Reboot the system ++ ansible.builtin.reboot: ++ when: upgrade_status is changed ++ ++- name: Cleanup the older kernels on EL7 ++ ansible.builtin.include_tasks: cleanup_el7.yaml ++ when: ansible_facts['distribution_major_version'] == '7' ++ ++- name: Cleanup the older kernels on El8 ++ ansible.builtin.include_tasks: cleanup_el8.yaml ++ when: ansible_facts['distribution_major_version'] == '8' +diff --git a/ci/ansible/roles/minimal/tasks/upgrade_el7.yaml b/ci/ansible/roles/minimal/tasks/upgrade_el7.yaml +new file mode 100644 +index 00000000..7648a586 +--- /dev/null ++++ b/ci/ansible/roles/minimal/tasks/upgrade_el7.yaml +@@ -0,0 +1,8 @@ ++--- ++# Upgrade the system ++- name: Upgrade the system ++ ansible.builtin.yum: ++ name: "*" ++ state: latest ++ update_cache: yes ++ register: upgrade_status +diff --git a/ci/ansible/roles/minimal/tasks/upgrade_el8.yaml b/ci/ansible/roles/minimal/tasks/upgrade_el8.yaml +new file mode 100644 +index 00000000..0d4a5d2a +--- /dev/null ++++ b/ci/ansible/roles/minimal/tasks/upgrade_el8.yaml +@@ -0,0 +1,8 @@ ++--- ++# Upgrade the system ++- name: Upgrade the system ++ ansible.builtin.dnf: ++ name: "*" ++ state: latest ++ update_cache: yes ++ register: upgrade_status +diff --git a/ci/ansible/roles/minimal/tests/inventory b/ci/ansible/roles/minimal/tests/inventory +new file mode 100644 +index 00000000..878877b0 +--- /dev/null ++++ b/ci/ansible/roles/minimal/tests/inventory +@@ -0,0 +1,2 @@ ++localhost ++ +diff --git a/ci/ansible/roles/minimal/tests/test.yaml b/ci/ansible/roles/minimal/tests/test.yaml +new file mode 100644 +index 00000000..db5c4c17 +--- /dev/null ++++ b/ci/ansible/roles/minimal/tests/test.yaml +@@ -0,0 +1,5 @@ ++--- ++- hosts: localhost ++ remote_user: root ++ roles: ++ - minimal +diff --git a/ci/ansible/roles/minimal/vars/main.yaml b/ci/ansible/roles/minimal/vars/main.yaml +new file mode 100644 +index 00000000..b24df080 +--- /dev/null ++++ b/ci/ansible/roles/minimal/vars/main.yaml +@@ -0,0 +1,2 @@ ++--- ++# vars file for minimal +diff --git a/ci/jenkins/ELevate_el7toel8_Development.jenkinsfile b/ci/jenkins/ELevate_el7toel8_Development.jenkinsfile +new file mode 100644 +index 00000000..f60a74df +--- /dev/null ++++ b/ci/jenkins/ELevate_el7toel8_Development.jenkinsfile +@@ -0,0 +1,258 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'LEAPP_SRC_GIT_USER', defaultValue: 'AlmaLinux', description: 'Input name of Git user of LEAPP source', trim: true) ++ string(name: 'LEAPP_SRC_GIT_BRANCH', defaultValue: 'almalinux', description: 'Input name of Git branch of LEAPP source', trim: true) ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ sh script: 'git clone https://github.com/AlmaLinux/leapp-data.git --branch devel', ++ label: 'Fetch devel version of leapp data' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el7toel8_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum-config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"", ++ label: 'Add testing repo of ELevate' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y leapp-upgrade\"", ++ label: 'Install testing version of ELevate' ++ sh script: "vagrant upload ci/scripts/install_elevate_dev.sh install_elevate_dev.sh $targetDistro.vmName", ++ label: 'Upload installer script to VMs' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo bash install_elevate_dev.sh -u ${LEAPP_SRC_GIT_USER} -b ${LEAPP_SRC_GIT_BRANCH}\"", ++ label: 'Install development version of ELevate', ++ returnStatus: true ++ sh script: "vagrant upload leapp-data/ leapp-data/ --compress $targetDistro.vmName", ++ label: 'Upload devel branch of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mkdir -p /etc/leapp/files/vendors.d\"", ++ label: 'Create directory structrue of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo install -t /etc/leapp/files leapp-data/files/${targetDistro.leappData}/*\"", ++ label: 'Install devel version of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo install -t /etc/leapp/files/vendors.d leapp-data/vendors.d/*\"", ++ label: 'Install devel version of leapp vendor data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mv -f /etc/leapp/files/leapp_upgrade_repositories.repo.el8 /etc/leapp/files/leapp_upgrade_repositories.repo\"", ++ label: 'Configure leapp upgrade repositories for EL7toEL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mv -f /etc/leapp/files/repomap.json.el8 /etc/leapp/files/repomap.json\"", ++ label: 'Configure leapp repository mapping for EL7toEL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum -y install tree && sudo tree -ha /etc/leapp\"", ++ label: 'Check if development version of leapp data installed correctly' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start pre-upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"", ++ label: 'Permit ssh as root login' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"", ++ label: 'Answer the leapp question' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-8': ++ vm = 'almalinux_8' ++ ldata = 'almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'centos-stream-8': ++ vm = 'centosstream_8' ++ ldata = 'centos' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-8': ++ vm = 'eurolinux_8' ++ ldata = 'eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'oraclelinux-8': ++ vm = 'oraclelinux_8' ++ ldata = 'oraclelinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-8': ++ vm = 'rocky_8' ++ ldata = 'rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el7toel8_Internal.jenkinsfile b/ci/jenkins/ELevate_el7toel8_Internal.jenkinsfile +new file mode 100644 +index 00000000..0f5ab44d +--- /dev/null ++++ b/ci/jenkins/ELevate_el7toel8_Internal.jenkinsfile +@@ -0,0 +1,239 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el7toel8_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y https://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm\"", ++ label: 'Install the elevate-release-latest rpm packages for EL7' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"wget https://build.almalinux.org/pulp/content/copr/eabdullin1-leapp-data-internal-almalinux-8-x86_64-dr/config.repo -O /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Add pulp repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y leapp-upgrade\"", ++ label: 'Install the leap rpm package' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y $targetDistro.leappData\"", ++ label: 'Install the LEAP migration data rpm packages' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"", ++ label: 'Permit ssh as root login' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"", ++ label: 'Answer the LEAP question' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-8': ++ vm = 'almalinux_8' ++ ldata = 'leapp-data-almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'centos-stream-8': ++ vm = 'centosstream_8' ++ ldata = 'leapp-data-centos' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-8': ++ vm = 'eurolinux_8' ++ ldata = 'leapp-data-eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'oraclelinux-8': ++ vm = 'oraclelinux_8' ++ ldata = 'leapp-data-oraclelinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-8': ++ vm = 'rocky_8' ++ ldata = 'leapp-data-rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el7toel8_Internal_Dev.jenkinsfile b/ci/jenkins/ELevate_el7toel8_Internal_Dev.jenkinsfile +new file mode 100644 +index 00000000..168ace8a +--- /dev/null ++++ b/ci/jenkins/ELevate_el7toel8_Internal_Dev.jenkinsfile +@@ -0,0 +1,262 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'LEAPP_SRC_GIT_USER', defaultValue: 'AlmaLinux', description: 'Input name of Git user of LEAPP source', trim: true) ++ string(name: 'LEAPP_SRC_GIT_BRANCH', defaultValue: 'almalinux', description: 'Input name of Git branch of LEAPP source', trim: true) ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ sh script: 'git clone https://github.com/AlmaLinux/leapp-data.git --branch devel', ++ label: 'Fetch devel version of leapp data' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el7toel8_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum-config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"", ++ label: 'Add testing repo of ELevate' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo wget https://build.almalinux.org/pulp/content/copr/eabdullin1-leapp-data-internal-centos7-x86_64-dr/config.repo -O /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Add pulp repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo sed -i 's|enabled=1|enabled=1\\npriority=80|' /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Set priority for pulp repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y leapp-upgrade\"", ++ label: 'Install testing version of ELevate' ++ sh script: "vagrant upload ci/scripts/install_elevate_dev.sh install_elevate_dev.sh $targetDistro.vmName", ++ label: 'Upload installer script to VMs' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo bash install_elevate_dev.sh -u ${LEAPP_SRC_GIT_USER} -b ${LEAPP_SRC_GIT_BRANCH}\"", ++ label: 'Install development version of ELevate', ++ returnStatus: true ++ sh script: "vagrant upload leapp-data/ leapp-data/ --compress $targetDistro.vmName", ++ label: 'Upload devel branch of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mkdir -p /etc/leapp/files/vendors.d\"", ++ label: 'Create directory structrue of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo install -t /etc/leapp/files leapp-data/files/${targetDistro.leappData}/*\"", ++ label: 'Install devel version of leapp data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo install -t /etc/leapp/files/vendors.d leapp-data/vendors.d/*\"", ++ label: 'Install devel version of leapp vendor data' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mv -f /etc/leapp/files/leapp_upgrade_repositories.repo.el8 /etc/leapp/files/leapp_upgrade_repositories.repo\"", ++ label: 'Configure leapp upgrade repositories for EL7toEL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo mv -f /etc/leapp/files/repomap.json.el8 /etc/leapp/files/repomap.json\"", ++ label: 'Configure leapp repository mapping for EL7toEL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum -y install tree && sudo tree -ha /etc/leapp\"", ++ label: 'Check if development version of leapp data installed correctly' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start pre-upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"", ++ label: 'Permit ssh as root login' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"", ++ label: 'Answer the leapp question' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-8': ++ vm = 'almalinux_8' ++ ldata = 'almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'centos-stream-8': ++ vm = 'centosstream_8' ++ ldata = 'centos' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-8': ++ vm = 'eurolinux_8' ++ ldata = 'eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'oraclelinux-8': ++ vm = 'oraclelinux_8' ++ ldata = 'oraclelinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-8': ++ vm = 'rocky_8' ++ ldata = 'rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el7toel8_Stable.jenkinsfile b/ci/jenkins/ELevate_el7toel8_Stable.jenkinsfile +new file mode 100644 +index 00000000..8a8667ad +--- /dev/null ++++ b/ci/jenkins/ELevate_el7toel8_Stable.jenkinsfile +@@ -0,0 +1,237 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el7toel8_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y https://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm\"", ++ label: 'Install the elevate-release-latest rpm packages for EL7' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y leapp-upgrade\"", ++ label: 'Install the leap rpm package' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y $targetDistro.leappData\"", ++ label: 'Install the LEAP migration data rpm packages' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"", ++ label: 'Permit ssh as root login' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"", ++ label: 'Answer the LEAP question' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-8': ++ vm = 'almalinux_8' ++ ldata = 'leapp-data-almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'centos-stream-8': ++ vm = 'centosstream_8' ++ ldata = 'leapp-data-centos' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-8': ++ vm = 'eurolinux_8' ++ ldata = 'leapp-data-eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'oraclelinux-8': ++ vm = 'oraclelinux_8' ++ ldata = 'leapp-data-oraclelinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-8': ++ vm = 'rocky_8' ++ ldata = 'leapp-data-rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el7toel8_Testing.jenkinsfile b/ci/jenkins/ELevate_el7toel8_Testing.jenkinsfile +new file mode 100644 +index 00000000..70d1e6f9 +--- /dev/null ++++ b/ci/jenkins/ELevate_el7toel8_Testing.jenkinsfile +@@ -0,0 +1,237 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el7toel8_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum-config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"", ++ label: 'Install the elevate-release-latest rpm packages for EL7' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y leapp-upgrade\"", ++ label: 'Install the leap rpm package' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo yum install -y $targetDistro.leappData\"", ++ label: 'Install the LEAP migration data rpm packages' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"", ++ label: 'Permit ssh as root login' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"", ++ label: 'Answer the LEAP question' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-8': ++ vm = 'almalinux_8' ++ ldata = 'leapp-data-almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'centos-stream-8': ++ vm = 'centosstream_8' ++ ldata = 'leapp-data-centos' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-8': ++ vm = 'eurolinux_8' ++ ldata = 'leapp-data-eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'oraclelinux-8': ++ vm = 'oraclelinux_8' ++ ldata = 'leapp-data-oraclelinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-8': ++ vm = 'rocky_8' ++ ldata = 'leapp-data-rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el8toel9_Development.jenkinsfile b/ci/jenkins/ELevate_el8toel9_Development.jenkinsfile +new file mode 100644 +index 00000000..7362aafe +--- /dev/null ++++ b/ci/jenkins/ELevate_el8toel9_Development.jenkinsfile +@@ -0,0 +1,204 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label params.AGENT ++ } ++ options { ++ timestamps() ++ } ++ parameters { ++ string(name: 'AGENT', defaultValue: 'almalinux-8-vagrant-libvirt-x86_64', description: 'Input label of the Jenkins Agent', trim: true) ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ string(name: 'REPO_URL', defaultValue: 'https://github.com/LKHN/el-test-auto-dev.git', description: 'URL of the pipeline repository', trim: true) ++ string(name: 'REPO_BRANCH', defaultValue: 'main', description: 'Branch of the pipeline repository', trim: true) ++ choice(name: 'SOURCE_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a source distro or all for ELevation') ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all to ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ } ++ stages { ++ stage('Source') { ++ steps { ++ git url: REPO_URL, ++ branch: REPO_BRANCH, ++ credentialsId: 'github-almalinuxautobot' ++ } ++ } ++ stage('Prepare Build and Test enviroment') { ++ steps { ++ sh script: 'cp Vagrantfile.el8toel9 Vagrantfile', ++ label: 'Generate the el8toel9 Vagrantfile' ++ sh script: 'sudo dnf -y install python39-devel python39-wheel', ++ label: 'Install Python 3.9, PIP and Wheel' ++ sh script: 'sudo python3 -m pip install --no-cache-dir --upgrade -r requirements.txt', ++ label: 'Install TestInfra' ++ sh script: 'git clone https://github.com/AlmaLinux/leapp-data.git --branch devel', ++ label: 'Clone the leapp-data git repository' ++ } ++ } ++ stage('ELevation') { ++ matrix { ++ when { ++ allOf { ++ anyOf { ++ expression { params.SOURCE_DISTRO_FILTER == 'all' } ++ expression { params.SOURCE_DISTRO_FILTER == env.SOURCE_DISTRO } ++ } ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ } ++ axes { ++ axis { ++ name 'SOURCE_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9' ++ } ++ } ++ stages { ++ stage('Create and Configure Machines') { ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant destroy -f $SOURCE_DISTRO', ++ label: 'Make sure no machine present from the last retry' ++ sh script: 'vagrant up $SOURCE_DISTRO', ++ label: 'Create the source machines' ++ } ++ } ++ } ++ } ++ stage('ELevate to the all target distros') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"', ++ label: 'Add the ELevate Testing RPM repository' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf install -y leapp-upgrade\"', ++ label: 'Install the leap rpm package' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo bash /vagrant/scripts/install_elevate_dev.sh\"', ++ label: 'Install Development version of ELevate', ++ returnStatus: true ++ script { ++ def LEAPP_DATA = getLeappDataDistro(TARGET_DISTRO) ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mkdir -p /etc/leapp/files/vendors.d\"", ++ label:'Create the LEAPP directory') ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo install -t /etc/leapp/files /vagrant/leapp-data/files/${LEAPP_DATA}/*\"", ++ label:"Install the LEAPP DATA") ++ sh(script:'vagrant ssh $SOURCE_DISTRO -c \"sudo install -t /etc/leapp/files/vendors.d /vagrant/leapp-data/vendors.d/*\"', ++ label:"Install the Vendor DATA") ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mv -f /etc/leapp/files/leapp_upgrade_repositories.repo.el9 /etc/leapp/files/leapp_upgrade_repositories.repo\"", ++ label:'Set LEAPP Repos for EL8') ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mv -f /etc/leapp/files/repomap.json.el9 /etc/leapp/files/repomap.json\"", ++ label:'Set LEAPP Repo map for EL8') ++ sh(script:'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf -y install tree && sudo tree -ha /etc/leapp\"', ++ label:"Debug: Data paths") ++ } ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp preupgrade\"', ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"', ++ label: 'Permit ssh as root login' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"', ++ label: 'Answer the LEAP question' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp upgrade\"', ++ label: 'Start the Upgrade' ++ sh script: 'vagrant reload $SOURCE_DISTRO', ++ label: 'Reboot to the ELevate initramfs' ++ sh script: 'vagrant ssh-config $SOURCE_DISTRO >> .vagrant/ssh-config', ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal'} ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/distro/test_osinfo_$SOURCE_DISTRO-junit.xml tests/distro/test_osinfo_$SOURCE_DISTRO.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/docker/test_docker_ce_$SOURCE_DISTRO-junit.xml tests/docker/test_docker_ce.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: '**/tests/**/**-junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f', ++ label: 'Destroy All Machines' ++ cleanWs() ++ } ++ } ++} ++ ++/* ++* Common Functions ++*/ ++def getLeappDataDistro(TARGET_DISTRO) { ++ def leapp_data = "" ++ ++ switch(TARGET_DISTRO) { ++ case "almalinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "centos-stream-9": ++ leapp_data = TARGET_DISTRO.substring(0, 6) ++ break ++ ++ case "eurolinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "oraclelinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 11) ++ break ++ ++ case "rocky-9": ++ leapp_data = TARGET_DISTRO.substring(0, 5) ++ break ++ ++ default: ++ leap_data = "Error: Target Distro Not Supported" ++ break ++ } ++ return leapp_data ++} +diff --git a/ci/jenkins/ELevate_el8toel9_Internal.jenkinsfile b/ci/jenkins/ELevate_el8toel9_Internal.jenkinsfile +new file mode 100644 +index 00000000..33daa5dd +--- /dev/null ++++ b/ci/jenkins/ELevate_el8toel9_Internal.jenkinsfile +@@ -0,0 +1,223 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ // choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'centos-stream-9', 'eurolinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'rocky-9', 'eurolinux-9', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el8toel9_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ // values 'almalinux-9', 'centos-stream-9', 'eurolinux-9', 'rocky-9' ++ values 'almalinux-9', 'rocky-9', 'eurolinux-9' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y https://repo.almalinux.org/elevate/elevate-release-latest-el8.noarch.rpm\"", ++ label: 'Install the elevate-release-latest rpm packages for EL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"wget https://build.almalinux.org/pulp/content/copr/eabdullin1-leapp-data-internal-centos7-x86_64-dr/config.repo -O /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Add pulp repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y leapp-upgrade\"", ++ label: 'Install the leap rpm package' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y $targetDistro.leappData\"", ++ label: 'Install the LEAP migration data rpm packages' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo sed -i \'s/^AllowZoneDrifting=.*/AllowZoneDrifting=no/\' /etc/firewalld/firewalld.conf\"", ++ label: 'TODO' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section check_vdo.no_vdo_devices=True\"", ++ label: 'TODO' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-9': ++ vm = 'almalinux_9' ++ ldata = 'leapp-data-almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-9': ++ vm = 'eurolinux_9' ++ ldata = 'leapp-data-eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-9': ++ vm = 'rocky_9' ++ ldata = 'leapp-data-rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el8toel9_Internal_Dev.jenkinsfile b/ci/jenkins/ELevate_el8toel9_Internal_Dev.jenkinsfile +new file mode 100644 +index 00000000..2647cc06 +--- /dev/null ++++ b/ci/jenkins/ELevate_el8toel9_Internal_Dev.jenkinsfile +@@ -0,0 +1,210 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label params.AGENT ++ } ++ options { ++ timestamps() ++ } ++ parameters { ++ string(name: 'AGENT', defaultValue: 'almalinux-8-vagrant-libvirt-x86_64', description: 'Input label of the Jenkins Agent', trim: true) ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ string(name: 'REPO_URL', defaultValue: 'https://github.com/LKHN/el-test-auto-dev.git', description: 'URL of the pipeline repository', trim: true) ++ string(name: 'REPO_BRANCH', defaultValue: 'main', description: 'Branch of the pipeline repository', trim: true) ++ choice(name: 'SOURCE_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a source distro or all for ELevation') ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all to ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ } ++ stages { ++ stage('Source') { ++ steps { ++ git url: REPO_URL, ++ branch: REPO_BRANCH, ++ credentialsId: 'github-almalinuxautobot' ++ } ++ } ++ stage('Prepare Build and Test enviroment') { ++ steps { ++ sh script: 'cp Vagrantfile.el8toel9 Vagrantfile', ++ label: 'Generate the el8toel9 Vagrantfile' ++ sh script: 'sudo dnf -y install python39-devel python39-wheel', ++ label: 'Install Python 3.9, PIP and Wheel' ++ sh script: 'sudo python3 -m pip install --no-cache-dir --upgrade -r requirements.txt', ++ label: 'Install TestInfra' ++ sh script: 'git clone https://github.com/AlmaLinux/leapp-data.git --branch devel', ++ label: 'Clone the leapp-data git repository' ++ } ++ } ++ stage('ELevation') { ++ matrix { ++ when { ++ allOf { ++ anyOf { ++ expression { params.SOURCE_DISTRO_FILTER == 'all' } ++ expression { params.SOURCE_DISTRO_FILTER == env.SOURCE_DISTRO } ++ } ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ } ++ axes { ++ axis { ++ name 'SOURCE_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9' ++ } ++ } ++ stages { ++ stage('Create and Configure Machines') { ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant destroy -f $SOURCE_DISTRO', ++ label: 'Make sure no machine present from the last retry' ++ sh script: 'vagrant up $SOURCE_DISTRO', ++ label: 'Create the source machines' ++ } ++ } ++ } ++ } ++ stage('ELevate to the all target distros') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"', ++ label: 'Add the ELevate Testing RPM repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y wget\"", ++ label: 'Install wget' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo wget https://build.almalinux.org/pulp/content/copr/eabdullin1-leapp-data-internal-almalinux-8-x86_64-dr/config.repo -O /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Add pulp repository' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo sed -i 's|enabled=1|enabled=1\\npriority=80|' /etc/yum.repos.d/internal-leapp.repo\"", ++ label: 'Set priority for pulp repository' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf install -y leapp-upgrade\"', ++ label: 'Install the leap rpm package' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo bash /vagrant/scripts/install_elevate_dev.sh\"', ++ label: 'Install Development version of ELevate', ++ returnStatus: true ++ script { ++ def LEAPP_DATA = getLeappDataDistro(TARGET_DISTRO) ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mkdir -p /etc/leapp/files/vendors.d\"", ++ label:'Create the LEAPP directory') ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo install -t /etc/leapp/files /vagrant/leapp-data/files/${LEAPP_DATA}/*\"", ++ label:"Install the LEAPP DATA") ++ sh(script:'vagrant ssh $SOURCE_DISTRO -c \"sudo install -t /etc/leapp/files/vendors.d /vagrant/leapp-data/vendors.d/*\"', ++ label:"Install the Vendor DATA") ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mv -f /etc/leapp/files/leapp_upgrade_repositories.repo.el9 /etc/leapp/files/leapp_upgrade_repositories.repo\"", ++ label:'Set LEAPP Repos for EL8') ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo mv -f /etc/leapp/files/repomap.json.el9 /etc/leapp/files/repomap.json\"", ++ label:'Set LEAPP Repo map for EL8') ++ sh(script:'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf -y install tree && sudo tree -ha /etc/leapp\"', ++ label:"Debug: Data paths") ++ } ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp preupgrade\"', ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"', ++ label: 'Permit ssh as root login' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"', ++ label: 'Answer the LEAP question' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp upgrade\"', ++ label: 'Start the Upgrade' ++ sh script: 'vagrant reload $SOURCE_DISTRO', ++ label: 'Reboot to the ELevate initramfs' ++ sh script: 'vagrant ssh-config $SOURCE_DISTRO >> .vagrant/ssh-config', ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal'} ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/distro/test_osinfo_$SOURCE_DISTRO-junit.xml tests/distro/test_osinfo_$SOURCE_DISTRO.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/docker/test_docker_ce_$SOURCE_DISTRO-junit.xml tests/docker/test_docker_ce.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: '**/tests/**/**-junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f', ++ label: 'Destroy All Machines' ++ cleanWs() ++ } ++ } ++} ++ ++/* ++* Common Functions ++*/ ++def getLeappDataDistro(TARGET_DISTRO) { ++ def leapp_data = "" ++ ++ switch(TARGET_DISTRO) { ++ case "almalinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "centos-stream-9": ++ leapp_data = TARGET_DISTRO.substring(0, 6) ++ break ++ ++ case "eurolinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "oraclelinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 11) ++ break ++ ++ case "rocky-9": ++ leapp_data = TARGET_DISTRO.substring(0, 5) ++ break ++ ++ default: ++ leap_data = "Error: Target Distro Not Supported" ++ break ++ } ++ return leapp_data ++} +diff --git a/ci/jenkins/ELevate_el8toel9_Stable.jenkinsfile b/ci/jenkins/ELevate_el8toel9_Stable.jenkinsfile +new file mode 100644 +index 00000000..d3251fc1 +--- /dev/null ++++ b/ci/jenkins/ELevate_el8toel9_Stable.jenkinsfile +@@ -0,0 +1,221 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label 'x86_64 && bm' ++ } ++ options { ++ timestamps() ++ parallelsAlwaysFailFast() ++ } ++ parameters { ++ // choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'centos-stream-9', 'eurolinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all for ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ } ++ environment { ++ VAGRANT_NO_COLOR = '1' ++ } ++ stages { ++ stage('Prepare') { ++ steps { ++ sh script: 'ansible-galaxy install -r ci/ansible/requirements.yaml', ++ label: 'Install Ansible collections' ++ sh script: 'python3.11 -m venv .venv', ++ label: 'Create Python virtual environment' ++ sh script: '. .venv/bin/activate && pip install --no-color pip pytest-testinfra paramiko', ++ label: 'Install Testinfra' ++ } ++ } ++ stage('CreateSingleMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER != 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO_FILTER) ++ ++ sh script: 'cp ci/vagrant/el7toel8toel9_single.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: "vagrant up $targetDistro.vmName", ++ label: 'Create source VM' ++ } ++ } ++ } ++ stage('CreateMultiMachine') { ++ when { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ } ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ sh script: 'cp ci/vagrant/el8toel9_multi.rb Vagrantfile', ++ label: 'Generate Vagrantfile' ++ sh script: 'vagrant up', ++ label: 'Create source VM' ++ } ++ } ++ stage('ELevationAndTest') { ++ matrix { ++ when { ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ axes { ++ axis { ++ name 'TARGET_DISTRO' ++ // values 'almalinux-9', 'centos-stream-9', 'eurolinux-9', 'rocky-9' ++ values 'almalinux-9', 'rocky-9' ++ } ++ } ++ stages { ++ stage('ELevate') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y https://repo.almalinux.org/elevate/elevate-release-latest-el8.noarch.rpm\"", ++ label: 'Install the elevate-release-latest rpm packages for EL8' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y leapp-upgrade\"", ++ label: 'Install the leap rpm package' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo dnf install -y $targetDistro.leappData\"", ++ label: 'Install the LEAP migration data rpm packages' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp preupgrade\"", ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo sed -i \'s/^AllowZoneDrifting=.*/AllowZoneDrifting=no/\' /etc/firewalld/firewalld.conf\"", ++ label: 'TODO' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp answer --section check_vdo.no_vdo_devices=True\"", ++ label: 'TODO' ++ sh script: "vagrant ssh $targetDistro.vmName -c \"sudo leapp upgrade\"", ++ label: 'Start the Upgrade' ++ sh script: "vagrant reload $targetDistro.vmName", ++ label: 'Reboot to the ELevate initramfs' ++ sh script: "vagrant ssh-config $targetDistro.vmName >> .vagrant/ssh-config", ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal' } ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: 'rm -f conftest.py pytest.ini', ++ label: 'Delete root conftest.py file' ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/distro/test_osinfo_${targetDistro.vmName}.py ++ """, ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce' } ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ script { ++ def targetDistro = targetDistroSpec(TARGET_DISTRO) ++ ++ sh script: """ ++ . .venv/bin/activate \ ++ && py.test -v --hosts=${targetDistro.vmName} \ ++ --ssh-config=.vagrant/ssh-config \ ++ --junit-xml ci/tests/tests/docker/test_docker_ce_${targetDistro.vmName}_junit.xml \ ++ ci/tests/tests/docker/test_docker_ce.py ++ """, ++ label: 'Run the docker specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: 'ci/tests/tests/**/**_junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f --no-parallel -g', ++ label: 'Destroy VMs' ++ cleanWs() ++ } ++ } ++} ++ ++def targetDistroSpec(distro) { ++ def spec = [:] ++ ++ switch (distro) { ++ case 'almalinux-9': ++ vm = 'almalinux_9' ++ ldata = 'leapp-data-almalinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'eurolinux-9': ++ vm = 'eurolinux_9' ++ ldata = 'leapp-data-eurolinux' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ case 'rocky-9': ++ vm = 'rocky_9' ++ ldata = 'leapp-data-rocky' ++ ++ spec = [ ++ vmName: vm, ++ leappData: ldata ++ ] ++ break ++ default: ++ spec = [ ++ vmName: 'unknown', ++ leappData: 'unknown' ++ ] ++ break ++ } ++ return spec ++} +diff --git a/ci/jenkins/ELevate_el8toel9_Testing.jenkinsfile b/ci/jenkins/ELevate_el8toel9_Testing.jenkinsfile +new file mode 100644 +index 00000000..af1b9205 +--- /dev/null ++++ b/ci/jenkins/ELevate_el8toel9_Testing.jenkinsfile +@@ -0,0 +1,191 @@ ++RETRY = params.RETRY ++TIMEOUT = params.TIMEOUT ++ ++pipeline { ++ agent { ++ label params.AGENT ++ } ++ options { ++ timestamps() ++ } ++ parameters { ++ string(name: 'AGENT', defaultValue: 'almalinux-8-vagrant-libvirt-x86_64', description: 'Input label of the Jenkins Agent', trim: true) ++ string(name: 'RETRY', defaultValue: '3', description: 'Input count of retry', trim: true) ++ string(name: 'TIMEOUT', defaultValue: '60', description: 'Input timeout value in minutes', trim: true) ++ string(name: 'REPO_URL', defaultValue: 'https://github.com/LKHN/el-test-auto-dev.git', description: 'URL of the pipeline repository', trim: true) ++ string(name: 'REPO_BRANCH', defaultValue: 'main', description: 'Branch of the pipeline repository', trim: true) ++ choice(name: 'SOURCE_DISTRO_FILTER', choices: ['almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8', 'all'], description: 'Select a source distro or all for ELevation') ++ choice(name: 'TARGET_DISTRO_FILTER', choices: ['almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9', 'all'], description: 'Select a target distro or all to ELevation') ++ choice(name: 'CONF_FILTER', choices: ['minimal', 'docker-ce'], description: 'Select a configuration') ++ } ++ stages { ++ stage('Source') { ++ steps { ++ git url: REPO_URL, ++ branch: REPO_BRANCH, ++ credentialsId: 'github-almalinuxautobot' ++ } ++ } ++ stage('Prepare Build and Test enviroment') { ++ steps { ++ sh script: 'cp Vagrantfile.el8toel9 Vagrantfile', ++ label: 'Generate the el8toel9 Vagrantfile' ++ sh script: 'sudo dnf -y install python39-devel python39-wheel', ++ label: 'Install Python 3.9, PIP and Wheel' ++ sh script: 'sudo python3 -m pip install --no-cache-dir --upgrade -r requirements.txt', ++ label: 'Install TestInfra' ++ } ++ } ++ stage('ELevation') { ++ matrix { ++ when { ++ allOf { ++ anyOf { ++ expression { params.SOURCE_DISTRO_FILTER == 'all' } ++ expression { params.SOURCE_DISTRO_FILTER == env.SOURCE_DISTRO } ++ } ++ anyOf { ++ expression { params.TARGET_DISTRO_FILTER == 'all' } ++ expression { params.TARGET_DISTRO_FILTER == env.TARGET_DISTRO } ++ } ++ } ++ } ++ axes { ++ axis { ++ name 'SOURCE_DISTRO' ++ values 'almalinux-8', 'centos-stream-8', 'eurolinux-8', 'oraclelinux-8', 'rocky-8' ++ } ++ axis { ++ name 'TARGET_DISTRO' ++ values 'almalinux-9', 'centos-stream-9', 'eurolinux-9', 'oraclelinux-9', 'rocky-9' ++ } ++ } ++ stages { ++ stage('Create and Configure Machines') { ++ environment { ++ CONFIG = "${CONF_FILTER}" ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant destroy -f $SOURCE_DISTRO', ++ label: 'Make sure no machine present from the last retry' ++ sh script: 'vagrant up $SOURCE_DISTRO', ++ label: 'Create the source machines' ++ } ++ } ++ } ++ } ++ stage('ELevate to the all target distros') { ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf config-manager --add-repo https://repo.almalinux.org/elevate/testing/elevate-testing.repo\"', ++ label: 'Add the ELevate Testing RPM repository' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf -y install leapp-upgrade\"', ++ label: 'Install the leap rpm package' ++ script { ++ def LEAPP_DATA = getLeappDataDistro(TARGET_DISTRO) ++ sh(script:"vagrant ssh $SOURCE_DISTRO -c \"sudo dnf -y install leapp-data-$LEAPP_DATA\"", ++ label:'Install the LEAP migration data rpm packages') ++ sh(script:'vagrant ssh $SOURCE_DISTRO -c \"sudo dnf -y install tree && sudo tree -ha /etc/leapp\"', ++ label:'Debug: Data paths') ++ } ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp preupgrade\"', ++ label: 'Start the Pre-Upgrade check', ++ returnStatus: true ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config\"', ++ label: 'Permit ssh as root login' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True\"', ++ label: 'Answer the LEAP question' ++ sh script: 'vagrant ssh $SOURCE_DISTRO -c \"sudo leapp upgrade\"', ++ label: 'Start the Upgrade' ++ sh script: 'vagrant reload $SOURCE_DISTRO', ++ label: 'Reboot to the ELevate initramfs' ++ sh script: 'vagrant ssh-config $SOURCE_DISTRO >> .vagrant/ssh-config', ++ label: 'Generate the ssh-config file' ++ } ++ } ++ } ++ } ++ stage('Distro Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'minimal'} ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/distro/test_osinfo_$TARGET_DISTRO-junit.xml tests/distro/test_osinfo_$TARGET_DISTRO.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ stage('Docker Tests') { ++ when { ++ anyOf { ++ expression { params.CONF_FILTER == 'docker-ce'} ++ } ++ } ++ steps { ++ retry(RETRY) { ++ timeout(time: TIMEOUT, unit: 'MINUTES') { ++ sh script: 'py.test -v --hosts=$SOURCE_DISTRO --ssh-config=.vagrant/ssh-config --junit-xml tests/docker/test_docker_ce_$SOURCE_DISTRO-junit.xml tests/docker/test_docker_ce.py', ++ label: 'Run the distro specific tests' ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ post { ++ success { ++ junit testResults: '**/tests/**/**-junit.xml', ++ skipPublishingChecks: true ++ } ++ cleanup { ++ sh script: 'vagrant destroy -f', ++ label: 'Destroy All Machines' ++ cleanWs() ++ } ++ } ++} ++ ++/* ++* Common Functions ++*/ ++def getLeappDataDistro(TARGET_DISTRO) { ++ def leapp_data = "" ++ ++ switch(TARGET_DISTRO) { ++ case "almalinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "centos-stream-9": ++ leapp_data = TARGET_DISTRO.substring(0, 6) ++ break ++ ++ case "eurolinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 9) ++ break ++ ++ case "oraclelinux-9": ++ leapp_data = TARGET_DISTRO.substring(0, 11) ++ break ++ ++ case "rocky-9": ++ leapp_data = TARGET_DISTRO.substring(0, 5) ++ break ++ ++ default: ++ leap_data = "Error: Target Distro Not Supported" ++ break ++ } ++ return leapp_data ++} +diff --git a/ci/scripts/install_elevate_dev.sh b/ci/scripts/install_elevate_dev.sh +new file mode 100644 +index 00000000..f9cc2903 +--- /dev/null ++++ b/ci/scripts/install_elevate_dev.sh +@@ -0,0 +1,117 @@ ++#!/usr/bin/env bash ++ ++USER='AlmaLinux' ++BRANCH='almalinux' ++ ++show_usage() { ++ echo 'Usage: sync_cloudlinux [OPTION]...' ++ echo '' ++ echo ' -h, --help show this message and exit' ++ echo ' -u, --user github user name (default: AlmaLinux)' ++ echo ' -b, --branch github branch name (default: almalinux)' ++} ++ ++while [[ $# -gt 0 ]]; do ++ opt="$1" ++ case ${opt} in ++ -h|--help) ++ show_usage ++ exit 0 ++ ;; ++ -u|--user) ++ USER="$2" ++ shift ++ shift ++ ;; ++ -b|--branch) ++ BRANCH="$2" ++ shift ++ shift ++ ;; ++ *) ++ echo -e "Error: unknown option ${opt}" >&2 ++ exit 2 ++ ;; ++ esac ++done ++ ++RHEL_MAJOR_VERSION=$(rpm --eval %rhel) ++WORK_DIR="$HOME" ++NEW_LEAPP_NAME="leapp-repository-$BRANCH" ++NEW_LEAPP_DIR="$WORK_DIR/$NEW_LEAPP_NAME/" ++LEAPP_PATH='/usr/share/leapp-repository/repositories/' ++LEAPP_GPG_PATH='/etc/leapp/repos.d/system_upgrade/common/files/rpm-gpg' ++EXCLUDE_PATH=' ++/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/files/bundled-rpms ++/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/files ++/usr/share/leapp-repository/repositories/system_upgrade/el7toel8 ++/usr/share/leapp-repository/repositories/system_upgrade/el8toel9/files/bundled-rpms ++/usr/share/leapp-repository/repositories/system_upgrade/el8toel9/files ++/usr/share/leapp-repository/repositories/system_upgrade/el8toel9 ++/usr/share/leapp-repository/repositories/system_upgrade ++/usr/share/leapp-repository/repositories/ ++' ++ ++ ++echo "RHEL_MAJOR_VERSION=$RHEL_MAJOR_VERSION" ++echo "WORK_DIR=$WORK_DIR" ++echo "EXCLUDED_PATHS=$EXCLUDE_PATH" ++ ++echo "Preserve GPG keys if any" ++for major in 8 9; do ++ test -e ${LEAPP_GPG_PATH}/${major} && mv ${LEAPP_GPG_PATH}/${major} ${WORK_DIR}/ ++done ++ ++ ++echo 'Remove old files' ++for dir in $(find $LEAPP_PATH -type d); ++do ++ skip=0 ++ for exclude in $(echo $EXCLUDE_PATH); ++ do ++ if [[ $exclude == $dir ]];then ++ skip=1 ++ break ++ fi ++ done ++ if [ $skip -eq 0 ];then ++ rm -rf $dir ++ fi ++done ++ ++echo "Download new tarball from https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz" ++curl -s -L https://github.com/$USER/leapp-repository/archive/$BRANCH/leapp-repository-$BRANCH.tar.gz | tar -xmz -C $WORK_DIR/ || exit 1 ++ ++echo 'Deleting files as in spec file' ++rm -rf $NEW_LEAPP_DIR/repos/common/actors/testactor ++find $NEW_LEAPP_DIR/repos/common -name "test.py" -delete ++rm -rf `find $NEW_LEAPP_DIR -name "tests" -type d` ++find $NEW_LEAPP_DIR -name "Makefile" -delete ++if [ $RHEL_MAJOR_VERSION -eq '7' ]; then ++ rm -rf $NEW_LEAPP_DIR/repos/system_upgrade/el8toel9 ++else ++ rm -rf $NEW_LEAPP_DIR/repos/system_upgrade/el7toel8 ++ rm -rf $NEW_LEAPP_DIR/repos/system_upgrade/cloudlinux ++fi ++ ++echo 'Copy new data to system' ++cp -r $NEW_LEAPP_DIR/repos/* $LEAPP_PATH || exit 1 ++ ++for DIRECTORY in $(find $LEAPP_PATH -mindepth 1 -maxdepth 1 -type d); ++do ++ REPOSITORY=$(basename $DIRECTORY) ++ if ! [ -e /etc/leapp/repos.d/$REPOSITORY ];then ++ echo "Enabling repository $REPOSITORY" ++ ln -s $LEAPP_PATH/$REPOSITORY /etc/leapp/repos.d/$REPOSITORY || exit 1 ++ fi ++done ++ ++echo "Restore GPG keys if any" ++for major in 8 9; do ++ rm -rf ${LEAPP_GPG_PATH}/${major} ++ test -e ${WORK_DIR}/${major} && mv ${WORK_DIR}/${major} ${LEAPP_GPG_PATH}/ ++done ++ ++rm -rf $NEW_LEAPP_DIR ++ ++exit 0 +diff --git a/ci/tests/tests/conftest.py b/ci/tests/tests/conftest.py +new file mode 100644 +index 00000000..01f9443e +--- /dev/null ++++ b/ci/tests/tests/conftest.py +@@ -0,0 +1,52 @@ ++import pytest ++import re ++ ++ ++@pytest.fixture(scope="module") ++def get_os_release(host): ++ """Get content of the /etc/os-release""" ++ os_release = host.file("/etc/os-release") ++ return os_release ++ ++ ++@pytest.fixture(scope="module") ++def get_redhat_release(host): ++ """Get content of the /etc/redhat-release""" ++ redhat_release = host.file("/etc/redhat-release") ++ return redhat_release ++ ++ ++@pytest.fixture(scope="module") ++def get_kernel_info(host): ++ """Get kernel version and vendor information""" ++ kernel_ver_pattern = re.compile( ++ f".*(^[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?.[0-9][0-9]?[0-9]?).*" ++ ) ++ kernel_ver_output = host.check_output("uname -r") ++ kernel_version = kernel_ver_pattern.match(kernel_ver_output).group(1) ++ ++ with host.sudo(): ++ kernel_vendor = host.check_output( ++ "grep -Ei '(.*kernel signing key|.*CA Server|.*Build)' /proc/keys | sed -E" ++ " 's/ +/:/g' | cut -d ':' -f 9 | uniq" ++ ) ++ kernel_info = (kernel_version, kernel_vendor) ++ return kernel_info ++ ++ ++@pytest.fixture(scope="module", params=["glibc", "systemd", "coreutils", "rpm"]) ++def get_pkg_info(host, request): ++ """Get vendor and version of installed packages""" ++ pkg_name = request.param ++ pkg_vendor = host.check_output( ++ f"rpm -qa --queryformat \"%{{VENDOR}}\n\" {request.param} | sed '$p;d' " ++ ) ++ pkg_version = host.check_output( ++ f'rpm -qa --queryformat "%{{VERSION}}\n" {request.param} | sort -n | sed' ++ " '$p;d'" ++ ) ++ pkg_info = (pkg_name, pkg_vendor, pkg_version) ++ # print(pkg_name) ++ # print(pkg_vendor) ++ # print(pkg_version) ++ return pkg_info +diff --git a/ci/tests/tests/distro/test_osinfo_almalinux_8.py b/ci/tests/tests/distro/test_osinfo_almalinux_8.py +new file mode 100644 +index 00000000..c5219b35 +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_almalinux_8.py +@@ -0,0 +1,43 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="AlmaLinux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="almalinux"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="8.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("AlmaLinux release 8.*") ++ ++ ++@pytest.mark.usefixtures("get_pkg_info") ++class TestPkgInfo: ++ """Test vendor and version of packages""" ++ ++ def test_pkg_vendor(self, get_pkg_info): ++ assert get_pkg_info[1] == "AlmaLinux" ++ ++ def test_pkg_version(self, get_pkg_info): ++ if get_pkg_info[0] == "kernel": ++ assert get_pkg_info[2] == "4.18.0" ++ elif get_pkg_info[0] == "glibc": ++ assert get_pkg_info[2] == "2.28" ++ elif get_pkg_info[0] == "systemd": ++ assert get_pkg_info[2] == "239" ++ elif get_pkg_info[0] == "coreutils": ++ assert get_pkg_info[2] == "8.30" ++ else: ++ assert get_pkg_info[2] == "4.14.3" +diff --git a/ci/tests/tests/distro/test_osinfo_almalinux_9.py b/ci/tests/tests/distro/test_osinfo_almalinux_9.py +new file mode 100644 +index 00000000..1536e52b +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_almalinux_9.py +@@ -0,0 +1,52 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="AlmaLinux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="almalinux"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="9.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("AlmaLinux release 9.*") ++ ++ ++@pytest.mark.usefixtures("get_kernel_info") ++class TestKernelInfo: ++ """Test version and vendor of running kernel""" ++ ++ def test_kernel_version(self, get_kernel_info): ++ assert get_kernel_info[0] == "5.14.0" ++ ++ def test_kernel_vendor(self, get_kernel_info): ++ assert get_kernel_info[1] == "AlmaLinux" ++ ++ ++@pytest.mark.usefixtures("get_pkg_info") ++class TestPkgInfo: ++ """Test vendor and version of packages""" ++ ++ def test_pkg_vendor(self, get_pkg_info): ++ assert get_pkg_info[1] == "AlmaLinux" ++ ++ def test_pkg_version(self, get_pkg_info): ++ if get_pkg_info[0] == "glibc": ++ assert get_pkg_info[2] == "2.34" ++ elif get_pkg_info[0] == "systemd": ++ assert get_pkg_info[2] == "252" ++ elif get_pkg_info[0] == "coreutils": ++ assert get_pkg_info[2] == "8.32" ++ else: ++ assert get_pkg_info[2] == "4.16.1.3" +diff --git a/ci/tests/tests/distro/test_osinfo_centosstream_8.py b/ci/tests/tests/distro/test_osinfo_centosstream_8.py +new file mode 100644 +index 00000000..995ae61e +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_centosstream_8.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="CentOS Stream"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="centos"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="8"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("CentOS Stream release 8") +diff --git a/ci/tests/tests/distro/test_osinfo_centosstream_9.py b/ci/tests/tests/distro/test_osinfo_centosstream_9.py +new file mode 100644 +index 00000000..28e47202 +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_centosstream_9.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="CentOS Stream"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="centos"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="9"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("CentOS Stream release 9") +diff --git a/ci/tests/tests/distro/test_osinfo_eurolinux_8.py b/ci/tests/tests/distro/test_osinfo_eurolinux_8.py +new file mode 100644 +index 00000000..d1bfde55 +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_eurolinux_8.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="EuroLinux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="eurolinux"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="8.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("EuroLinux release 8.*") +diff --git a/ci/tests/tests/distro/test_osinfo_eurolinux_9.py b/ci/tests/tests/distro/test_osinfo_eurolinux_9.py +new file mode 100644 +index 00000000..7d749b32 +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_eurolinux_9.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="EuroLinux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="eurolinux"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="9.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("EuroLinux release 9.*") +diff --git a/ci/tests/tests/distro/test_osinfo_oraclelinux_8.py b/ci/tests/tests/distro/test_osinfo_oraclelinux_8.py +new file mode 100644 +index 00000000..2080fd2f +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_oraclelinux_8.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="Oracle Linux Server"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="ol"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="8.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("Red Hat Enterprise Linux release 8.*") +diff --git a/ci/tests/tests/distro/test_osinfo_oraclelinux_9.py b/ci/tests/tests/distro/test_osinfo_oraclelinux_9.py +new file mode 100644 +index 00000000..bd5044bb +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_oraclelinux_9.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="Oracle Linux Server"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="ol"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="9.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("Red Hat Enterprise Linux release 9.*") +diff --git a/ci/tests/tests/distro/test_osinfo_rocky_8.py b/ci/tests/tests/distro/test_osinfo_rocky_8.py +new file mode 100644 +index 00000000..cce5d668 +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_rocky_8.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="Rocky Linux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="rocky"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="8.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("Rocky Linux release 8.*") +diff --git a/ci/tests/tests/distro/test_osinfo_rocky_9.py b/ci/tests/tests/distro/test_osinfo_rocky_9.py +new file mode 100644 +index 00000000..ce8cccdb +--- /dev/null ++++ b/ci/tests/tests/distro/test_osinfo_rocky_9.py +@@ -0,0 +1,23 @@ ++import pytest ++ ++ ++@pytest.mark.usefixtures("get_os_release") ++class TestOSRelease: ++ """Test values of NAME, ID and VERSION_ID""" ++ ++ def test_os_rel_name(self, get_os_release): ++ assert get_os_release.contains('NAME="Rocky Linux"') ++ ++ def test_os_rel_id(self, get_os_release): ++ assert get_os_release.contains('ID="rocky"') ++ ++ def test_os_rel_version_id(self, get_os_release): ++ assert get_os_release.contains('VERSION_ID="9.*"') ++ ++ ++@pytest.mark.usefixtures("get_redhat_release") ++class TestRHRelease: ++ """Test contents of the /etc/redhat-release""" ++ ++ def test_redhat_release(self, get_redhat_release): ++ assert get_redhat_release.contains("Rocky Linux release 9.*") +diff --git a/ci/tests/tests/docker/test_docker_ce.py b/ci/tests/tests/docker/test_docker_ce.py +new file mode 100644 +index 00000000..3c2550c7 +--- /dev/null ++++ b/ci/tests/tests/docker/test_docker_ce.py +@@ -0,0 +1,26 @@ ++import pytest ++ ++ ++class TestDockerServices: ++ """Test docker and containerd services running and enabled""" ++ ++ def test_docker_is_running(self, host): ++ assert host.service("docker.service").is_running ++ ++ def test_containerd_is_running(self, host): ++ assert host.service("containerd.service").is_running ++ ++ def test_docker_is_enabled(self, host): ++ assert host.service("docker.service").is_enabled ++ ++ def test_containerd_is_enabled(self, host): ++ assert host.service("containerd.service").is_enabled ++ ++ ++class TestDockerWorking: ++ """Test docker working with the hello world container""" ++ ++ def test_docker_is_working(self, host): ++ with host.sudo(): ++ cmd = host.run("sudo docker run --rm hello-world") ++ assert cmd.succeeded +diff --git a/ci/vagrant/el7toel8_multi.rb b/ci/vagrant/el7toel8_multi.rb +new file mode 100644 +index 00000000..74116f78 +--- /dev/null ++++ b/ci/vagrant/el7toel8_multi.rb +@@ -0,0 +1,40 @@ ++# -*- mode: ruby -*- ++# vi: set ft=ruby : ++ ++configuration = ENV['CONFIG'] ++ ++Vagrant.configure('2') do |config| ++ config.vagrant.plugins = 'vagrant-libvirt' ++ ++ config.vm.synced_folder '.', '/vagrant', disabled: true ++ config.vm.box = 'generic/centos7' ++ config.vm.boot_timeout = 3600 ++ ++ config.vm.provider 'libvirt' do |v| ++ v.uri = 'qemu:///system' ++ v.memory = 4096 ++ v.machine_type = 'q35' ++ v.cpu_mode = 'host-passthrough' ++ v.cpus = 2 ++ v.disk_bus = 'scsi' ++ v.disk_driver cache: 'writeback', discard: 'unmap' ++ v.random_hostname = true ++ end ++ ++ target_distros = ['almalinux', 'centosstream', 'eurolinux', 'oraclelinux', 'rocky'] ++ ++ target_distros.each do |target_distro| ++ config.vm.define "#{target_distro}_8" do |machine| ++ machine.vm.hostname = "#{target_distro}-8.test" ++ ++ if target_distro == target_distros[-1] ++ machine.vm.provision 'ansible' do |ansible| ++ ansible.compatibility_mode = '2.0' ++ ansible.limit = 'all' ++ ansible.playbook = "ci/ansible/#{configuration}.yaml" ++ ansible.config_file = 'ci/ansible/ansible.cfg' ++ end ++ end ++ end ++ end ++end +diff --git a/ci/vagrant/el7toel8toel9_single.rb b/ci/vagrant/el7toel8toel9_single.rb +new file mode 100644 +index 00000000..0a34edbd +--- /dev/null ++++ b/ci/vagrant/el7toel8toel9_single.rb +@@ -0,0 +1,54 @@ ++# -*- mode: ruby -*- ++# vi: set ft=ruby : ++ ++configuration = ENV['CONFIG'] ++ ++Vagrant.configure('2') do |config| ++ config.vagrant.plugins = 'vagrant-libvirt' ++ ++ config.vm.synced_folder '.', '/vagrant', disabled: true ++ config.ssh.disable_deprecated_algorithms = true ++ config.vm.boot_timeout = 3600 ++ ++ config.vm.provider 'libvirt' do |v| ++ v.uri = 'qemu:///system' ++ v.memory = 4096 ++ v.machine_type = 'q35' ++ v.cpu_mode = 'host-passthrough' ++ v.cpus = 2 ++ v.disk_bus = 'scsi' ++ v.disk_driver cache: 'writeback', discard: 'unmap' ++ v.random_hostname = true ++ end ++ ++ # EL7toEL8 ++ target_distros = ['almalinux', 'centosstream', 'eurolinux', 'oraclelinux', 'rocky'] ++ ++ target_distros.each do |target_distro| ++ config.vm.define "#{target_distro}_8" do |machine| ++ machine.vm.box = 'generic/centos7' ++ machine.vm.hostname = "#{target_distro}-8.test" ++ end ++ end ++ ++ # EL8toEL9 ++ target_distros_el9 = { ++ almalinux: 'almalinux/8', ++ # centosstream: 'generic/centos8s', ++ eurolinux: 'eurolinux-vagrant/eurolinux-8', ++ rocky: 'generic/rocky8' ++ } ++ ++ target_distros_el9.each_pair do |vm, box| ++ config.vm.define "#{vm}_9" do |machine| ++ machine.vm.box = "#{box}" ++ machine.vm.hostname = "#{vm}-9.test" ++ end ++ end ++ ++ config.vm.provision 'ansible' do |ansible| ++ ansible.compatibility_mode = '2.0' ++ ansible.playbook = "ci/ansible/#{configuration}.yaml" ++ ansible.config_file = 'ci/ansible/ansible.cfg' ++ end ++end +diff --git a/ci/vagrant/el8toel9_multi.rb b/ci/vagrant/el8toel9_multi.rb +new file mode 100644 +index 00000000..0e2ba8ab +--- /dev/null ++++ b/ci/vagrant/el8toel9_multi.rb +@@ -0,0 +1,46 @@ ++# -*- mode: ruby -*- ++# vi: set ft=ruby : ++ ++configuration = ENV['CONFIG'] ++ ++Vagrant.configure('2') do |config| ++ config.vagrant.plugins = 'vagrant-libvirt' ++ ++ config.vm.synced_folder '.', '/vagrant', disabled: true ++ config.ssh.disable_deprecated_algorithms = true ++ config.vm.boot_timeout = 3600 ++ ++ config.vm.provider 'libvirt' do |v| ++ v.uri = 'qemu:///system' ++ v.memory = 4096 ++ v.machine_type = 'q35' ++ v.cpu_mode = 'host-passthrough' ++ v.cpus = 2 ++ v.disk_bus = 'scsi' ++ v.disk_driver cache: 'writeback', discard: 'unmap' ++ v.random_hostname = true ++ end ++ ++ target_distros = { ++ almalinux: 'almalinux/8', ++ # centosstream: 'generic/centos8s', ++ eurolinux: 'eurolinux-vagrant/eurolinux-8', ++ rocky: 'generic/rocky8' ++ } ++ ++ target_distros.each_pair do |vm, box| ++ config.vm.define "#{vm}_9" do |machine| ++ machine.vm.box = "#{box}" ++ machine.vm.hostname = "#{vm}-9.test" ++ ++ if [vm, box] == target_distros.to_a.last ++ machine.vm.provision 'ansible' do |ansible| ++ ansible.compatibility_mode = '2.0' ++ ansible.limit = 'all' ++ ansible.playbook = "ci/ansible/#{configuration}.yaml" ++ ansible.config_file = 'ci/ansible/ansible.cfg' ++ end ++ end ++ end ++ end ++end +diff --git a/commands/command_utils.py b/commands/command_utils.py +index 4f6f99eb..84117483 100644 +--- a/commands/command_utils.py ++++ b/commands/command_utils.py +@@ -13,7 +13,7 @@ LEAPP_UPGRADE_FLAVOUR_DEFAULT = 'default' + LEAPP_UPGRADE_FLAVOUR_SAP_HANA = 'saphana' + LEAPP_UPGRADE_PATHS = 'upgrade_paths.json' + +-VERSION_REGEX = re.compile(r"^([1-9]\d*)\.(\d+)$") ++VERSION_REGEX = re.compile(r"^([1-9]\d*)(\.(\d+))?$") + + + def check_version(version): +diff --git a/etc/leapp/transaction/to_reinstall b/etc/leapp/transaction/to_reinstall +new file mode 100644 +index 00000000..c6694a8e +--- /dev/null ++++ b/etc/leapp/transaction/to_reinstall +@@ -0,0 +1,3 @@ ++### List of packages (each on new line) to be reinstalled to the upgrade transaction ++### Useful for packages that have identical version strings but contain binary changes between major OS versions ++### Packages that aren't installed will be skipped +diff --git a/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py b/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py +index 553ffc35..6af3ef8d 100644 +--- a/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py ++++ b/repos/system_upgrade/common/actors/addupgradebootentry/libraries/addupgradebootentry.py +@@ -84,7 +84,7 @@ def figure_out_commands_needed_to_add_entry(kernel_path, initramfs_path, args_to + '/usr/sbin/grubby', + '--add-kernel', '{0}'.format(kernel_path), + '--initrd', '{0}'.format(initramfs_path), +- '--title', 'RHEL-Upgrade-Initramfs', ++ '--title', 'ELevate-Upgrade-Initramfs', + '--copy-default', + '--make-default', + '--args', args_to_add_str +diff --git a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py +index c4f5232b..b6d2e235 100644 +--- a/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py ++++ b/repos/system_upgrade/common/actors/addupgradebootentry/tests/unit_test_addupgradebootentry.py +@@ -49,7 +49,7 @@ run_args_add = [ + '/usr/sbin/grubby', + '--add-kernel', '/abc', + '--initrd', '/def', +- '--title', 'RHEL-Upgrade-Initramfs', ++ '--title', 'ELevate-Upgrade-Initramfs', + '--copy-default', + '--make-default', + '--args', +diff --git a/repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py b/repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py +new file mode 100644 +index 00000000..52f5af9d +--- /dev/null ++++ b/repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py +@@ -0,0 +1,53 @@ ++from leapp.actors import Actor ++from leapp.libraries.stdlib import api ++from leapp.models import ( ++ RepositoriesFacts, ++ VendorSourceRepos, ++ ActiveVendorList, ++) ++from leapp.tags import FactsPhaseTag, IPUWorkflowTag ++ ++ ++class CheckEnabledVendorRepos(Actor): ++ """ ++ Create a list of vendors whose repositories are present on the system and enabled. ++ Only those vendors' configurations (new repositories, PES actions, etc.) ++ will be included in the upgrade process. ++ """ ++ ++ name = "check_enabled_vendor_repos" ++ consumes = (RepositoriesFacts, VendorSourceRepos) ++ produces = (ActiveVendorList) ++ tags = (IPUWorkflowTag, FactsPhaseTag.Before) ++ ++ def process(self): ++ vendor_mapping_data = {} ++ active_vendors = set() ++ ++ # Make a dict for easy mapping of repoid -> corresponding vendor name. ++ for vendor_src_repodata in api.consume(VendorSourceRepos): ++ for vendor_src_repo in vendor_src_repodata.source_repoids: ++ vendor_mapping_data[vendor_src_repo] = vendor_src_repodata.vendor ++ ++ # Is the repo listed in the vendor map as from_repoid present on the system? ++ for repos_facts in api.consume(RepositoriesFacts): ++ for repo_file in repos_facts.repositories: ++ for repo_data in repo_file.data: ++ self.log.debug( ++ "Looking for repository {} in vendor maps".format(repo_data.repoid) ++ ) ++ if repo_data.enabled and repo_data.repoid in vendor_mapping_data: ++ # If the vendor's repository is present in the system and enabled, count the vendor as active. ++ new_vendor = vendor_mapping_data[repo_data.repoid] ++ self.log.debug( ++ "Repository {} found and enabled, enabling vendor {}".format( ++ repo_data.repoid, new_vendor ++ ) ++ ) ++ active_vendors.add(new_vendor) ++ ++ if active_vendors: ++ self.log.debug("Active vendor list: {}".format(active_vendors)) ++ api.produce(ActiveVendorList(data=list(active_vendors))) ++ else: ++ self.log.info("No active vendors found, vendor list not generated") +diff --git a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh +index 56a94b5d..46c5d9b6 100755 +--- a/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh ++++ b/repos/system_upgrade/common/actors/commonleappdracutmodules/files/dracut/85sys-upgrade-redhat/do-upgrade.sh +@@ -390,4 +390,3 @@ getarg 'rd.break=leapp-logs' 'rd.upgrade.break=leapp-finish' && { + sync + mount -o "remount,$old_opts" "$NEWROOT" + exit $result +- +diff --git a/repos/system_upgrade/common/actors/distributionsignedrpmscanner/actor.py b/repos/system_upgrade/common/actors/distributionsignedrpmscanner/actor.py +index 56016513..7ae1dd5a 100644 +--- a/repos/system_upgrade/common/actors/distributionsignedrpmscanner/actor.py ++++ b/repos/system_upgrade/common/actors/distributionsignedrpmscanner/actor.py +@@ -1,6 +1,6 @@ + from leapp.actors import Actor + from leapp.libraries.actor import distributionsignedrpmscanner +-from leapp.models import DistributionSignedRPM, InstalledRedHatSignedRPM, InstalledRPM, InstalledUnsignedRPM ++from leapp.models import DistributionSignedRPM, InstalledRedHatSignedRPM, InstalledRPM, InstalledUnsignedRPM, VendorSignatures + from leapp.tags import FactsPhaseTag, IPUWorkflowTag + from leapp.utils.deprecation import suppress_deprecation + +@@ -8,7 +8,7 @@ from leapp.utils.deprecation import suppress_deprecation + @suppress_deprecation(InstalledRedHatSignedRPM) + class DistributionSignedRpmScanner(Actor): + """ +- Provide data about distribution signed & unsigned RPM packages. ++ Provide data about distribution plus vendors signed & unsigned RPM packages. + + For various checks and actions done during the upgrade it's important to + know what packages are signed by GPG keys of the installed linux system +@@ -22,11 +22,18 @@ class DistributionSignedRpmScanner(Actor): + common/files/distro//gpg_signatures.json + where is distribution ID of the installed system (e.g. centos, rhel). + ++ Fingerprints of vendors GPG keys are stored under ++ /etc/leapp/files/vendors.d/.sigs ++ where is name of the vendor (e.g. mariadb, postgresql). ++ ++ The "Distribution" in the name of the actor is a historical artifact - the actor ++ is used for both distribution and all vendors present in config files. ++ + If the file for the installed distribution is not find, end with error. + """ + + name = 'distribution_signed_rpm_scanner' +- consumes = (InstalledRPM,) ++ consumes = (InstalledRPM, VendorSignatures) + produces = (DistributionSignedRPM, InstalledRedHatSignedRPM, InstalledUnsignedRPM,) + tags = (IPUWorkflowTag, FactsPhaseTag) + +diff --git a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py +index f42909f0..4a2bc8ad 100644 +--- a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py ++++ b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py +@@ -1,17 +1,118 @@ ++import os ++import re ++ ++from leapp.libraries.stdlib import run, api + from leapp.actors import Actor +-from leapp.libraries.common import efi_reboot_fix ++from leapp.models import InstalledTargetKernelVersion, KernelCmdlineArg, FirmwareFacts, MountEntry + from leapp.tags import FinalizationPhaseTag, IPUWorkflowTag ++from leapp.exceptions import StopActorExecutionError + + + class EfiFinalizationFix(Actor): + """ +- Adjust EFI boot entry for final reboot ++ Ensure that EFI boot order is updated, which is particularly necessary ++ when upgrading to a different OS distro. Also rebuilds grub config ++ if necessary. + """ + + name = 'efi_finalization_fix' +- consumes = () ++ consumes = (KernelCmdlineArg, InstalledTargetKernelVersion, FirmwareFacts, MountEntry) + produces = () + tags = (FinalizationPhaseTag, IPUWorkflowTag) + + def process(self): +- efi_reboot_fix.maybe_emit_updated_boot_entry() ++ is_system_efi = False ++ ff = next(self.consume(FirmwareFacts), None) ++ ++ dirname = { ++ 'AlmaLinux': 'almalinux', ++ 'CentOS Linux': 'centos', ++ 'CentOS Stream': 'centos', ++ 'Oracle Linux Server': 'redhat', ++ 'Red Hat Enterprise Linux': 'redhat', ++ 'Rocky Linux': 'rocky', ++ 'Scientific Linux': 'redhat', ++ 'EuroLinux': 'eurolinux', ++ } ++ ++ efi_shimname_dict = { ++ 'x86_64': 'shimx64.efi', ++ 'aarch64': 'shimaa64.efi' ++ } ++ ++ def devparts(dev): ++ """ ++ NVMe block devices aren't named like SCSI/ATA/etc block devices and must be parsed differently. ++ SCSI/ATA/etc devices have a syntax resembling /dev/sdb4 for the 4th partition on the 2nd disk. ++ NVMe devices have a syntax resembling /dev/nvme0n2p4 for the 4th partition on the 2nd disk. ++ """ ++ if '/dev/nvme' in dev: ++ """ ++ NVMe ++ """ ++ part = next(re.finditer(r'p\d+$', dev)).group(0) ++ dev = dev[:-len(part)] ++ part = part[1:] ++ else: ++ """ ++ Non-NVMe (SCSI, ATA, etc) ++ """ ++ part = next(re.finditer(r'\d+$', dev)).group(0) ++ dev = dev[:-len(part)] ++ return [dev, part]; ++ ++ with open('/etc/system-release', 'r') as sr: ++ release_line = next(line for line in sr if 'release' in line) ++ distro = release_line.split(' release ', 1)[0] ++ ++ efi_bootentry_label = distro ++ distro_dir = dirname.get(distro, 'default') ++ shim_filename = efi_shimname_dict.get(api.current_actor().configuration.architecture, 'shimx64.efi') ++ ++ shim_path = '/boot/efi/EFI/' + distro_dir + '/' + shim_filename ++ grub_cfg_path = '/boot/efi/EFI/' + distro_dir + '/grub.cfg' ++ bootmgr_path = '\\EFI\\' + distro_dir + '\\' + shim_filename ++ ++ has_efibootmgr = os.path.exists('/sbin/efibootmgr') ++ has_shim = os.path.exists(shim_path) ++ has_grub_cfg = os.path.exists(grub_cfg_path) ++ ++ if not ff: ++ raise StopActorExecutionError( ++ 'Could not identify system firmware', ++ details={'details': 'Actor did not receive FirmwareFacts message.'} ++ ) ++ ++ if not has_efibootmgr: ++ return ++ ++ for fact in self.consume(FirmwareFacts): ++ if fact.firmware == 'efi': ++ is_system_efi = True ++ break ++ ++ if is_system_efi and has_shim: ++ efidevlist = [] ++ with open('/proc/mounts', 'r') as fp: ++ for line in fp: ++ if '/boot/efi' in line: ++ efidevpath = line.split(' ', 1)[0] ++ efidevpart = efidevpath.split('/')[-1] ++ if os.path.exists('/proc/mdstat'): ++ with open('/proc/mdstat', 'r') as mds: ++ for line in mds: ++ if line.startswith(efidevpart): ++ mddev = line.split(' ') ++ for md in mddev: ++ if '[' in md: ++ efimd = md.split('[', 1)[0] ++ efidp = efidevpath.replace(efidevpart, efimd) ++ efidevlist.append(efidp) ++ if len(efidevlist) == 0: ++ efidevlist.append(efidevpath) ++ for devpath in efidevlist: ++ efidev, efipart = devparts(devpath) ++ run(['/sbin/efibootmgr', '-c', '-d', efidev, '-p', efipart, '-l', bootmgr_path, '-L', efi_bootentry_label]) ++ ++ if not has_grub_cfg: ++ run(['/sbin/grub2-mkconfig', '-o', grub_cfg_path]) +diff --git a/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py b/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py +index 5ccdb35b..b5002ba0 100644 +--- a/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py ++++ b/repos/system_upgrade/common/actors/filterrpmtransactionevents/actor.py +@@ -32,6 +32,7 @@ class FilterRpmTransactionTasks(Actor): + to_remove = set() + to_keep = set() + to_upgrade = set() ++ to_reinstall = set() + modules_to_enable = {} + modules_to_reset = {} + for event in self.consume(RpmTransactionTasks, PESRpmTransactionTasks): +@@ -39,13 +40,14 @@ class FilterRpmTransactionTasks(Actor): + to_install.update(event.to_install) + to_remove.update(installed_pkgs.intersection(event.to_remove)) + to_keep.update(installed_pkgs.intersection(event.to_keep)) ++ to_reinstall.update(installed_pkgs.intersection(event.to_reinstall)) + modules_to_enable.update({'{}:{}'.format(m.name, m.stream): m for m in event.modules_to_enable}) + modules_to_reset.update({'{}:{}'.format(m.name, m.stream): m for m in event.modules_to_reset}) + + to_remove.difference_update(to_keep) + + # run upgrade for the rest of RH signed pkgs which we do not have rule for +- to_upgrade = installed_pkgs - (to_install | to_remove) ++ to_upgrade = installed_pkgs - (to_install | to_remove | to_reinstall) + + self.produce(FilteredRpmTransactionTasks( + local_rpms=list(local_rpms), +@@ -53,5 +55,6 @@ class FilterRpmTransactionTasks(Actor): + to_remove=list(to_remove), + to_keep=list(to_keep), + to_upgrade=list(to_upgrade), ++ to_reinstall=list(to_reinstall), + modules_to_reset=list(modules_to_reset.values()), + modules_to_enable=list(modules_to_enable.values()))) +diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py +index 9e213f64..52cfe14f 100644 +--- a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py ++++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py +@@ -47,15 +47,20 @@ def get_os_release(path): + :return: `OSRelease` model if the file can be parsed + :raises: `IOError` + """ ++ os_version = '.'.join(platform.dist()[1].split('.')[:2]) + try: + with open(path) as f: + data = dict(l.strip().split('=', 1) for l in f.readlines() if '=' in l) ++ release_id = data.get('ID', '').strip('"') ++ version_id = data.get('VERSION_ID', '').strip('"') ++ if release_id == 'centos' and '.' not in os_version: ++ os_version = "{}.999".format(version_id) + return OSRelease( +- release_id=data.get('ID', '').strip('"'), ++ release_id=release_id, + name=data.get('NAME', '').strip('"'), + pretty_name=data.get('PRETTY_NAME', '').strip('"'), + version=data.get('VERSION', '').strip('"'), +- version_id=data.get('VERSION_ID', '').strip('"'), ++ version_id=os_version, + variant=data.get('VARIANT', '').strip('"') or None, + variant_id=data.get('VARIANT_ID', '').strip('"') or None + ) +diff --git a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py +index 32e4527b..48633a3e 100644 +--- a/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py ++++ b/repos/system_upgrade/common/actors/missinggpgkeysinhibitor/libraries/missinggpgkey.py +@@ -152,11 +152,11 @@ def _report(title, summary, keys, inhibitor=False): + ) + hint = ( + 'Check the path to the listed GPG keys is correct, the keys are valid and' +- ' import them into the host RPM DB or store them inside the {} directory' ++ ' import them into the host RPM DB or store them inside on of the {} directories' + ' prior the upgrade.' + ' If you want to proceed the in-place upgrade without checking any RPM' + ' signatures, execute leapp with the `--nogpgcheck` option.' +- .format(get_path_to_gpg_certs()) ++ .format(','.format(_get_path_to_gpg_certs())) + ) + groups = [reporting.Groups.REPOSITORY] + if inhibitor: +@@ -188,7 +188,7 @@ def _report_missing_keys(keys): + summary = ( + 'Some of the target repositories require GPG keys that are not installed' + ' in the current RPM DB or are not stored in the {trust_dir} directory.' +- .format(trust_dir=get_path_to_gpg_certs()) ++ .format(trust_dir=','.join(_get_path_to_gpg_certs())) + ) + _report('Detected unknown GPG keys for target system repositories', summary, keys, True) + +@@ -262,11 +262,12 @@ def _report_repos_missing_keys(repos): + + + def register_dnfworkaround(): +- api.produce(DNFWorkaround( +- display_name='import trusted gpg keys to RPM DB', +- script_path=api.current_actor().get_common_tool_path('importrpmgpgkeys'), +- script_args=[get_path_to_gpg_certs()], +- )) ++ for trust_certs_dir in get_path_to_gpg_certs(): ++ api.produce(DNFWorkaround( ++ display_name='import trusted gpg keys to RPM DB', ++ script_path=api.current_actor().get_common_tool_path('importrpmgpgkeys'), ++ script_args=[trust_certs_dir], ++ )) + + + @suppress_deprecation(TMPTargetRepositoriesFacts) +diff --git a/repos/system_upgrade/common/actors/peseventsscanner/actor.py b/repos/system_upgrade/common/actors/peseventsscanner/actor.py +index f801f1a1..cb911471 100644 +--- a/repos/system_upgrade/common/actors/peseventsscanner/actor.py ++++ b/repos/system_upgrade/common/actors/peseventsscanner/actor.py +@@ -10,7 +10,8 @@ from leapp.models import ( + RepositoriesMapping, + RepositoriesSetupTasks, + RHUIInfo, +- RpmTransactionTasks ++ RpmTransactionTasks, ++ ActiveVendorList, + ) + from leapp.reporting import Report + from leapp.tags import FactsPhaseTag, IPUWorkflowTag +@@ -33,6 +34,7 @@ class PesEventsScanner(Actor): + RepositoriesMapping, + RHUIInfo, + RpmTransactionTasks, ++ ActiveVendorList, + ) + produces = (ConsumedDataAsset, PESRpmTransactionTasks, RepositoriesSetupTasks, Report) + tags = (IPUWorkflowTag, FactsPhaseTag) +diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_event_parsing.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_event_parsing.py +index f24dda68..7ee5d016 100644 +--- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_event_parsing.py ++++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_event_parsing.py +@@ -58,6 +58,7 @@ class Action(IntEnum): + MERGED = 5 + MOVED = 6 + RENAMED = 7 ++ REINSTALLED = 8 + + + def get_pes_events(pes_json_directory, pes_json_filename): +@@ -72,13 +73,14 @@ def get_pes_events(pes_json_directory, pes_json_filename): + # a case as we have no work to do in such a case here. + events_data = fetch.load_data_asset(api.current_actor(), + pes_json_filename, ++ asset_directory=pes_json_directory, + asset_fulltext_name='PES events file', + docs_url='', + docs_title='') + if not events_data: + return None + +- if not events_data.get('packageinfo'): ++ if events_data.get('packageinfo') is None: + raise ValueError('Found PES data with invalid structure') + + all_events = list(chain(*[parse_entry(entry) for entry in events_data['packageinfo']])) +diff --git a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py +index f5cb2613..10e27220 100644 +--- a/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py ++++ b/repos/system_upgrade/common/actors/peseventsscanner/libraries/pes_events_scanner.py +@@ -1,5 +1,6 @@ + from collections import defaultdict, namedtuple + from functools import partial ++import os + + from leapp import reporting + from leapp.exceptions import StopActorExecutionError +@@ -7,6 +8,7 @@ from leapp.libraries.actor import peseventsscanner_repomap + from leapp.libraries.actor.pes_event_parsing import Action, get_pes_events, Package + from leapp.libraries.common import rpms + from leapp.libraries.common.config import version ++from leapp.libraries.common.repomaputils import combine_repomap_messages + from leapp.libraries.stdlib import api + from leapp.libraries.stdlib.config import is_verbose + from leapp.models import ( +@@ -20,7 +22,8 @@ from leapp.models import ( + RepositoriesMapping, + RepositoriesSetupTasks, + RHUIInfo, +- RpmTransactionTasks ++ RpmTransactionTasks, ++ ActiveVendorList, + ) + + SKIPPED_PKGS_MSG = ( +@@ -31,8 +34,9 @@ SKIPPED_PKGS_MSG = ( + 'for details.\nThe list of these packages:' + ) + ++VENDORS_DIR = "/etc/leapp/files/vendors.d" + +-TransactionConfiguration = namedtuple('TransactionConfiguration', ('to_install', 'to_remove', 'to_keep')) ++TransactionConfiguration = namedtuple('TransactionConfiguration', ('to_install', 'to_remove', 'to_keep', 'to_reinstall')) + + + def get_cloud_provider_name(cloud_provider_variant): +@@ -83,7 +87,7 @@ def get_transaction_configuration(): + These configuration files have higher priority than PES data. + :return: RpmTransactionTasks model instance + """ +- transaction_configuration = TransactionConfiguration(to_install=[], to_remove=[], to_keep=[]) ++ transaction_configuration = TransactionConfiguration(to_install=[], to_remove=[], to_keep=[], to_reinstall=[]) + + _Pkg = partial(Package, repository=None, modulestream=None) + +@@ -91,6 +95,7 @@ def get_transaction_configuration(): + transaction_configuration.to_install.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_install) + transaction_configuration.to_remove.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_remove) + transaction_configuration.to_keep.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_keep) ++ transaction_configuration.to_reinstall.extend(_Pkg(name=pkg_name) for pkg_name in tasks.to_reinstall) + return transaction_configuration + + +@@ -130,6 +135,7 @@ def compute_pkg_changes_between_consequent_releases(source_installed_pkgs, + logger = api.current_logger() + # Start with the installed packages and modify the set according to release events + target_pkgs = set(source_installed_pkgs) ++ pkgs_to_reinstall = set() + + release_events = [e for e in events if e.to_release == release] + +@@ -173,9 +179,12 @@ def compute_pkg_changes_between_consequent_releases(source_installed_pkgs, + target_pkgs = target_pkgs.difference(event.out_pkgs) + target_pkgs = target_pkgs.union(event.out_pkgs) + ++ if (event.action == Action.REINSTALLED and is_any_in_pkg_present): ++ pkgs_to_reinstall = pkgs_to_reinstall.union(event.in_pkgs) ++ + pkgs_to_demodularize = pkgs_to_demodularize.difference(event.in_pkgs) + +- return (target_pkgs, pkgs_to_demodularize) ++ return (target_pkgs, pkgs_to_demodularize, pkgs_to_reinstall) + + + def remove_undesired_events(events, relevant_to_releases): +@@ -241,15 +250,17 @@ def compute_packages_on_target_system(source_pkgs, events, releases): + did_processing_cross_major_version = True + pkgs_to_demodularize = {pkg for pkg in target_pkgs if pkg.modulestream} + +- target_pkgs, pkgs_to_demodularize = compute_pkg_changes_between_consequent_releases(target_pkgs, events, +- release, seen_pkgs, +- pkgs_to_demodularize) ++ target_pkgs, pkgs_to_demodularize, pkgs_to_reinstall = compute_pkg_changes_between_consequent_releases( ++ target_pkgs, events, ++ release, seen_pkgs, ++ pkgs_to_demodularize ++ ) + seen_pkgs = seen_pkgs.union(target_pkgs) + + demodularized_pkgs = {Package(pkg.name, pkg.repository, None) for pkg in pkgs_to_demodularize} + demodularized_target_pkgs = target_pkgs.difference(pkgs_to_demodularize).union(demodularized_pkgs) + +- return (demodularized_target_pkgs, pkgs_to_demodularize) ++ return (demodularized_target_pkgs, pkgs_to_demodularize, pkgs_to_reinstall) + + + def compute_rpm_tasks_from_pkg_set_diff(source_pkgs, target_pkgs, pkgs_to_demodularize): +@@ -353,15 +364,13 @@ def get_pesid_to_repoid_map(target_pesids): + :return: Dictionary mapping the target_pesids to their corresponding repoid + """ + +- repositories_map_msgs = api.consume(RepositoriesMapping) +- repositories_map_msg = next(repositories_map_msgs, None) +- if list(repositories_map_msgs): +- api.current_logger().warning('Unexpectedly received more than one RepositoriesMapping message.') +- if not repositories_map_msg: ++ repositories_map_msgs = list(api.consume(RepositoriesMapping)) ++ if not repositories_map_msgs: + raise StopActorExecutionError( + 'Cannot parse RepositoriesMapping data properly', + details={'Problem': 'Did not receive a message with mapped repositories'} + ) ++ repositories_map_msg = combine_repomap_messages(repositories_map_msgs) + + rhui_info = next(api.consume(RHUIInfo), None) + cloud_provider = rhui_info.provider if rhui_info else '' +@@ -507,6 +516,19 @@ def process(): + if not events: + return + ++ active_vendors = [] ++ for vendor_list in api.consume(ActiveVendorList): ++ active_vendors.extend(vendor_list.data) ++ ++ pes_json_suffix = "_pes.json" ++ if os.path.isdir(VENDORS_DIR): ++ vendor_pesfiles = list(filter(lambda vfile: pes_json_suffix in vfile, os.listdir(VENDORS_DIR))) ++ ++ for pesfile in vendor_pesfiles: ++ if pesfile[:-len(pes_json_suffix)] in active_vendors: ++ vendor_events = get_pes_events(VENDORS_DIR, pesfile) ++ events.extend(vendor_events) ++ + releases = get_relevant_releases(events) + source_pkgs = get_installed_pkgs() + source_pkgs = apply_transaction_configuration(source_pkgs) +@@ -519,7 +541,7 @@ def process(): + events = remove_undesired_events(events, releases) + + # Apply events - compute what packages should the target system have +- target_pkgs, pkgs_to_demodularize = compute_packages_on_target_system(source_pkgs, events, releases) ++ target_pkgs, pkgs_to_demodularize, pkgs_to_reinstall = compute_packages_on_target_system(source_pkgs, events, releases) + + # Packages coming out of the events have PESID as their repository, however, we need real repoid + target_pkgs = replace_pesids_with_repoids_in_packages(target_pkgs, repoids_of_source_pkgs) +@@ -535,4 +557,5 @@ def process(): + # Compare the packages on source system and the computed packages on target system and determine what to install + rpm_tasks = compute_rpm_tasks_from_pkg_set_diff(source_pkgs, target_pkgs, pkgs_to_demodularize) + if rpm_tasks: ++ rpm_tasks.to_reinstall = sorted(pkgs_to_reinstall) + api.produce(rpm_tasks) +diff --git a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py +index 43ac1fc4..62aefaf4 100644 +--- a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py ++++ b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/libraries/rpmtransactionconfigtaskscollector.py +@@ -18,21 +18,37 @@ def load_tasks_file(path, logger): + return [] + + ++def filter_out(installed_rpm_names, to_filter, debug_msg): ++ # These are the packages that aren't installed on the system. ++ filtered_ok = [pkg for pkg in to_filter if pkg not in installed_rpm_names] ++ ++ # And these ones are the ones that are. ++ filtered_out = list(set(to_filter) - set(filtered_ok)) ++ if filtered_out: ++ api.current_logger().debug( ++ debug_msg + ++ '\n- ' + '\n- '.join(filtered_out) ++ ) ++ # We may want to use either of the two sets. ++ return filtered_ok, filtered_out ++ ++ + def load_tasks(base_dir, logger): + # Loads configuration files to_install, to_keep, and to_remove from the given base directory + rpms = next(api.consume(DistributionSignedRPM)) + rpm_names = [rpm.name for rpm in rpms.items] ++ + to_install = load_tasks_file(os.path.join(base_dir, 'to_install'), logger) ++ install_debug_msg = 'The following packages from "to_install" file will be ignored as they are already installed:' + # we do not want to put into rpm transaction what is already installed (it will go to "to_upgrade" bucket) +- to_install_filtered = [pkg for pkg in to_install if pkg not in rpm_names] ++ to_install_filtered, _ = filter_out(rpm_names, to_install, install_debug_msg) + +- filtered = set(to_install) - set(to_install_filtered) +- if filtered: +- api.current_logger().debug( +- 'The following packages from "to_install" file will be ignored as they are already installed:' +- '\n- ' + '\n- '.join(filtered)) ++ to_reinstall = load_tasks_file(os.path.join(base_dir, 'to_reinstall'), logger) ++ reinstall_debug_msg = 'The following packages from "to_reinstall" file will be ignored as they are not installed:' ++ _, to_reinstall_filtered = filter_out(rpm_names, to_reinstall, reinstall_debug_msg) + + return RpmTransactionTasks( + to_install=to_install_filtered, ++ to_reinstall=to_reinstall_filtered, + to_keep=load_tasks_file(os.path.join(base_dir, 'to_keep'), logger), + to_remove=load_tasks_file(os.path.join(base_dir, 'to_remove'), logger)) +diff --git a/repos/system_upgrade/common/actors/scanvendorrepofiles/actor.py b/repos/system_upgrade/common/actors/scanvendorrepofiles/actor.py +new file mode 100644 +index 00000000..a5e481cb +--- /dev/null ++++ b/repos/system_upgrade/common/actors/scanvendorrepofiles/actor.py +@@ -0,0 +1,26 @@ ++from leapp.actors import Actor ++from leapp.libraries.actor import scanvendorrepofiles ++from leapp.models import ( ++ CustomTargetRepositoryFile, ++ ActiveVendorList, ++ VendorCustomTargetRepositoryList, ++) ++from leapp.tags import FactsPhaseTag, IPUWorkflowTag ++ ++ ++class ScanVendorRepofiles(Actor): ++ """ ++ Load and produce custom repository data from vendor-provided files. ++ Only those vendors whose source system repoids were found on the system will be included. ++ """ ++ ++ name = "scan_vendor_repofiles" ++ consumes = ActiveVendorList ++ produces = ( ++ CustomTargetRepositoryFile, ++ VendorCustomTargetRepositoryList, ++ ) ++ tags = (FactsPhaseTag, IPUWorkflowTag) ++ ++ def process(self): ++ scanvendorrepofiles.process() +diff --git a/repos/system_upgrade/common/actors/scanvendorrepofiles/libraries/scanvendorrepofiles.py b/repos/system_upgrade/common/actors/scanvendorrepofiles/libraries/scanvendorrepofiles.py +new file mode 100644 +index 00000000..84392101 +--- /dev/null ++++ b/repos/system_upgrade/common/actors/scanvendorrepofiles/libraries/scanvendorrepofiles.py +@@ -0,0 +1,72 @@ ++import os ++ ++from leapp.libraries.common import repofileutils ++from leapp.libraries.stdlib import api ++from leapp.models import ( ++ CustomTargetRepository, ++ CustomTargetRepositoryFile, ++ ActiveVendorList, ++ VendorCustomTargetRepositoryList, ++) ++ ++ ++VENDORS_DIR = "/etc/leapp/files/vendors.d/" ++REPOFILE_SUFFIX = ".repo" ++ ++ ++def process(): ++ """ ++ Produce CustomTargetRepository msgs for the vendor repo files inside the ++ . ++ ++ The CustomTargetRepository messages are produced only if a "from" vendor repository ++ listed indide its map matched one of the repositories active on the system. ++ """ ++ if not os.path.isdir(VENDORS_DIR): ++ api.current_logger().debug( ++ "The {} directory doesn't exist. Nothing to do.".format(VENDORS_DIR) ++ ) ++ return ++ ++ for repofile_name in os.listdir(VENDORS_DIR): ++ if not repofile_name.endswith(REPOFILE_SUFFIX): ++ continue ++ # Cut the .repo part to get only the name. ++ vendor_name = repofile_name[:-5] ++ ++ active_vendors = [] ++ for vendor_list in api.consume(ActiveVendorList): ++ active_vendors.extend(vendor_list.data) ++ ++ api.current_logger().debug("Active vendor list: {}".format(active_vendors)) ++ ++ if vendor_name not in active_vendors: ++ api.current_logger().debug( ++ "Vendor {} not in active list, skipping".format(vendor_name) ++ ) ++ continue ++ ++ full_repo_path = os.path.join(VENDORS_DIR, repofile_name) ++ parsed_repofile = repofileutils.parse_repofile(full_repo_path) ++ api.current_logger().debug( ++ "Vendor {} found in active list, processing file {}".format(vendor_name, repofile_name) ++ ) ++ ++ api.produce(CustomTargetRepositoryFile(file=full_repo_path)) ++ ++ custom_vendor_repos = [ ++ CustomTargetRepository( ++ repoid=repo.repoid, ++ name=repo.name, ++ baseurl=repo.baseurl, ++ enabled=repo.enabled, ++ ) for repo in parsed_repofile.data ++ ] ++ ++ api.produce( ++ VendorCustomTargetRepositoryList(vendor=vendor_name, repos=custom_vendor_repos) ++ ) ++ ++ api.current_logger().info( ++ "The {} directory exists, vendor repositories loaded.".format(VENDORS_DIR) ++ ) +diff --git a/repos/system_upgrade/common/actors/scanvendorrepofiles/tests/test_scanvendorrepofiles.py b/repos/system_upgrade/common/actors/scanvendorrepofiles/tests/test_scanvendorrepofiles.py +new file mode 100644 +index 00000000..cb5c7ab7 +--- /dev/null ++++ b/repos/system_upgrade/common/actors/scanvendorrepofiles/tests/test_scanvendorrepofiles.py +@@ -0,0 +1,131 @@ ++import os ++ ++from leapp.libraries.actor import scancustomrepofile ++from leapp.libraries.common import repofileutils ++from leapp.libraries.common.testutils import produce_mocked ++from leapp.libraries.stdlib import api ++ ++from leapp.models import (CustomTargetRepository, CustomTargetRepositoryFile, ++ RepositoryData, RepositoryFile) ++ ++ ++_REPODATA = [ ++ RepositoryData(repoid="repo1", name="repo1name", baseurl="repo1url", enabled=True), ++ RepositoryData(repoid="repo2", name="repo2name", baseurl="repo2url", enabled=False), ++ RepositoryData(repoid="repo3", name="repo3name", enabled=True), ++ RepositoryData(repoid="repo4", name="repo4name", mirrorlist="mirror4list", enabled=True), ++] ++ ++_CUSTOM_REPOS = [ ++ CustomTargetRepository(repoid="repo1", name="repo1name", baseurl="repo1url", enabled=True), ++ CustomTargetRepository(repoid="repo2", name="repo2name", baseurl="repo2url", enabled=False), ++ CustomTargetRepository(repoid="repo3", name="repo3name", baseurl=None, enabled=True), ++ CustomTargetRepository(repoid="repo4", name="repo4name", baseurl=None, enabled=True), ++] ++ ++_CUSTOM_REPO_FILE_MSG = CustomTargetRepositoryFile(file=scancustomrepofile.CUSTOM_REPO_PATH) ++ ++ ++_TESTING_REPODATA = [ ++ RepositoryData(repoid="repo1-stable", name="repo1name", baseurl="repo1url", enabled=True), ++ RepositoryData(repoid="repo2-testing", name="repo2name", baseurl="repo2url", enabled=False), ++ RepositoryData(repoid="repo3-stable", name="repo3name", enabled=False), ++ RepositoryData(repoid="repo4-testing", name="repo4name", mirrorlist="mirror4list", enabled=True), ++] ++ ++_TESTING_CUSTOM_REPOS_STABLE_TARGET = [ ++ CustomTargetRepository(repoid="repo1-stable", name="repo1name", baseurl="repo1url", enabled=True), ++ CustomTargetRepository(repoid="repo2-testing", name="repo2name", baseurl="repo2url", enabled=False), ++ CustomTargetRepository(repoid="repo3-stable", name="repo3name", baseurl=None, enabled=False), ++ CustomTargetRepository(repoid="repo4-testing", name="repo4name", baseurl=None, enabled=True), ++] ++ ++_TESTING_CUSTOM_REPOS_BETA_TARGET = [ ++ CustomTargetRepository(repoid="repo1-stable", name="repo1name", baseurl="repo1url", enabled=True), ++ CustomTargetRepository(repoid="repo2-testing", name="repo2name", baseurl="repo2url", enabled=True), ++ CustomTargetRepository(repoid="repo3-stable", name="repo3name", baseurl=None, enabled=False), ++ CustomTargetRepository(repoid="repo4-testing", name="repo4name", baseurl=None, enabled=True), ++] ++ ++_PROCESS_STABLE_TARGET = "stable" ++_PROCESS_BETA_TARGET = "beta" ++ ++ ++class LoggerMocked(object): ++ def __init__(self): ++ self.infomsg = None ++ self.debugmsg = None ++ ++ def info(self, msg): ++ self.infomsg = msg ++ ++ def debug(self, msg): ++ self.debugmsg = msg ++ ++ def __call__(self): ++ return self ++ ++ ++def test_no_repofile(monkeypatch): ++ monkeypatch.setattr(os.path, 'isfile', lambda dummy: False) ++ monkeypatch.setattr(api, 'produce', produce_mocked()) ++ monkeypatch.setattr(api, 'current_logger', LoggerMocked()) ++ scancustomrepofile.process() ++ msg = "The {} file doesn't exist. Nothing to do.".format(scancustomrepofile.CUSTOM_REPO_PATH) ++ assert api.current_logger.debugmsg == msg ++ assert not api.produce.called ++ ++ ++def test_valid_repofile_exists(monkeypatch): ++ def _mocked_parse_repofile(fpath): ++ return RepositoryFile(file=fpath, data=_REPODATA) ++ monkeypatch.setattr(os.path, 'isfile', lambda dummy: True) ++ monkeypatch.setattr(api, 'produce', produce_mocked()) ++ monkeypatch.setattr(repofileutils, 'parse_repofile', _mocked_parse_repofile) ++ monkeypatch.setattr(api, 'current_logger', LoggerMocked()) ++ scancustomrepofile.process() ++ msg = "The {} file exists, custom repositories loaded.".format(scancustomrepofile.CUSTOM_REPO_PATH) ++ assert api.current_logger.infomsg == msg ++ assert api.produce.called == len(_CUSTOM_REPOS) + 1 ++ assert _CUSTOM_REPO_FILE_MSG in api.produce.model_instances ++ for crepo in _CUSTOM_REPOS: ++ assert crepo in api.produce.model_instances ++ ++ ++def test_target_stable_repos(monkeypatch): ++ def _mocked_parse_repofile(fpath): ++ return RepositoryFile(file=fpath, data=_TESTING_REPODATA) ++ monkeypatch.setattr(os.path, 'isfile', lambda dummy: True) ++ monkeypatch.setattr(api, 'produce', produce_mocked()) ++ monkeypatch.setattr(repofileutils, 'parse_repofile', _mocked_parse_repofile) ++ ++ scancustomrepofile.process(_PROCESS_STABLE_TARGET) ++ assert api.produce.called == len(_TESTING_CUSTOM_REPOS_STABLE_TARGET) + 1 ++ for crepo in _TESTING_CUSTOM_REPOS_STABLE_TARGET: ++ assert crepo in api.produce.model_instances ++ ++ ++def test_target_beta_repos(monkeypatch): ++ def _mocked_parse_repofile(fpath): ++ return RepositoryFile(file=fpath, data=_TESTING_REPODATA) ++ monkeypatch.setattr(os.path, 'isfile', lambda dummy: True) ++ monkeypatch.setattr(api, 'produce', produce_mocked()) ++ monkeypatch.setattr(repofileutils, 'parse_repofile', _mocked_parse_repofile) ++ ++ scancustomrepofile.process(_PROCESS_BETA_TARGET) ++ assert api.produce.called == len(_TESTING_CUSTOM_REPOS_BETA_TARGET) + 1 ++ for crepo in _TESTING_CUSTOM_REPOS_BETA_TARGET: ++ assert crepo in api.produce.model_instances ++ ++ ++def test_empty_repofile_exists(monkeypatch): ++ def _mocked_parse_repofile(fpath): ++ return RepositoryFile(file=fpath, data=[]) ++ monkeypatch.setattr(os.path, 'isfile', lambda dummy: True) ++ monkeypatch.setattr(api, 'produce', produce_mocked()) ++ monkeypatch.setattr(repofileutils, 'parse_repofile', _mocked_parse_repofile) ++ monkeypatch.setattr(api, 'current_logger', LoggerMocked()) ++ scancustomrepofile.process() ++ msg = "The {} file exists, but is empty. Nothing to do.".format(scancustomrepofile.CUSTOM_REPO_PATH) ++ assert api.current_logger.infomsg == msg ++ assert not api.produce.called +diff --git a/repos/system_upgrade/common/actors/setuptargetrepos/actor.py b/repos/system_upgrade/common/actors/setuptargetrepos/actor.py +index 767fa00c..bc1d5bfa 100644 +--- a/repos/system_upgrade/common/actors/setuptargetrepos/actor.py ++++ b/repos/system_upgrade/common/actors/setuptargetrepos/actor.py +@@ -10,7 +10,8 @@ from leapp.models import ( + RHUIInfo, + SkippedRepositories, + TargetRepositories, +- UsedRepositories ++ UsedRepositories, ++ VendorCustomTargetRepositoryList + ) + from leapp.tags import FactsPhaseTag, IPUWorkflowTag + +@@ -32,7 +33,8 @@ class SetupTargetRepos(Actor): + RepositoriesFacts, + RepositoriesBlacklisted, + RHUIInfo, +- UsedRepositories) ++ UsedRepositories, ++ VendorCustomTargetRepositoryList) + produces = (TargetRepositories, SkippedRepositories) + tags = (IPUWorkflowTag, FactsPhaseTag) + +diff --git a/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py b/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py +index a6073aa3..dfa565c1 100644 +--- a/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py ++++ b/repos/system_upgrade/common/actors/setuptargetrepos/libraries/setuptargetrepos.py +@@ -1,6 +1,7 @@ + + from leapp.libraries.actor import setuptargetrepos_repomap + from leapp.libraries.common.config.version import get_source_major_version, get_source_version, get_target_version ++from leapp.libraries.common.repomaputils import combine_repomap_messages + from leapp.libraries.stdlib import api + from leapp.models import ( + CustomTargetRepository, +@@ -13,7 +14,8 @@ from leapp.models import ( + RHUIInfo, + SkippedRepositories, + TargetRepositories, +- UsedRepositories ++ UsedRepositories, ++ VendorCustomTargetRepositoryList + ) + + RHUI_CLIENT_REPOIDS_RHEL88_TO_RHEL810 = { +@@ -80,13 +82,62 @@ def _get_mapped_repoids(repomap, src_repoids): + return mapped_repoids + + ++def _get_vendor_custom_repos(enabled_repos, mapping_list): ++ # Look at what source repos from the vendor mapping were enabled. ++ # If any of them are in beta, include vendor's custom repos in the list. ++ # Otherwise skip them. ++ ++ result = [] ++ ++ # Build a dict of vendor mappings for easy lookup. ++ map_dict = {mapping.vendor: mapping for mapping in mapping_list if mapping.vendor} ++ ++ for vendor_repolist in api.consume(VendorCustomTargetRepositoryList): ++ vendor_repomap = map_dict[vendor_repolist.vendor] ++ ++ # Find the beta channel repositories for the vendor. ++ beta_repos = [ ++ x.repoid for x in vendor_repomap.repositories if x.channel == "beta" ++ ] ++ api.current_logger().debug( ++ "Vendor {} beta repos: {}".format(vendor_repolist.vendor, beta_repos) ++ ) ++ ++ # Are any of the beta repos present and enabled on the system? ++ if any(rep in beta_repos for rep in enabled_repos): ++ # If so, use all repos including beta in the upgrade. ++ vendor_repos = vendor_repolist.repos ++ else: ++ # Otherwise filter beta repos out. ++ vendor_repos = [repo for repo in vendor_repolist.repos if repo.repoid not in beta_repos] ++ ++ result.extend([CustomTargetRepository( ++ repoid=repo.repoid, ++ name=repo.name, ++ baseurl=repo.baseurl, ++ enabled=repo.enabled, ++ ) for repo in vendor_repos]) ++ ++ return result ++ ++ + def process(): + # Load relevant data from messages + used_repoids_dict = _get_used_repo_dict() + enabled_repoids = _get_enabled_repoids() + excluded_repoids = _get_blacklisted_repoids() ++ ++ # Remember that we can't just grab one message, each vendor can have its own mapping. ++ repo_mapping_list = list(api.consume(RepositoriesMapping)) ++ + custom_repos = _get_custom_target_repos() + repoids_from_installed_packages = _get_repoids_from_installed_packages() ++ vendor_repos = _get_vendor_custom_repos(enabled_repoids, repo_mapping_list) ++ custom_repos.extend(vendor_repos) ++ ++ api.current_logger().debug( ++ "Vendor repolist: {}".format([repo.repoid for repo in vendor_repos]) ++ ) + + # Setup repomap handler + repo_mappig_msg = next(api.consume(RepositoriesMapping), RepositoriesMapping()) +@@ -168,6 +219,10 @@ def process(): + custom_repos = [repo for repo in custom_repos if repo.repoid not in excluded_repoids] + custom_repos = sorted(custom_repos, key=lambda x: x.repoid) + ++ api.current_logger().debug( ++ "Final repolist: {}".format([repo.repoid for repo in custom_repos]) ++ ) ++ + # produce message about skipped repositories + enabled_repoids_with_mapping = _get_mapped_repoids(repomap, enabled_repoids) + skipped_repoids = enabled_repoids & set(used_repoids_dict.keys()) - enabled_repoids_with_mapping +diff --git a/repos/system_upgrade/common/actors/systemfacts/actor.py b/repos/system_upgrade/common/actors/systemfacts/actor.py +index 59b12c87..85d4a09e 100644 +--- a/repos/system_upgrade/common/actors/systemfacts/actor.py ++++ b/repos/system_upgrade/common/actors/systemfacts/actor.py +@@ -47,7 +47,7 @@ class SystemFactsActor(Actor): + GrubCfgBios, + Report + ) +- tags = (IPUWorkflowTag, FactsPhaseTag,) ++ tags = (IPUWorkflowTag, FactsPhaseTag.Before,) + + def process(self): + self.produce(systemfacts.get_sysctls_status()) +diff --git a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +index cd2d7d6e..ae5bdca5 100644 +--- a/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py ++++ b/repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py +@@ -152,9 +152,10 @@ def _import_gpg_keys(context, install_root_dir, target_major_version): + # Import the RHEL X+1 GPG key to be able to verify the installation of initial packages + try: + # Import also any other keys provided by the customer in the same directory +- for certname in os.listdir(certs_path): +- cmd = ['rpm', '--root', install_root_dir, '--import', os.path.join(certs_path, certname)] +- context.call(cmd, callback_raw=utils.logging_handler) ++ for trusted_dir in certs_path: ++ for certname in os.listdir(trusted_dir): ++ cmd = ['rpm', '--root', install_root_dir, '--import', os.path.join(trusted_dir, certname)] ++ context.call(cmd, callback_raw=utils.logging_handler) + except CalledProcessError as exc: + raise StopActorExecutionError( + message=( +@@ -629,6 +630,7 @@ def _prep_repository_access(context, target_userspace): + run(["chroot", target_userspace, "/bin/bash", "-c", "su - -c update-ca-trust"]) + + if not rhsm.skip_rhsm(): ++ _copy_certificates(context, target_userspace) + run(['rm', '-rf', os.path.join(target_etc, 'rhsm')]) + context.copytree_from('/etc/rhsm', os.path.join(target_etc, 'rhsm')) + +diff --git a/repos/system_upgrade/common/actors/trustedgpgkeysscanner/libraries/trustedgpgkeys.py b/repos/system_upgrade/common/actors/trustedgpgkeysscanner/libraries/trustedgpgkeys.py +index 6377f767..4c5420f6 100644 +--- a/repos/system_upgrade/common/actors/trustedgpgkeysscanner/libraries/trustedgpgkeys.py ++++ b/repos/system_upgrade/common/actors/trustedgpgkeysscanner/libraries/trustedgpgkeys.py +@@ -13,13 +13,14 @@ def _get_pubkeys(installed_rpms): + pubkeys = get_pubkeys_from_rpms(installed_rpms) + db_pubkeys = [key.fingerprint for key in pubkeys] + certs_path = get_path_to_gpg_certs() +- for certname in os.listdir(certs_path): +- key_file = os.path.join(certs_path, certname) +- fps = get_gpg_fp_from_file(key_file) +- for fp in fps: +- if fp not in db_pubkeys: +- pubkeys.append(GpgKey(fingerprint=fp, rpmdb=False, filename=key_file)) +- db_pubkeys += fp ++ for trusted_dir in certs_path: ++ for certname in os.listdir(trusted_dir): ++ key_file = os.path.join(trusted_dir, certname) ++ fps = get_gpg_fp_from_file(key_file) ++ for fp in fps: ++ if fp not in db_pubkeys: ++ pubkeys.append(GpgKey(fingerprint=fp, rpmdb=False, filename=key_file)) ++ db_pubkeys += fp + return pubkeys + + +diff --git a/repos/system_upgrade/common/actors/vendorreposignaturescanner/actor.py b/repos/system_upgrade/common/actors/vendorreposignaturescanner/actor.py +new file mode 100644 +index 00000000..dbf86974 +--- /dev/null ++++ b/repos/system_upgrade/common/actors/vendorreposignaturescanner/actor.py +@@ -0,0 +1,72 @@ ++import os ++ ++from leapp.actors import Actor ++from leapp.models import VendorSignatures, ActiveVendorList ++from leapp.tags import FactsPhaseTag, IPUWorkflowTag ++ ++ ++VENDORS_DIR = "/etc/leapp/files/vendors.d/" ++SIGFILE_SUFFIX = ".sigs" ++ ++ ++class VendorRepoSignatureScanner(Actor): ++ """ ++ Produce VendorSignatures messages for the vendor signature files inside the ++ . ++ These messages are used to extend the list of pakcages Leapp will consider ++ signed and will attempt to upgrade. ++ ++ The messages are produced only if a "from" vendor repository ++ listed indide its map matched one of the repositories active on the system. ++ """ ++ ++ name = 'vendor_repo_signature_scanner' ++ consumes = (ActiveVendorList) ++ produces = (VendorSignatures) ++ tags = (IPUWorkflowTag, FactsPhaseTag.Before) ++ ++ def process(self): ++ if not os.path.isdir(VENDORS_DIR): ++ self.log.debug( ++ "The {} directory doesn't exist. Nothing to do.".format(VENDORS_DIR) ++ ) ++ return ++ ++ active_vendors = [] ++ for vendor_list in self.consume(ActiveVendorList): ++ active_vendors.extend(vendor_list.data) ++ ++ self.log.debug( ++ "Active vendor list: {}".format(active_vendors) ++ ) ++ ++ for sigfile_name in os.listdir(VENDORS_DIR): ++ if not sigfile_name.endswith(SIGFILE_SUFFIX): ++ continue ++ # Cut the suffix part to get only the name. ++ vendor_name = sigfile_name[:-5] ++ ++ if vendor_name not in active_vendors: ++ self.log.debug( ++ "Vendor {} not in active list, skipping".format(vendor_name) ++ ) ++ continue ++ ++ self.log.debug( ++ "Vendor {} found in active list, processing file {}".format(vendor_name, sigfile_name) ++ ) ++ ++ full_sigfile_path = os.path.join(VENDORS_DIR, sigfile_name) ++ with open(full_sigfile_path) as f: ++ signatures = [line for line in f.read().splitlines() if line] ++ ++ self.produce( ++ VendorSignatures( ++ vendor=vendor_name, ++ sigs=signatures, ++ ) ++ ) ++ ++ self.log.info( ++ "The {} directory exists, vendor signatures loaded.".format(VENDORS_DIR) ++ ) +diff --git a/repos/system_upgrade/common/actors/vendorrepositoriesmapping/actor.py b/repos/system_upgrade/common/actors/vendorrepositoriesmapping/actor.py +new file mode 100644 +index 00000000..13256476 +--- /dev/null ++++ b/repos/system_upgrade/common/actors/vendorrepositoriesmapping/actor.py +@@ -0,0 +1,19 @@ ++from leapp.actors import Actor ++# from leapp.libraries.common.repomaputils import scan_vendor_repomaps, VENDOR_REPOMAP_DIR ++from leapp.libraries.actor.vendorrepositoriesmapping import scan_vendor_repomaps ++from leapp.models import VendorSourceRepos, RepositoriesMapping ++from leapp.tags import FactsPhaseTag, IPUWorkflowTag ++ ++ ++class VendorRepositoriesMapping(Actor): ++ """ ++ Scan the vendor repository mapping files and provide the data to other actors. ++ """ ++ ++ name = "vendor_repositories_mapping" ++ consumes = () ++ produces = (RepositoriesMapping, VendorSourceRepos,) ++ tags = (IPUWorkflowTag, FactsPhaseTag.Before) ++ ++ def process(self): ++ scan_vendor_repomaps() +diff --git a/repos/system_upgrade/common/actors/vendorrepositoriesmapping/libraries/vendorrepositoriesmapping.py b/repos/system_upgrade/common/actors/vendorrepositoriesmapping/libraries/vendorrepositoriesmapping.py +new file mode 100644 +index 00000000..6a41d4e5 +--- /dev/null ++++ b/repos/system_upgrade/common/actors/vendorrepositoriesmapping/libraries/vendorrepositoriesmapping.py +@@ -0,0 +1,92 @@ ++import os ++import json ++ ++from leapp.libraries.common import fetch ++from leapp.libraries.common.config.version import get_target_major_version, get_source_major_version ++from leapp.libraries.common.repomaputils import RepoMapData ++from leapp.libraries.stdlib import api ++from leapp.models import VendorSourceRepos, RepositoriesMapping ++from leapp.models.fields import ModelViolationError ++from leapp.exceptions import StopActorExecutionError ++ ++ ++VENDORS_DIR = "/etc/leapp/files/vendors.d" ++"""The folder containing the vendor repository mapping files.""" ++ ++ ++def inhibit_upgrade(msg): ++ raise StopActorExecutionError( ++ msg, ++ details={'hint': ('Read documentation at the following link for more' ++ ' information about how to retrieve the valid file:' ++ ' https://access.redhat.com/articles/3664871')}) ++ ++ ++def read_repofile(repofile, repodir): ++ try: ++ return json.loads(fetch.read_or_fetch(repofile, directory=repodir, allow_download=False)) ++ except ValueError: ++ # The data does not contain a valid json ++ inhibit_upgrade('The repository mapping file is invalid: file does not contain a valid JSON object.') ++ return None ++ ++ ++def read_repomap_file(repomap_file, read_repofile_func, vendor_name): ++ json_data = read_repofile_func(repomap_file, VENDORS_DIR) ++ try: ++ repomap_data = RepoMapData.load_from_dict(json_data) ++ ++ source_major = get_source_major_version() ++ target_major = get_target_major_version() ++ ++ api.produce(VendorSourceRepos( ++ vendor=vendor_name, ++ source_repoids=repomap_data.get_version_repoids(source_major) ++ )) ++ ++ mapping = repomap_data.get_mappings(source_major, target_major) ++ valid_major_versions = [source_major, target_major] ++ ++ api.produce(RepositoriesMapping( ++ mapping=mapping, ++ repositories=repomap_data.get_repositories(valid_major_versions), ++ vendor=vendor_name ++ )) ++ except ModelViolationError as err: ++ err_message = ( ++ 'The repository mapping file is invalid: ' ++ 'the JSON does not match required schema (wrong field type/value): {}. ' ++ 'Ensure that the current upgrade path is correct and is present in the mappings: {} -> {}' ++ .format(err, source_major, target_major) ++ ) ++ inhibit_upgrade(err_message) ++ except KeyError as err: ++ inhibit_upgrade( ++ 'The repository mapping file is invalid: the JSON is missing a required field: {}'.format(err)) ++ except ValueError as err: ++ # The error should contain enough information, so we do not need to clarify it further ++ inhibit_upgrade('The repository mapping file is invalid: {}'.format(err)) ++ ++ ++def scan_vendor_repomaps(read_repofile_func=read_repofile): ++ """ ++ Scan the repository mapping file and produce RepositoriesMapping msg. ++ ++ See the description of the actor for more details. ++ """ ++ ++ map_json_suffix = "_map.json" ++ if os.path.isdir(VENDORS_DIR): ++ vendor_mapfiles = list(filter(lambda vfile: map_json_suffix in vfile, os.listdir(VENDORS_DIR))) ++ ++ for mapfile in vendor_mapfiles: ++ read_repomap_file(mapfile, read_repofile_func, mapfile[:-len(map_json_suffix)]) ++ else: ++ api.current_logger().debug( ++ "The {} directory doesn't exist. Nothing to do.".format(VENDORS_DIR) ++ ) ++ # vendor_repomap_collection = scan_vendor_repomaps(VENDOR_REPOMAP_DIR) ++ # if vendor_repomap_collection: ++ # self.produce(vendor_repomap_collection) ++ # for repomap in vendor_repomap_collection.maps: ++ # self.produce(repomap) +diff --git a/repos/system_upgrade/common/files/distro/almalinux/gpg-signatures.json b/repos/system_upgrade/common/files/distro/almalinux/gpg-signatures.json +new file mode 100644 +index 00000000..51607273 +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/almalinux/gpg-signatures.json +@@ -0,0 +1,25 @@ ++{ ++ "keys": [ ++ "51d6647ec21ad6ea", ++ "d36cb86cb86b3716", ++ "2ae81e8aced7258b", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++ ++} +diff --git a/repos/system_upgrade/common/files/distro/centos/gpg-signatures.json b/repos/system_upgrade/common/files/distro/centos/gpg-signatures.json +index 547b13e7..61a00c03 100644 +--- a/repos/system_upgrade/common/files/distro/centos/gpg-signatures.json ++++ b/repos/system_upgrade/common/files/distro/centos/gpg-signatures.json +@@ -2,7 +2,23 @@ + "keys": [ + "24c6a8a7f4a80eb5", + "05b555b38483c65d", +- "4eb84e71f2ee9d55" ++ "4eb84e71f2ee9d55", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" + ], +- "obsoleted-keys": {} ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } + } +diff --git a/repos/system_upgrade/common/files/distro/cloudlinux/gpg-signatures.json b/repos/system_upgrade/common/files/distro/cloudlinux/gpg-signatures.json +new file mode 100644 +index 00000000..acad9006 +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/cloudlinux/gpg-signatures.json +@@ -0,0 +1,22 @@ ++{ ++ "keys": [ ++ "8c55a6628608cb71", ++ "d07bf2a08d50eb66", ++ "429785e181b961a5" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++} +diff --git a/repos/system_upgrade/common/files/distro/eurolinux/gpg-signatures.json b/repos/system_upgrade/common/files/distro/eurolinux/gpg-signatures.json +new file mode 100644 +index 00000000..958edead +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/eurolinux/gpg-signatures.json +@@ -0,0 +1,24 @@ ++{ ++ "keys": [ ++ "75c333f418cd4a9e", ++ "b413acad6275f250", ++ "f7ad3e5a1c9fd080", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++} +diff --git a/repos/system_upgrade/common/files/distro/ol/gpg-signatures.json b/repos/system_upgrade/common/files/distro/ol/gpg-signatures.json +new file mode 100644 +index 00000000..a53775cf +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/ol/gpg-signatures.json +@@ -0,0 +1,24 @@ ++{ ++ "keys": [ ++ "72f97b74ec551f03", ++ "82562ea9ad986da3", ++ "bc4d06a08d8b756f", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++} +diff --git a/repos/system_upgrade/common/files/distro/rhel/gpg-signatures.json b/repos/system_upgrade/common/files/distro/rhel/gpg-signatures.json +index 8a5471a8..dde34c9d 100644 +--- a/repos/system_upgrade/common/files/distro/rhel/gpg-signatures.json ++++ b/repos/system_upgrade/common/files/distro/rhel/gpg-signatures.json +@@ -4,7 +4,9 @@ + "5326810137017186", + "938a80caf21541eb", + "fd372689897da07a", +- "45689c882fa658e0" ++ "45689c882fa658e0", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" + ], + "obsoleted-keys": { + "7": [], +@@ -13,7 +15,12 @@ + "gpg-pubkey-37017186-45761324", + "gpg-pubkey-db42a60e-37ea5438" + ], +- "9": ["gpg-pubkey-d4082792-5b32db75"], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], + "10": [] + } + } +diff --git a/repos/system_upgrade/common/files/distro/rocky/gpg-signatures.json b/repos/system_upgrade/common/files/distro/rocky/gpg-signatures.json +new file mode 100644 +index 00000000..f1738e79 +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/rocky/gpg-signatures.json +@@ -0,0 +1,23 @@ ++{ ++ "keys": [ ++ "15af5dac6d745a60", ++ "702d426d350d275d", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++} +diff --git a/repos/system_upgrade/common/files/distro/scientific/gpg-signatures.json b/repos/system_upgrade/common/files/distro/scientific/gpg-signatures.json +new file mode 100644 +index 00000000..df764b53 +--- /dev/null ++++ b/repos/system_upgrade/common/files/distro/scientific/gpg-signatures.json +@@ -0,0 +1,22 @@ ++{ ++ "keys": [ ++ "b0b4183f192a7d7d", ++ "429785e181b961a5", ++ "d07bf2a08d50eb66" ++ ], ++ "obsoleted-keys": { ++ "7": [], ++ "8": [ ++ "gpg-pubkey-2fa658e0-45700c69", ++ "gpg-pubkey-37017186-45761324", ++ "gpg-pubkey-db42a60e-37ea5438" ++ ], ++ "9": [ ++ "gpg-pubkey-d4082792-5b32db75", ++ "gpg-pubkey-3abb34f8-5ffd890e", ++ "gpg-pubkey-6275f250-5e26cb2e", ++ "gpg-pubkey-73e3b907-6581b071" ++ ], ++ "10": [] ++ } ++} +diff --git a/repos/system_upgrade/common/files/rhel_upgrade.py b/repos/system_upgrade/common/files/rhel_upgrade.py +index 34f7b8f9..acba532c 100644 +--- a/repos/system_upgrade/common/files/rhel_upgrade.py ++++ b/repos/system_upgrade/common/files/rhel_upgrade.py +@@ -184,6 +184,7 @@ class RhelUpgradeCommand(dnf.cli.Command): + to_install = self.plugin_data['pkgs_info']['to_install'] + to_remove = self.plugin_data['pkgs_info']['to_remove'] + to_upgrade = self.plugin_data['pkgs_info']['to_upgrade'] ++ to_reinstall = self.plugin_data['pkgs_info']['to_reinstall'] + + # Modules to enable + self._process_entities(entities=[available_modules_to_enable], +@@ -196,6 +197,9 @@ class RhelUpgradeCommand(dnf.cli.Command): + self._process_entities(entities=to_install, op=self.base.install, entity_name='Package') + # Packages to be upgraded + self._process_entities(entities=to_upgrade, op=self.base.upgrade, entity_name='Package') ++ # Packages to be reinstalled ++ self._process_entities(entities=to_reinstall, op=self.base.reinstall, entity_name='Package') ++ + self.base.distro_sync() + + if self.opts.tid[0] == 'check': +diff --git a/repos/system_upgrade/common/libraries/config/version.py b/repos/system_upgrade/common/libraries/config/version.py +index 152d9112..c61a5581 100644 +--- a/repos/system_upgrade/common/libraries/config/version.py ++++ b/repos/system_upgrade/common/libraries/config/version.py +@@ -17,9 +17,9 @@ OP_MAP = { + # These will not be supported fo IPU 9 -> 10 + _SUPPORTED_VERSIONS = { + # Note: 'rhel-alt' is detected when on 'rhel' with kernel 4.x +- '7': {'rhel': ['7.9'], 'rhel-alt': [], 'rhel-saphana': ['7.9']}, +- '8': {'rhel': ['8.8', '8.10'], 'rhel-saphana': ['8.8', '8.10']}, +- '9': {'rhel': ['9.4', '9.5', '9.6'], 'rhel-saphana': ['9.4', '9.6']}, ++ '7': {'rhel': ['7.9'], 'rhel-alt': [], 'rhel-saphana': ['7.9'], 'centos': ['7.9'], 'eurolinux': ['7.9'], 'ol': ['7.9'], 'scientific': ['7.9']}, ++ '8': {'rhel': ['8.8', '8.10'], 'rhel-saphana': ['8.8', '8.10'], 'centos': ['8.5', '8.999'], 'almalinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'eurolinux': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'ol': ['8.6', '8.7', '8.8', '8.9', '8.10'], 'rocky': ['8.6', '8.7', '8.8', '8.9', '8.10']}, ++ '9': {'rhel': ['9.4', '9.5', '9.6'], 'rhel-saphana': ['9.4', '9.6'], 'centos': ['9.999'], 'almalinux': ['9.4', '9.5'], 'eurolinux': ['9.4', '9.5'], 'ol': ['9.4', '9.5'], 'rocky': ['9.4', '9.5']}, + } + + +diff --git a/repos/system_upgrade/common/libraries/distro.py b/repos/system_upgrade/common/libraries/distro.py +index 2ed5eacd..219d31d1 100644 +--- a/repos/system_upgrade/common/libraries/distro.py ++++ b/repos/system_upgrade/common/libraries/distro.py +@@ -3,6 +3,7 @@ import os + + from leapp.exceptions import StopActorExecutionError + from leapp.libraries.stdlib import api ++from leapp.models import VendorSignatures + + + def get_distribution_data(distribution): +@@ -11,8 +12,14 @@ def get_distribution_data(distribution): + distribution_config = os.path.join(distributions_path, distribution, 'gpg-signatures.json') + if os.path.exists(distribution_config): + with open(distribution_config) as distro_config_file: +- return json.load(distro_config_file) ++ distro_config_json = json.load(distro_config_file) + else: + raise StopActorExecutionError( + 'Cannot find distribution signature configuration.', + details={'Problem': 'Distribution {} was not found in {}.'.format(distribution, distributions_path)}) ++ ++ # Extend with Vendors signatures ++ for siglist in api.consume(VendorSignatures): ++ distro_config_json["keys"].extend(siglist.sigs) ++ ++ return distro_config_json +diff --git a/repos/system_upgrade/common/libraries/dnfplugin.py b/repos/system_upgrade/common/libraries/dnfplugin.py +index 4f0c3a99..0f31f101 100644 +--- a/repos/system_upgrade/common/libraries/dnfplugin.py ++++ b/repos/system_upgrade/common/libraries/dnfplugin.py +@@ -90,6 +90,7 @@ def build_plugin_data(target_repoids, debug, test, tasks, on_aws): + 'to_install': sorted(tasks.to_install), + 'to_remove': sorted(tasks.to_remove), + 'to_upgrade': sorted(tasks.to_upgrade), ++ 'to_reinstall': sorted(tasks.to_reinstall), + 'modules_to_enable': sorted(['{}:{}'.format(m.name, m.stream) for m in tasks.modules_to_enable]), + }, + 'dnf_conf': { +diff --git a/repos/system_upgrade/common/libraries/fetch.py b/repos/system_upgrade/common/libraries/fetch.py +index 82bf4ff3..cb20d775 100644 +--- a/repos/system_upgrade/common/libraries/fetch.py ++++ b/repos/system_upgrade/common/libraries/fetch.py +@@ -146,7 +146,8 @@ def load_data_asset(actor_requesting_asset, + asset_filename, + asset_fulltext_name, + docs_url, +- docs_title): ++ docs_title, ++ asset_directory="/etc/leapp/files"): + """ + Load the content of the data asset with given asset_filename + and produce :class:`leapp.model.ConsumedDataAsset` message. +@@ -183,7 +184,7 @@ def load_data_asset(actor_requesting_asset, + + try: + # The asset family ID has the form (major, minor), include only `major` in the URL +- raw_asset_contents = read_or_fetch(asset_filename, data_stream=data_stream_major, allow_download=False) ++ raw_asset_contents = read_or_fetch(asset_filename, directory=asset_directory, data_stream=data_stream_major, allow_download=False) + asset_contents = json.loads(raw_asset_contents) + except ValueError: + msg = 'The {0} file (at {1}) does not contain a valid JSON object.'.format(asset_fulltext_name, asset_filename) +diff --git a/repos/system_upgrade/common/libraries/gpg.py b/repos/system_upgrade/common/libraries/gpg.py +index a8071329..1e0bac46 100644 +--- a/repos/system_upgrade/common/libraries/gpg.py ++++ b/repos/system_upgrade/common/libraries/gpg.py +@@ -121,7 +121,10 @@ def get_path_to_gpg_certs(): + # only beta is special in regards to the GPG signing keys + if target_product_type == 'beta': + certs_dir = '{}beta'.format(target_major_version) +- return os.path.join(api.get_common_folder_path(GPG_CERTS_FOLDER), certs_dir) ++ return [ ++ "/etc/leapp/files/vendors.d/rpm-gpg/", ++ os.path.join(api.get_common_folder_path(GPG_CERTS_FOLDER), certs_dir) ++ ] + + + def is_nogpgcheck_set(): +diff --git a/repos/system_upgrade/common/libraries/repomaputils.py b/repos/system_upgrade/common/libraries/repomaputils.py +new file mode 100644 +index 00000000..86473903 +--- /dev/null ++++ b/repos/system_upgrade/common/libraries/repomaputils.py +@@ -0,0 +1,140 @@ ++from collections import defaultdict ++from leapp.models import PESIDRepositoryEntry, RepoMapEntry, RepositoriesMapping ++ ++class RepoMapData(object): ++ VERSION_FORMAT = '1.2.0' ++ ++ def __init__(self): ++ self.repositories = [] ++ self.mapping = {} ++ ++ def add_repository(self, data, pesid): ++ """ ++ Add new PESIDRepositoryEntry with given pesid from the provided dictionary. ++ ++ :param data: A dict containing the data of the added repository. The dictionary structure corresponds ++ to the repositories entries in the repository mapping JSON schema. ++ :type data: Dict[str, str] ++ :param pesid: PES id of the repository family that the newly added repository belongs to. ++ :type pesid: str ++ """ ++ self.repositories.append(PESIDRepositoryEntry( ++ repoid=data['repoid'], ++ channel=data['channel'], ++ rhui=data.get('rhui', ''), ++ repo_type=data['repo_type'], ++ arch=data['arch'], ++ major_version=data['major_version'], ++ pesid=pesid ++ )) ++ ++ def get_repositories(self, valid_major_versions): ++ """ ++ Return the list of PESIDRepositoryEntry object matching the specified major versions. ++ """ ++ return [repo for repo in self.repositories if repo.major_version in valid_major_versions] ++ ++ def get_version_repoids(self, major_version): ++ """ ++ Return the list of repository ID strings for repositories matching the specified major version. ++ """ ++ return [repo.repoid for repo in self.repositories if repo.major_version == major_version] ++ ++ def add_mapping(self, source_major_version, target_major_version, source_pesid, target_pesid): ++ """ ++ Add a new mapping entry that is mapping the source pesid to the destination pesid(s), ++ relevant in an IPU from the supplied source major version to the supplied target ++ major version. ++ ++ :param str source_major_version: Specifies the major version of the source system ++ for which the added mapping applies. ++ :param str target_major_version: Specifies the major version of the target system ++ for which the added mapping applies. ++ :param str source_pesid: PESID of the source repository. ++ :param Union[str|List[str]] target_pesid: A single target PESID or a list of target ++ PESIDs of the added mapping. ++ """ ++ # NOTE: it could be more simple, but I prefer to be sure the input data ++ # contains just one map per source PESID. ++ key = '{}:{}'.format(source_major_version, target_major_version) ++ rmap = self.mapping.get(key, defaultdict(set)) ++ self.mapping[key] = rmap ++ if isinstance(target_pesid, list): ++ rmap[source_pesid].update(target_pesid) ++ else: ++ rmap[source_pesid].add(target_pesid) ++ ++ def get_mappings(self, src_major_version, dst_major_version): ++ """ ++ Return the list of RepoMapEntry objects for the specified upgrade path. ++ ++ IOW, the whole mapping for specified IPU. ++ """ ++ key = '{}:{}'.format(src_major_version, dst_major_version) ++ rmap = self.mapping.get(key, None) ++ if not rmap: ++ return None ++ map_list = [] ++ for src_pesid in sorted(rmap.keys()): ++ map_list.append(RepoMapEntry(source=src_pesid, target=sorted(rmap[src_pesid]))) ++ return map_list ++ ++ @staticmethod ++ def load_from_dict(data): ++ if data['version_format'] != RepoMapData.VERSION_FORMAT: ++ raise ValueError( ++ 'The obtained repomap data has unsupported version of format.' ++ ' Get {} required {}' ++ .format(data['version_format'], RepoMapData.VERSION_FORMAT) ++ ) ++ ++ repomap = RepoMapData() ++ ++ # Load reposiories ++ existing_pesids = set() ++ for repo_family in data['repositories']: ++ existing_pesids.add(repo_family['pesid']) ++ for repo in repo_family['entries']: ++ repomap.add_repository(repo, repo_family['pesid']) ++ ++ # Load mappings ++ for mapping in data['mapping']: ++ for entry in mapping['entries']: ++ if not isinstance(entry['target'], list): ++ raise ValueError( ++ 'The target field of a mapping entry is not a list: {}' ++ .format(entry) ++ ) ++ ++ for pesid in [entry['source']] + entry['target']: ++ if pesid not in existing_pesids: ++ raise ValueError( ++ 'The {} pesid is not related to any repository.' ++ .format(pesid) ++ ) ++ repomap.add_mapping( ++ source_major_version=mapping['source_major_version'], ++ target_major_version=mapping['target_major_version'], ++ source_pesid=entry['source'], ++ target_pesid=entry['target'], ++ ) ++ return repomap ++ ++def combine_repomap_messages(mapping_list): ++ """ ++ Combine multiple RepositoryMapping messages into one. ++ Needed because we might get more than one message if there are vendors present. ++ """ ++ combined_mapping = [] ++ combined_repositories = [] ++ # Depending on whether there are any vendors present, we might get more than one message. ++ for msg in mapping_list: ++ combined_mapping.extend(msg.mapping) ++ combined_repositories.extend(msg.repositories) ++ ++ combined_repomapping = RepositoriesMapping( ++ mapping=combined_mapping, ++ repositories=combined_repositories ++ ) ++ ++ return combined_repomapping +diff --git a/repos/system_upgrade/common/libraries/rhsm.py b/repos/system_upgrade/common/libraries/rhsm.py +index 74f6aeb1..6f512d7d 100644 +--- a/repos/system_upgrade/common/libraries/rhsm.py ++++ b/repos/system_upgrade/common/libraries/rhsm.py +@@ -93,7 +93,7 @@ def _handle_rhsm_exceptions(hint=None): + + def skip_rhsm(): + """Check whether we should skip RHSM related code.""" +- return get_env('LEAPP_NO_RHSM', '0') == '1' ++ return True + + + def with_rhsm(f): +@@ -326,11 +326,6 @@ def set_container_mode(context): + could be affected and the generated repo file in the container could be + affected as well (e.g. when the release is set, using rhsm, on the host). + +- We want to put RHSM into the container mode always when /etc/rhsm and +- /etc/pki/entitlement directories exists, even when leapp is executed with +- --no-rhsm option. If any of these directories are missing, skip other +- actions - most likely RHSM is not installed in such a case. +- + :param context: An instance of a mounting.IsolatedActions class + :type context: mounting.IsolatedActions class + """ +@@ -338,20 +333,8 @@ def set_container_mode(context): + api.current_logger().error('Trying to set RHSM into the container mode' + 'on host. Skipping the action.') + return +- # TODO(pstodulk): check "rhsm identity" whether system is registered +- # and the container mode should be required +- if (not os.path.exists(context.full_path('/etc/rhsm')) +- or not os.path.exists(context.full_path('/etc/pki/entitlement'))): +- api.current_logger().warning( +- 'Cannot set the container mode for the subscription-manager as' +- ' one of required directories is missing. Most likely RHSM is not' +- ' installed. Skipping other actions.' +- ) +- return +- + try: + context.call(['ln', '-s', '/etc/rhsm', '/etc/rhsm-host']) +- context.call(['ln', '-s', '/etc/pki/entitlement', '/etc/pki/entitlement-host']) + except CalledProcessError: + raise StopActorExecutionError( + message='Cannot set the container mode for the subscription-manager.') +diff --git a/repos/system_upgrade/common/models/activevendorlist.py b/repos/system_upgrade/common/models/activevendorlist.py +new file mode 100644 +index 00000000..de4056fb +--- /dev/null ++++ b/repos/system_upgrade/common/models/activevendorlist.py +@@ -0,0 +1,7 @@ ++from leapp.models import Model, fields ++from leapp.topics import VendorTopic ++ ++ ++class ActiveVendorList(Model): ++ topic = VendorTopic ++ data = fields.List(fields.String()) +diff --git a/repos/system_upgrade/common/models/repositoriesmap.py b/repos/system_upgrade/common/models/repositoriesmap.py +index 7192a60d..2144090d 100644 +--- a/repos/system_upgrade/common/models/repositoriesmap.py ++++ b/repos/system_upgrade/common/models/repositoriesmap.py +@@ -91,3 +91,4 @@ class RepositoriesMapping(Model): + + mapping = fields.List(fields.Model(RepoMapEntry), default=[]) + repositories = fields.List(fields.Model(PESIDRepositoryEntry), default=[]) ++ vendor = fields.Nullable(fields.String()) +diff --git a/repos/system_upgrade/common/models/rpmtransactiontasks.py b/repos/system_upgrade/common/models/rpmtransactiontasks.py +index 7e2870d0..05d4e941 100644 +--- a/repos/system_upgrade/common/models/rpmtransactiontasks.py ++++ b/repos/system_upgrade/common/models/rpmtransactiontasks.py +@@ -10,6 +10,7 @@ class RpmTransactionTasks(Model): + to_keep = fields.List(fields.String(), default=[]) + to_remove = fields.List(fields.String(), default=[]) + to_upgrade = fields.List(fields.String(), default=[]) ++ to_reinstall = fields.List(fields.String(), default=[]) + modules_to_enable = fields.List(fields.Model(Module), default=[]) + modules_to_reset = fields.List(fields.Model(Module), default=[]) + +diff --git a/repos/system_upgrade/common/models/targetrepositories.py b/repos/system_upgrade/common/models/targetrepositories.py +index 02c6c5e5..f9fd4238 100644 +--- a/repos/system_upgrade/common/models/targetrepositories.py ++++ b/repos/system_upgrade/common/models/targetrepositories.py +@@ -21,6 +21,12 @@ class CustomTargetRepository(TargetRepositoryBase): + enabled = fields.Boolean(default=True) + + ++class VendorCustomTargetRepositoryList(Model): ++ topic = TransactionTopic ++ vendor = fields.String() ++ repos = fields.List(fields.Model(CustomTargetRepository)) ++ ++ + class TargetRepositories(Model): + """ + Repositories supposed to be used during the IPU process +diff --git a/repos/system_upgrade/common/models/vendorsignatures.py b/repos/system_upgrade/common/models/vendorsignatures.py +new file mode 100644 +index 00000000..f456aec5 +--- /dev/null ++++ b/repos/system_upgrade/common/models/vendorsignatures.py +@@ -0,0 +1,8 @@ ++from leapp.models import Model, fields ++from leapp.topics import VendorTopic ++ ++ ++class VendorSignatures(Model): ++ topic = VendorTopic ++ vendor = fields.String() ++ sigs = fields.List(fields.String()) +diff --git a/repos/system_upgrade/common/models/vendorsourcerepos.py b/repos/system_upgrade/common/models/vendorsourcerepos.py +new file mode 100644 +index 00000000..b7a219b4 +--- /dev/null ++++ b/repos/system_upgrade/common/models/vendorsourcerepos.py +@@ -0,0 +1,12 @@ ++from leapp.models import Model, fields ++from leapp.topics import VendorTopic ++ ++ ++class VendorSourceRepos(Model): ++ """ ++ This model contains the data on all source repositories associated with a specific vendor. ++ Its data is used to determine whether the vendor should be included into the upgrade process. ++ """ ++ topic = VendorTopic ++ vendor = fields.String() ++ source_repoids = fields.List(fields.String()) +diff --git a/repos/system_upgrade/common/topics/vendortopic.py b/repos/system_upgrade/common/topics/vendortopic.py +new file mode 100644 +index 00000000..014b7afb +--- /dev/null ++++ b/repos/system_upgrade/common/topics/vendortopic.py +@@ -0,0 +1,5 @@ ++from leapp.topics import Topic ++ ++ ++class VendorTopic(Topic): ++ name = 'vendor_topic' diff --git a/SPECS/leapp-repository.spec b/SPECS/leapp-repository.spec index 1d671e7..b670113 100644 --- a/SPECS/leapp-repository.spec +++ b/SPECS/leapp-repository.spec @@ -50,9 +50,10 @@ py2_byte_compile "%1" "%2"} # to create such an rpm. Instead, we are going to introduce new naming for # RHEL 8+ packages to be consistent with other leapp projects in future. +Epoch: 1 Name: leapp-repository Version: 0.21.0 -Release: 2%{?dist} +Release: 2%{?dist}.elevate.1 Summary: Repositories for leapp License: ASL 2.0 @@ -66,6 +67,7 @@ BuildArch: noarch ### PATCHES HERE # Patch0001: filename.patch Patch0001: 0001-rhui-alibaba-add-ARM-RHEL8-and-RHEL9-setup-entries-1.patch +Patch0010: leapp-repository-0.21.0-elevate.patch %description @@ -229,6 +231,7 @@ Requires: python3-gobject-base # APPLY PATCHES HERE # %%patch0001 -p1 %patch0001 -p1 +%patch0010 -p1 %build @@ -286,12 +289,12 @@ done; %doc README.md %license LICENSE %dir %{_sysconfdir}/leapp/transaction -%dir %{_sysconfdir}/leapp/files +%exclude %dir %{_sysconfdir}/leapp/files %dir %{leapp_datadir} %dir %{repositorydir} %dir %{custom_repositorydir} %dir %{leapp_python_sitelib}/leapp/cli/commands -%config %{_sysconfdir}/leapp/files/* +%exclude %config %{_sysconfdir}/leapp/files/* %{_sysconfdir}/leapp/repos.d/* %{_sysconfdir}/leapp/transaction/* %{repositorydir}/* @@ -302,6 +305,9 @@ done; # no files here %changelog +* Thu Aug 22 2024 Yuriy Kohut - 0.21.0-2.elevate.1 +- ELevate vendors support + * Mon Aug 19 2024 Petr Stodulka - 0.21.0-2 - Updated SPEC file to drop leapp repositories unrelated to IPU 8 -> 9 - Resolves: RHEL-27847