From f701468004be09a2b8bbdcfba9003310a0f4f387 Mon Sep 17 00:00:00 2001 From: Sam <109683132+kernelsam@users.noreply.github.com> Date: Tue, 22 Oct 2024 11:11:35 -0700 Subject: [PATCH] #73 add beta repo, improve dependency handling (#77) --- action.yaml | 4 +-- linux/action.yaml | 1 - linux/install-senzing.sh | 53 ++++++++++++++++++++++++++++------------ 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/action.yaml b/action.yaml index 26d7d5c..0e93512 100644 --- a/action.yaml +++ b/action.yaml @@ -1,5 +1,5 @@ -name: Install Senzing API Runtime -description: Install Senzing API Runtime based on platform. +name: Install Senzing API +description: Install Senzing API based on platform. author: support@senzing.com inputs: diff --git a/linux/action.yaml b/linux/action.yaml index 2b8a2c1..0c95187 100644 --- a/linux/action.yaml +++ b/linux/action.yaml @@ -14,7 +14,6 @@ runs: using: composite steps: # Install staging, production or versioned release. - - env: PACKAGES_TO_INSTALL: ${{ inputs.packages-to-install }} SENZING_ACCEPT_EULA: I_ACCEPT_THE_SENZING_EULA diff --git a/linux/install-senzing.sh b/linux/install-senzing.sh index e21d123..d39ff86 100755 --- a/linux/install-senzing.sh +++ b/linux/install-senzing.sh @@ -11,12 +11,14 @@ set -e configure-vars() { # senzing apt repository packages + BETA_REPO=https://senzing-beta-apt.s3.amazonaws.com PROD_REPO=https://senzing-production-apt.s3.amazonaws.com STAGING_REPO=https://senzing-staging-apt.s3.amazonaws.com # v3 and lower PROD_REPO_V3_AND_LOWER="$PROD_REPO/senzingrepo_1.0.1-1_all.deb" STAGING_REPO_V3_AND_LOWER="$STAGING_REPO/senzingstagingrepo_1.0.1-1_all.deb" # v4 and above + BETA_REPO_V4_AND_ABOVE="$BETA_REPO/senzingbetarepo_2.0.0-1_all.deb" PROD_REPO_V4_AND_ABOVE="$PROD_REPO/senzingrepo_2.0.0-1_all.deb" STAGING_REPO_V4_AND_ABOVE="$STAGING_REPO/senzingstagingrepo_2.0.0-1_all.deb" @@ -25,13 +27,19 @@ configure-vars() { # semantic version with build number REGEX_SEM_VER_BUILD_NUM="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)-([0-9]){5}$" - if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then + if [[ $SENZING_INSTALL_VERSION =~ "beta" ]]; then + + echo "[INFO] install $PACKAGES_TO_INSTALL from beta" + get-generic-major-version + INSTALL_REPO="$BETA_REPO_V4_AND_ABOVE" + SENZING_PACKAGES="$PACKAGES_TO_INSTALL" + + elif [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then echo "[INFO] install $PACKAGES_TO_INSTALL from production" get-generic-major-version is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER" SENZING_PACKAGES="$PACKAGES_TO_INSTALL" - restrict-major-version elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then @@ -39,7 +47,6 @@ configure-vars() { get-generic-major-version is-major-version-greater-than-3 && INSTALL_REPO="$STAGING_REPO_V4_AND_ABOVE" || INSTALL_REPO="$STAGING_REPO_V3_AND_LOWER" SENZING_PACKAGES="$PACKAGES_TO_INSTALL" - restrict-major-version elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER ]]; then @@ -131,20 +138,34 @@ is-major-version-greater-than-3() { ############################################ # restrict-major-version +# +# restrict the major version for all found +# senzing packages to avoid dependency +# conflicts +# # GLOBALS: -# SENZING_INSTALL_VERSION -# one of: production-v, staging-v -# semver does not apply here +# MAJOR_VERSION +# set prior to this call via either +# get-generic-major-version or +# get-semantic-major-version ############################################ restrict-major-version() { - get-generic-major-version - senzingapi_runtime_preferences_file="/etc/apt/preferences.d/senzingapi-runtime" - echo "[INFO] restrict senzingapi-runtime major version to: $MAJOR_VERSION" + senzing_packages=$(apt list | grep senzing | cut -d '/' -f 1 | grep -v "data" | grep -v "staging") + echo "[INFO] senzing packages: $senzing_packages" + + for package in $senzing_packages + do + preferences_file="/etc/apt/preferences.d/$package" + echo "[INFO] restrict $package major version to: $MAJOR_VERSION" + + echo "Package: $package" | sudo tee -a "$preferences_file" + echo "Pin: version $MAJOR_VERSION.*" | sudo tee -a "$preferences_file" + echo "Pin-Priority: 999" | sudo tee -a "$preferences_file" + done - echo "Package: senzingapi-runtime" | sudo tee -a $senzingapi_runtime_preferences_file - echo "Pin: version $MAJOR_VERSION.*" | sudo tee -a $senzingapi_runtime_preferences_file - echo "Pin-Priority: 999" | sudo tee -a $senzingapi_runtime_preferences_file + echo "[INFO] sudo apt update" + sudo apt update } @@ -162,6 +183,7 @@ install-senzing-repository() { sudo apt-get -y install /tmp/senzingrepo.deb echo "[INFO] sudo apt-get update" sudo apt-get update + rm /tmp/senzingrepo.deb } @@ -171,8 +193,9 @@ install-senzing-repository() { # SENZING_PACKAGES # full package name used for install ############################################ -install-senzingapi-runtime() { +install-senzingapi() { + restrict-major-version echo "[INFO] sudo apt list | grep senzing" sudo apt list | grep senzing echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGES" @@ -196,7 +219,7 @@ verify-installation() { echo "[INFO] verify senzing installation" is-major-version-greater-than-3 && BUILD_VERSION_PATH="er/szBuildVersion" || BUILD_VERSION_PATH="g2/g2BuildVersion" - if [ ! -f /opt/senzing/"$BUILD_VERSION_PATH".json ]; then + if [ ! -f "/opt/senzing/$BUILD_VERSION_PATH.json" ]; then echo "[ERROR] /opt/senzing/$BUILD_VERSION_PATH.json not found." exit 1 else @@ -213,5 +236,5 @@ verify-installation() { echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION" configure-vars install-senzing-repository -install-senzingapi-runtime +install-senzingapi verify-installation \ No newline at end of file