Skip to content

Commit

Permalink
#65 optionally supply a package or list of packages to install (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelsam authored Oct 4, 2024
1 parent 5ff4a1d commit b72d104
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 90 deletions.
6 changes: 2 additions & 4 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"ignore": [
"**/install*.sh"
]
}
"ignore": ["**/install*.sh"]
}
4 changes: 1 addition & 3 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
{
"line-length": false
}
{ "line-length": false }
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
94 changes: 65 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,91 @@ 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<X>`
- Version >= 4.0:
- `senzingapi-poc`
- `senzingapi-runtime`
- `senzingapi-setup`
- `senzingapi-tools`

### senzingapi-version

`senzingapi-version` values can include the following:

- `production-v<MAJOR_VERSION>`
- 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<MAJOR_VERSION>`
- 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
16 changes: 10 additions & 6 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
1 change: 0 additions & 1 deletion darwin/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ inputs:
runs:
using: composite
steps:

# Install latest staging or production image.

- env:
Expand Down
15 changes: 9 additions & 6 deletions linux/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
60 changes: 43 additions & 17 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
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]*)$"
Expand All @@ -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

Expand Down Expand Up @@ -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

}

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion windows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ inputs:
runs:
using: composite
steps:

# Install latest staging or production image.

- env:
Expand Down
Loading

0 comments on commit b72d104

Please sign in to comment.