Skip to content

Commit

Permalink
Support rdopkg on RHEL9 (initially through pip)
Browse files Browse the repository at this point in the history
As rdopkg is not yet packaged on EPEL9, install rdopkg as a user
package, and add the additional path whenever the command is used.

Among the required changes are:
- extend the installation of required packages to EL9 too
  (same as EL8);
- add support for rdopkg in a custom venv
- extend the SELinux context fix on EL9 too (and future releases),
  and use container_file_t, the new name for svirt_sandbox_file_t,
  supported for a long time (even the last RHEL 7.x releases
  include it). Also, follow the ansible good practices and
  use the native ansible role instead of shell/chcon.

Change-Id: I3e40d6dc7a5d6264df19f4997ea397f3a8b1be90
  • Loading branch information
tosky committed Jul 14, 2022
1 parent ab1dff4 commit 07e2462
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
10 changes: 6 additions & 4 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@
mode: push
when: "'undercloud' not in groups['tester'][0]"

- name: SELinux - svirt_sandbox_file_t - allow containers to read mounted patched_rpms
shell: >
chcon -Rt svirt_sandbox_file_t /patched_rpms
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8' | default(false)
- name: SELinux - container_file_t - allow containers to read mounted patched_rpms
file:
path: "/patched_rpms"
recurse: yes
setype: container_file_t
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8 | default(false)

- name: Cleanup
hosts: localhost
Expand Down
20 changes: 17 additions & 3 deletions roles/patch_rpm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
retries: 3
delay: 3

- name: RHEL8 specific packages
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8' | default(false)
- name: RHEL>=8 specific packages
when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8 | default(false)
block:
- name: Install packages required for patching - RHEL-8
- name: Install packages required for patching - RHEL >= 8
become: yes
dnf:
name:
Expand Down Expand Up @@ -111,6 +111,20 @@
until: task_result is success
retries: 3
delay: 3
when: ansible_distribution_major_version == '8'

# Install rdopkg from pip for RHEL9
- name: Install rdopkg from pip as it's not yet packaged
pip:
name:
- 'rdopkg'
state : present
extra_args: --user
register: task_result
until: task_result is success
retries: 3
delay: 3
when: ansible_distribution_major_version == '9'

- name: save the commit ID of tested patchset
shell: git log -1 --pretty=format:%H
Expand Down
4 changes: 2 additions & 2 deletions roles/patch_rpm/tasks/patch_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
shell: >
git config --global user.name `whoami` &&
git config --global user.email `whoami`@redhat.com &&
rdopkg patch -p patches/{{ branch_prefix }}{{ branch_trunk_str | default('') }}-patches;
PATH=$PATH:~/.local/bin rdopkg patch -p patches/{{ branch_prefix }}{{ branch_trunk_str | default('') }}-patches;
args:
chdir: "{{ tmp_dir }}/dist-git/{{ component_dist_git_name }}"
changed_when: true
Expand All @@ -49,7 +49,7 @@
- name: Prepare dist-git repo for patching and performs actual patching
vars:
pre_rel_switch: "{{ 'true' if install.component.version == component_pre_rel_version else 'false' }}"
shell: ./patch.sh TARGET="{{ install.component.name }}" TARGET_DIR="{{ tmp_dir }}" PRE_RELEASE="{{ pre_rel_switch }}"
shell: PATH=$PATH:~/.local/bin ./patch.sh TARGET="{{ install.component.name }}" TARGET_DIR="{{ tmp_dir }}" PRE_RELEASE="{{ pre_rel_switch }}"
args:
chdir: "{{ tmp_dir }}/dist-git/{{ component_dist_git_name }}"
register: patch
Expand Down

0 comments on commit 07e2462

Please sign in to comment.