From b72d1043741485661765846e37e976d8e379454e Mon Sep 17 00:00:00 2001 From: Sam <109683132+kernelsam@users.noreply.github.com> Date: Fri, 4 Oct 2024 11:36:41 -0700 Subject: [PATCH] #65 optionally supply a package or list of packages to install (#74) --- .github/linters/.jscpd.json | 6 +- .github/linters/.markdown-lint.yml | 4 +- CODE_OF_CONDUCT.md | 22 +++---- CONTRIBUTING.md | 4 +- README.md | 94 +++++++++++++++++++++--------- action.yaml | 16 +++-- darwin/action.yaml | 1 - linux/action.yaml | 15 +++-- linux/install-senzing.sh | 60 +++++++++++++------ windows/action.yaml | 1 - windows/install-senzing.sh | 19 +++--- 11 files changed, 152 insertions(+), 90 deletions(-) diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json index e0d5a52..59fb358 100644 --- a/.github/linters/.jscpd.json +++ b/.github/linters/.jscpd.json @@ -1,5 +1,3 @@ { - "ignore": [ - "**/install*.sh" - ] -} \ No newline at end of file + "ignore": ["**/install*.sh"] +} diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml index aec8fd5..40ed110 100644 --- a/.github/linters/.markdown-lint.yml +++ b/.github/linters/.markdown-lint.yml @@ -1,3 +1 @@ -{ - "line-length": false -} +{ "line-length": false } diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0dc166a..deb0bd2 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@senzing.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at `support@senzing.com`. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17336a3..ee579d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,9 +14,9 @@ There are a number of ways you can contribute: ## License Agreements -If your contribution modifies the git repository, the following agreements must be established. +If your contribution modifies the Git repository, the following agreements must be established. -*Note:* License agreements are only needed for adding, modifying, and deleting artifacts kept within the repository. +_Note:_ License agreements are only needed for adding, modifying, and deleting artifacts kept within the repository. In simple terms, license agreements are needed before pull requests can be accepted. A license agreement is not needed for submitting feature request, bug reporting, or other project management. diff --git a/README.md b/README.md index 6b8542f..f3ac849 100644 --- a/README.md +++ b/README.md @@ -18,38 +18,74 @@ GitHub variable is `Linux`, `macOS`, or `Windows`. 1. An example `.github/workflows/install-senzing-example.yaml` file which installs the latest released Senzing API: - ```yaml - name: install senzing example + ```yaml + name: install senzing example - on: [push] + on: [push] - jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install Senzing API - uses: senzing-factory/github-action-install-senzing-api@v2 - with: - senzingapi-version: production-v3 - ``` + jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Senzing API + uses: senzing-factory/github-action-install-senzing-api@v4 + with: + senzingapi-version: production-v3 + ``` 1. An example `.github/workflows/install-senzing-example.yaml` file - which installs a specific Senzing API verson: + which installs a specific Senzing API version: - ```yaml - name: install senzing example + ```yaml + name: install senzing example - on: [push] + on: [push] - jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Install Senzing API - uses: senzing-factory/github-action-install-senzing-api@v2 - with: - senzingapi-version: 3.6.0-23160 - ``` + jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Senzing API + uses: senzing-factory/github-action-install-senzing-api@v4 + with: + senzingapi-version: 3.6.0-23160 + ``` + +1. An example `.github/workflows/install-senzing-example.yaml` file + which installs senzingapi-runtime and senzingapi-setup with a + specific Senzing API semantic version: + + ```yaml + name: install senzing example + + on: [push] + + jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Senzing API + uses: senzing-factory/github-action-install-senzing-api@v4 + with: + packages-to-install: "senzingapi-runtime senzingapi-setup" + senzingapi-version: 3.12.0 + ``` + +### package(s)-to-install + +`package(s)-to-install` values can include the following: + +- Version <= 3.X: + - `senzingapi` + - `senzingapi-runtime` + - `senzingapi-setup` + - `senzingapi-tools` + - `senzingdata-v` +- Version >= 4.0: + - `senzingapi-poc` + - `senzingapi-runtime` + - `senzingapi-setup` + - `senzingapi-tools` ### senzingapi-version @@ -57,16 +93,16 @@ GitHub variable is `Linux`, `macOS`, or `Windows`. - `production-v` - Ex. `production-v3` - - This will install the latest version of the respective major version from *production*. + - This will install the latest version of the respective major version from _production_. - `staging-v` - Ex. `staging-v3` - - This will install the latest version of the respective major version from *staging*. + - This will install the latest version of the respective major version from _staging_. - `X.Y.Z` - Ex. `3.8.2` - - This will install the latest build of the respective semantic version from *production*. + - This will install the latest build of the respective semantic version from _production_. - `X.Y.Z-ABCDE` - Ex. `3.8.3-24043` - - This will install the exact version supplied from *production*. + - This will install the exact version supplied from _production_. [RUNNER_OS]: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables [system install]: https://github.com/senzing-garage/knowledge-base/blob/main/WHATIS/senzing-system-installation.md diff --git a/action.yaml b/action.yaml index daaa8fb..26d7d5c 100644 --- a/action.yaml +++ b/action.yaml @@ -3,28 +3,32 @@ description: Install Senzing API Runtime based on platform. author: support@senzing.com inputs: - senzingapi-runtime-version: + packages-to-install: + description: Space separated list of Senzing packages to install. Linux only. + default: "senzingapi-runtime" + senzingapi-version: description: Version of Senzing API to install - required: true + default: "production-v3" runs: using: composite steps: - if: runner.os == 'Linux' name: Run on Linux - uses: senzing-factory/github-action-install-senzing-api/linux@v3 + uses: senzing-factory/github-action-install-senzing-api/linux@v4 with: - senzingapi-runtime-version: ${{ inputs.senzingapi-runtime-version }} + senzingapi-version: ${{ inputs.senzingapi-version }} + packages-to-install: ${{ inputs.packages-to-install }} - if: runner.os == 'macOS' name: Run on macOS - uses: senzing-factory/github-action-install-senzing-api/darwin@v3 + uses: senzing-factory/github-action-install-senzing-api/darwin@v4 with: senzingapi-version: ${{ inputs.senzingapi-version }} - if: runner.os == 'Windows' name: Run on Windows - uses: senzing-factory/github-action-install-senzing-api/windows@v3 + uses: senzing-factory/github-action-install-senzing-api/windows@v4 with: senzingapi-version: ${{ inputs.senzingapi-version }} diff --git a/darwin/action.yaml b/darwin/action.yaml index 4c141e3..1237c86 100644 --- a/darwin/action.yaml +++ b/darwin/action.yaml @@ -10,7 +10,6 @@ inputs: runs: using: composite steps: - # Install latest staging or production image. - env: diff --git a/linux/action.yaml b/linux/action.yaml index c2ac0ee..2b8a2c1 100644 --- a/linux/action.yaml +++ b/linux/action.yaml @@ -3,20 +3,23 @@ description: Install Senzing API Runtime on the linux platform. author: support@senzing.com inputs: - senzingapi-runtime-version: - description: Version of Senzing API Runtime to install - required: true + packages-to-install: + description: Space separated list of Senzing packages to install. Linux only. + default: "senzingapi-runtime" + senzingapi-version: + description: Version of Senzing API to install + default: "production-v3" 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 - SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-runtime-version }} - name: Install Senzing API Runtime + SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }} + name: Install Senzing API shell: bash run: ${{ github.action_path }}/install-senzing.sh diff --git a/linux/install-senzing.sh b/linux/install-senzing.sh index bf46ba9..e21d123 100755 --- a/linux/install-senzing.sh +++ b/linux/install-senzing.sh @@ -11,12 +11,14 @@ set -e configure-vars() { # senzing apt repository packages + 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=https://senzing-production-apt.s3.amazonaws.com/senzingrepo_1.0.1-1_all.deb - STAGING_REPO_V3_AND_LOWER=https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_1.0.1-1_all.deb + 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 - PROD_REPO_V4_AND_ABOVE=https://senzing-production-apt.s3.amazonaws.com/senzingrepo_2.0.0-1_all.deb - STAGING_REPO_V4_AND_ABOVE=https://senzing-staging-apt.s3.amazonaws.com/senzingstagingrepo_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" # semantic versions REGEX_SEM_VER="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$" @@ -25,36 +27,54 @@ configure-vars() { if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then - echo "[INFO] install senzingapi-runtime from production" + 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_PACKAGE="senzingapi-runtime" + SENZING_PACKAGES="$PACKAGES_TO_INSTALL" restrict-major-version elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then - echo "[INFO] install senzingapi-runtime from staging" + 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_PACKAGE="senzingapi-runtime" + SENZING_PACKAGES="$PACKAGES_TO_INSTALL" restrict-major-version elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER ]]; then - echo "[INFO] install senzingapi-runtime semantic version" + echo "[INFO] install $PACKAGES_TO_INSTALL semantic version" get-semantic-major-version is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER" - SENZING_PACKAGE="senzingapi-runtime=$SENZING_INSTALL_VERSION*" + IFS=" " read -r -a packages <<< "$PACKAGES_TO_INSTALL" + for package in "${packages[@]}" + do + if [[ ! $package == *"senzingdata-v"* ]]; then + updated_packages+="$package=$SENZING_INSTALL_VERSION* " + else + updated_packages+="$package " + fi + done + SENZING_PACKAGES="$updated_packages" elif [[ $SENZING_INSTALL_VERSION =~ $REGEX_SEM_VER_BUILD_NUM ]]; then - echo "[INFO] install senzingapi-runtime semantic version with build number" + echo "[INFO] install $PACKAGES_TO_INSTALL semantic version with build number" get-semantic-major-version is-major-version-greater-than-3 && INSTALL_REPO="$PROD_REPO_V4_AND_ABOVE" || INSTALL_REPO="$PROD_REPO_V3_AND_LOWER" - SENZING_PACKAGE="senzingapi-runtime=$SENZING_INSTALL_VERSION" + IFS=" " read -r -a packages <<< "$PACKAGES_TO_INSTALL" + for package in "${packages[@]}" + do + if [[ ! $package == *"senzingdata-v"* ]]; then + updated_packages+="$package=$SENZING_INSTALL_VERSION " + else + updated_packages+="$package " + fi + done + SENZING_PACKAGES="$updated_packages" else - echo "[ERROR] senzingapi-runtime install version $SENZING_INSTALL_VERSION is unsupported" + echo "[ERROR] $PACKAGES_TO_INSTALL install version $SENZING_INSTALL_VERSION is unsupported" exit 1 fi @@ -148,13 +168,16 @@ install-senzing-repository() { ############################################ # install-senzingapi # GLOBALS: -# SENZING_PACKAGE +# SENZING_PACKAGES # full package name used for install ############################################ install-senzingapi-runtime() { - - echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGE" - sudo --preserve-env apt-get -y install "$SENZING_PACKAGE" + + echo "[INFO] sudo apt list | grep senzing" + sudo apt list | grep senzing + echo "[INFO] sudo --preserve-env apt-get -y install $SENZING_PACKAGES" + # shellcheck disable=SC2086 + sudo --preserve-env apt-get -y install $SENZING_PACKAGES } @@ -168,6 +191,9 @@ install-senzingapi-runtime() { ############################################ verify-installation() { + echo "[INFO] sudo apt list --installed | grep senzing" + sudo apt list --installed | grep senzing + 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 diff --git a/windows/action.yaml b/windows/action.yaml index d142d92..b0c4139 100644 --- a/windows/action.yaml +++ b/windows/action.yaml @@ -11,7 +11,6 @@ inputs: runs: using: composite steps: - # Install latest staging or production image. - env: diff --git a/windows/install-senzing.sh b/windows/install-senzing.sh index b916e23..b063698 100755 --- a/windows/install-senzing.sh +++ b/windows/install-senzing.sh @@ -94,12 +94,11 @@ download-zip() { ############################################ -# install-senzing +# install-senzingapi ############################################ -install-senzing() { +install-senzingapi() { 7z x -y -o"C:\Program Files" senzingapi.zip - mv "C:\Program Files\senzing" "C:\Program Files\Senzing" } @@ -113,14 +112,14 @@ install-senzing() { ############################################ verify-installation() { - echo "[INFO] verify senzing installation" + echo "[INFO] verify senzingapi installation" is-major-version-greater-than-3 && BUILD_VERSION_PATH="er/szBuildVersion" || BUILD_VERSION_PATH="g2/g2BuildVersion" - if [ ! -f "/c/Program Files/senzing/$BUILD_VERSION_PATH.json" ]; then - echo "[ERROR] /c/Program Files/senzing/$BUILD_VERSION_PATH.json not found." + if [ ! -f "/c/Program Files/Senzing/$BUILD_VERSION_PATH.json" ]; then + echo "[ERROR] /c/Program Files/Senzing/$BUILD_VERSION_PATH.json not found." exit 1 else - echo "[INFO] cat /c/Program Files/senzing/$BUILD_VERSION_PATH.json" - cat "/c/Program Files/senzing/$BUILD_VERSION_PATH.json" + echo "[INFO] cat /c/Program Files/Senzing/$BUILD_VERSION_PATH.json" + cat "/c/Program Files/Senzing/$BUILD_VERSION_PATH.json" fi } @@ -129,9 +128,9 @@ verify-installation() { # Main ############################################ -echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION" +echo "[INFO] senzingapi version to install is: $SENZING_INSTALL_VERSION" configure-vars determine-latest-zip-for-major-version download-zip -install-senzing +install-senzingapi verify-installation