Skip to content

Commit

Permalink
#73 add beta repo, improve dependency handling (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelsam authored Oct 22, 2024
1 parent b72d104 commit f701468
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
1 change: 0 additions & 1 deletion linux/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 38 additions & 15 deletions linux/install-senzing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -25,21 +27,26 @@ 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

echo "[INFO] install $PACKAGES_TO_INSTALL from staging"
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

Expand Down Expand Up @@ -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<X>, staging-v<X>
# 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

}

Expand All @@ -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

}

Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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

0 comments on commit f701468

Please sign in to comment.