Only do yum update when needed

Currently the logic for this results in a full yum update when no
package updates are found in the provided repository. This can lead to
job timeouts when nothing was built in CI because it effectively does a
yum update on every container and applies other system packages rather
than ones that actually changed.

There is a larger issue in that we can still get out of sync with the
host OS.

Change-Id: Iaf41691ea3cb6e78186741ac5e15614fb73f89ff
Related-Bug: #1786764
This commit is contained in:
Alex Schultz 2018-08-17 14:21:27 -06:00
parent a2229e738a
commit 7b587fe0f5
1 changed files with 5 additions and 0 deletions

View File

@ -14,5 +14,10 @@ if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then
packages_for_update=("$(repoquery --disablerepo='*' --enablerepo=$1 --qf %{NAME} -a)")
fi
if [ -z $package_for_update ]; then
echo "No packages were found for update..."
exit
fi
yum -y update $packages_for_update
rm -rf /var/cache/yum