From e4c84adc36e4aadee6188778d616a39e7d9bb8f5 Mon Sep 17 00:00:00 2001 From: Ronelle Landy Date: Wed, 26 May 2021 16:12:04 -0400 Subject: [PATCH] Extract updated rpms from buildah images When a gating, component or delorean current repo is present, containers should be updated with the latest rpms. This review checks the installed rpms and greps for the repos where the updated rpms are sourced. Change-Id: Ie29c7c33c8d66bc3729c03c2d72cbdbf85ad443a --- tasks/yum_update_buildah.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tasks/yum_update_buildah.yml b/tasks/yum_update_buildah.yml index bbb9970..cbfd058 100644 --- a/tasks/yum_update_buildah.yml +++ b/tasks/yum_update_buildah.yml @@ -155,6 +155,25 @@ path: "{{ yum_update.path }}" state: absent +- name: Create the repo list + set_fact: + repo_list: "{{ update_repo.split(',') }}" + +- name: Capture the update repos and installed rpms + shell: > + buildah run {{ from_image }} yum list installed > /var/log/container_info.log + register: rpm_list + +- name: Extract the updated rpms + shell: | + UPDATE_LOG=/var/log/container_image_update_output.log; + touch $UPDATE_LOG; + echo "** {{ target_image | default(source_image) }}{{ modified_append_tag }} **" >> $UPDATE_LOG; + {% for repo in repo_list %} + cat /var/log/container_info.log | grep -F "@{{ repo|replace(' ', '') }}" >> $UPDATE_LOG || true; + {% endfor %} + rm -f /var/log/container_info.log + # NOTE(aschultz): remove --format docker when oci images are properly supported - name: Commit changes to image ({{ target_image | default(source_image) }}{{ modified_append_tag }})