Skip to content

Commit

Permalink
Merge pull request #6 from ggtakec/update_files
Browse files Browse the repository at this point in the history
Fixed phpext_helper.sh for ruby and shellcheck and PHP repos
  • Loading branch information
Takeshi Nakatani authored Nov 22, 2023
2 parents 484fc45 + e80ae8b commit bb8abeb
Showing 1 changed file with 42 additions and 26 deletions.
68 changes: 42 additions & 26 deletions .github/workflows/phpext_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1296,16 +1296,32 @@ if [ -n "${INSTALL_PHP_REPO}" ]; then
PRNERR "\"INSTALL_PHP_REPO_GPG_URL\" or \"INSTALL_PHP_REPO_GPG_FILEPATH\" varibales are not specified."
exit 1
fi
if ({ RUNCMD "${CURLCMD}" -sSLo "${INSTALL_PHP_REPO_GPG_FILEPATH}" "${INSTALL_PHP_REPO_GPG_URL}" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install gpg file."
exit 1
fi
if ({ RUNCMD "echo 'deb [signed-by=${INSTALL_PHP_REPO_GPG_FILEPATH}] https://${INSTALL_PHP_REPO}/ $(lsb_release -sc) main' > /etc/apt/sources.list.d/php.list" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to add repository for PHP"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" "${UPDATE_CMD}" "${UPDATE_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to re-update local packages"

# [NOTE]
# We have confirmed cases where lookup of packages.sury.org is not possible.
# Thus, this script is trying to retry in that case.
#
_RETRY_COUNT=0
while [ "${_RETRY_COUNT}" -lt 10 ]; do
if ({ RUNCMD "${CURLCMD}" -sSLo "${INSTALL_PHP_REPO_GPG_FILEPATH}" "${INSTALL_PHP_REPO_GPG_URL}" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNWARN "Failed to install gpg file, so retry..."
else
if ({ RUNCMD "echo 'deb [signed-by=${INSTALL_PHP_REPO_GPG_FILEPATH}] https://${INSTALL_PHP_REPO}/ $(lsb_release -sc) main' > /etc/apt/sources.list.d/php.list" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNWARN "Failed to add repository for PHP, so retry..."
else
if ({ RUNCMD "${INSTALLER_BIN}" "${UPDATE_CMD}" "${UPDATE_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNWARN "Failed to re-update local packages, so retry..."
else
# Success
break
fi
fi
fi
_RETRY_COUNT=$((_RETRY_COUNT + 1))
sleep 20
done
if [ "${_RETRY_COUNT}" -ge 10 ]; then
PRNERR "Failed to add PHP repository and update local packages."
exit 1
fi
else
Expand Down Expand Up @@ -1408,11 +1424,11 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
PRNERR "Failed to install SCL packages"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" rh-ruby26 rh-ruby26-ruby-devel rh-ruby26-rubygem-rake || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" rh-ruby27 rh-ruby27-ruby-devel rh-ruby27-rubygem-rake || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install ruby packages"
exit 1
fi
. /opt/rh/rh-ruby26/enable
. /opt/rh/rh-ruby27/enable

if ({ RUNCMD "${GEM_BIN}" "${GEM_INSTALL_CMD}" package_cloud || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install packagecloud.io upload tools"
Expand Down Expand Up @@ -1440,16 +1456,16 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
PRNERR "Failed to reset ruby module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" install ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install ruby 2.6 module"
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" install ruby:2.7 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install ruby 2.7 module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" enable ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to enable ruby 2.6 module"
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" enable ruby:2.7 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to enable ruby 2.7 module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" update ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to update ruby 2.6 module"
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" update ruby:2.7 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to update ruby 2.7 module"
exit 1
fi

Expand All @@ -1467,10 +1483,10 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
#

#
# Set RVM(Ruby Version Manager) and install Ruby 2.6 and package_cloud
# Set RVM(Ruby Version Manager) and install Ruby 2.7 and package_cloud
#
# [NOTE]
# Install Ruby2.6 using RVM tools.
# Install Ruby2.7 using RVM tools.
# Installation and running RVM tools must be done in Bash.
# This set of installations will create a Bash script and run it.
#
Expand All @@ -1483,7 +1499,7 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
# command curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import -
# command curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg --import -
#
# After that, install RVM installation, RVM environment settings, Ruby2.6 installation, and package_cloud tools.
# After that, install RVM installation, RVM environment settings, Ruby2.7 installation, and package_cloud tools.
#
# [NOTE]
# The RVM installation requires running from a bash shell.
Expand Down Expand Up @@ -1519,12 +1535,12 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
echo ' echo "Failed to add rvm user to root group."'
echo ' exit 1'
echo 'fi'
echo 'if ! rvm install ruby-2.6 2>&1; then'
echo ' echo "Failed to install ruby 2.6."'
echo 'if ! rvm install ruby-2.7 2>&1; then'
echo ' echo "Failed to install ruby 2.7."'
echo ' exit 1'
echo 'fi'
echo 'if ! rvm --default use ruby-2.6 2>&1; then'
echo ' echo "Failed to set ruby 2.6 as default."'
echo 'if ! rvm --default use ruby-2.7 2>&1; then'
echo ' echo "Failed to set ruby 2.7 as default."'
echo ' exit 1'
echo 'fi'
echo ''
Expand Down Expand Up @@ -1700,7 +1716,7 @@ if [ "${RUN_SHELLCHECK}" -eq 1 ]; then
#
# Rocky
#
if ! LATEST_SHELLCHECK_DOWNLOAD_URL=$("${CURLCMD}" -s -S https://api.github.com/repos/koalaman/shellcheck/releases/latest | grep '"browser_download_url"' | grep 'linux.x86_64' | sed -e 's|"||g' -e 's|^.*browser_download_url:[[:space:]]*||g' | tr -d '\n'); then
if ! LATEST_SHELLCHECK_DOWNLOAD_URL=$("${CURLCMD}" -s -S https://api.github.com/repos/koalaman/shellcheck/releases/latest | tr '{' '\n' | tr '}' '\n' | tr '[' '\n' | tr ']' '\n' | tr ',' '\n' | grep '"browser_download_url"' | grep 'linux.x86_64' | sed -e 's|"||g' -e 's|^.*browser_download_url:[[:space:]]*||g' -e 's|^[[:space:]]*||g' -e 's|[[:space:]]*$||g' | tr -d '\n'); then
PRNERR "Failed to get shellcheck download url path"
exit 1
fi
Expand Down

0 comments on commit bb8abeb

Please sign in to comment.