Skip to content

Commit

Permalink
log error message only for true error
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepassio committed Dec 10, 2024
1 parent bf490ab commit b8439e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/test-cpan-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ jobs:
# Add Centreon plugins repositories
echo -e '[centreon-plugins-stable]\nname=centreon plugins stable x86_64\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n[centreon-plugins-stable-noarch]\nname=centreon plugins stable noarch\nbaseurl=https://packages.centreon.com/rpm-plugins/${{ matrix.distrib }}/stable/noarch\nenabled=1\ngpgcheck=1\ngpgkey=https://yum-gpg.centreon.com/RPM-GPG-KEY-CES\n' >> /etc/yum.repos.d/centreon-plugins.repo
else
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y zstd perl wget gpg apt-utils
# Add Centreon plugins repositories
Expand Down Expand Up @@ -477,11 +478,11 @@ jobs:
for dependency in $dependencies; do
# If the dependency has been built in the same workflow, install it
if [ -f $dependency*.rpm ]; then
dnf install -y $dependency*.rpm 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; }
error_output=$(dnf install -y $dependency*.rpm 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; }
fi
done
# Install package
dnf install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; }
error_output=$(dnf install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; }
# Uninstall package with all his dependencies
dnf autoremove -y $(echo $package | sed 's/_[0-9].*\.rpm//' | sed 's/.\///') 2>> $error_log || true
done
Expand All @@ -501,11 +502,11 @@ jobs:
for dependency in $dependencies; do
# If the dependency has been built in the same workflow, install it
if [ -f $dependency*.deb ]; then
apt-get install -y $dependency*.deb 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; }
error_output=$(apt-get install -y $dependency*.deb 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $dependency" >> $error_log; true; }
fi
done
# Install package
apt-get install -y $package 2>> $error_log || { echo "Error during installation of $package" >> $error_log; true; }
error_output=$(apt-get install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of $package" >> $error_log; true; }
# Uninstall package with all his dependencies
# Package name is the name of the file less the version and the .deb extension, and without the "./" at the beginning
apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>> $error_log || true
Expand Down

0 comments on commit b8439e1

Please sign in to comment.