Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#69 Backwards compatibility for versions < 4 #70

Merged
merged 9 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"threshold": 3
"ignore": [
"**/install*.sh"
]
}
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
[markdownlint](https://dlaa.me/markdownlint/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog],
[markdownlint],
and this project adheres to [Semantic Versioning].

## [Unreleased]

Expand Down Expand Up @@ -72,3 +72,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added to 1.0.0

- Install Senzing API on Linux, macOS, and Windows

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[markdownlint]: https://dlaa.me/markdownlint/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
54 changes: 32 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

Welcome to the project!

We encourage contribution in a manner consistent with the [Code of Conduct](CODE_OF_CONDUCT.md).
We encourage contribution in a manner consistent with the [Code of Conduct].
The following will guide you through the process.

There are a number of ways you can contribute:

1. [Asking questions](#questions)
1. [Requesting features](#feature-requests)
1. [Reporting bugs](#bug-reporting)
1. [Contributing code or documentation](#contributing-code-or-documentation)
1. [Asking questions]
1. [Requesting features]
1. [Reporting bugs]
1. [Contributing code or documentation]

## License Agreements

Expand All @@ -23,19 +23,19 @@ A license agreement is not needed for submitting feature request, bug reporting,
### Individual Contributor License Agreement

In order to contribute to this repository, an
[Individual Contributor License Agreement (ICLA)](.github/senzing-individual-contributor-license-agreement.pdf)
[Individual Contributor License Agreement (ICLA)]
must be completed, submitted and accepted.

### Corporate Contributor License Agreement

If the contribution to this repository is on behalf of a company, a
[Corporate Contributor License Agreement (CCLA)](.github/senzing-corporate-contributor-license-agreement.pdf)
[Corporate Contributor License Agreement (CCLA)]
must also be completed, submitted and accepted.

### Project License Agreement

The license agreement for this repository is stated in the
[LICENSE](LICENSE) file.
[LICENSE] file.

## Questions

Expand All @@ -50,7 +50,7 @@ TODO: Instead, use ???

All feature requests are "GitHub issues".
To request a feature, create a
[GitHub issue](https://help.github.com/articles/creating-an-issue/)
[GitHub issue]
in this repository.

When creating an issue, there will be a choice to create a "Bug report" or a "Feature request".
Expand All @@ -59,20 +59,17 @@ Choose "Feature request".
## Bug Reporting

All bug reports are "GitHub issues".
Before reporting on a bug, check to see if it has
[already been reported](https://github.com/search?q=+is%3Aissue+user%3Asenzing).
To report a bug, create a
[GitHub issue](https://help.github.com/articles/creating-an-issue/)
in this repository.
Before reporting on a bug, check to see if it has [already been reported].
To report a bug, create a [GitHub issue] in this repository.

When creating an issue, there will be a choice to create a "Bug report" or a "Feature request".
Choose "Bug report".

## Contributing code or documentation

To contribute code or documentation to the repository, you must have
[License Agreements](#license-agreements) in place.
This needs to be complete before a [Pull Request](#pull-requests) can be accepted.
[License Agreements] in place.
This needs to be complete before a [Pull Request] can be accepted.

### Setting up a development environment

Expand All @@ -82,8 +79,8 @@ These variables may be modified, but do not need to be modified.
The variables are used throughout the installation procedure.

```console
export GIT_ACCOUNT=senzing
export GIT_REPOSITORY=github-action-install-senzing
export GIT_ACCOUNT=senzing-factory
export GIT_REPOSITORY=github-action-install-senzing-api
```

Synthesize environment variables.
Expand Down Expand Up @@ -116,9 +113,22 @@ TODO:
### Pull Requests

Code in the main branch is modified via GitHub pull request.
Follow GitHub's
[Creating a pull request from a branch](https://help.github.com/articles/creating-a-pull-request/)
or
[Creating a pull request from a fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) instructions.
Follow GitHub's [Creating a pull request from a branch] or
[Creating a pull request from a fork] instructions.

Accepting pull requests will be at the discretion of Senzing, Inc. and the repository owner(s).

[already been reported]: https://github.com/search?q=+is%3Aissue+user%3Asenzing
[Asking questions]: #questions
[Code of Conduct]: CODE_OF_CONDUCT.md
[Contributing code or documentation]: #contributing-code-or-documentation
[Corporate Contributor License Agreement (CCLA)]: .github/senzing-corporate-contributor-license-agreement.pdf
[Creating a pull request from a branch]: https://help.github.com/articles/creating-a-pull-request/
[Creating a pull request from a fork]: https://help.github.com/articles/creating-a-pull-request-from-a-fork/
[GitHub issue]: https://help.github.com/articles/creating-an-issue/
[Individual Contributor License Agreement (ICLA)]: .github/senzing-individual-contributor-license-agreement.pdf
[LICENSE]: LICENSE
[License Agreements]: #license-agreements
[Pull Request]: #pull-requests
[Reporting bugs]: #bug-reporting
[Requesting features]: #feature-requests
20 changes: 2 additions & 18 deletions darwin/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,13 @@ runs:
using: composite
steps:

# Download latest staging or production image.
# Install latest staging or production image.

- env:
SENZING_INSTALL_VERSION: ${{ inputs.senzingapi-version }}
name: Install Senzing API
shell: bash
run: ${{ github.action_path }}/download-senzing.sh

# Install Senzing API.

- name: Install Senzing API
shell: bash
run: |
ls -tlc /tmp/
hdiutil attach /tmp/senzingapi.dmg
sudo mkdir -p /opt/senzing/
sudo cp -R /Volumes/SenzingAPI/senzing/er /opt/senzing

# Verify installation.

- name: Verify installed Senzing API version
shell: bash
run: cat /opt/senzing/er/szBuildVersion.json
run: ${{ github.action_path }}/install-senzing.sh

branding:
icon: download
Expand Down
71 changes: 0 additions & 71 deletions darwin/download-senzing.sh

This file was deleted.

144 changes: 144 additions & 0 deletions darwin/install-senzing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/usr/bin/env bash
set -e

############################################
# configure-vars
# GLOBALS:
# SENZING_INSTALL_VERSION
# one of: production-v<X>, staging-v<X>
############################################
configure-vars() {

if [[ $SENZING_INSTALL_VERSION =~ "production" ]]; then

echo "[INFO] install senzingapi from production"
SENZINGAPI_URI="s3://public-read-access/MacOS_API/"
SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/MacOS_API"

elif [[ $SENZING_INSTALL_VERSION =~ "staging" ]]; then

echo "[INFO] install senzingapi from staging"
SENZINGAPI_URI="s3://public-read-access/staging/"
SENZINGAPI_URL="https://public-read-access.s3.amazonaws.com/staging"

else
echo "[ERROR] senzingapi install version $SENZING_INSTALL_VERSION is unsupported"
exit 1
fi

}

############################################
# get-generic-major-version
# GLOBALS:
# SENZING_INSTALL_VERSION
# one of: production-v<X>, staging-v<X>
# semver does not apply here
############################################
get-generic-major-version(){

MAJOR_VERSION=$(echo "$SENZING_INSTALL_VERSION" | grep -Eo '[0-9]+$')
echo "[INFO] major version is: $MAJOR_VERSION"
export MAJOR_VERSION

}

############################################
# is-major-version-greater-than-3
# GLOBALS:
# MAJOR_VERSION
# set prior to this call via
# get-generic-major-version
############################################
is-major-version-greater-than-3() {

if [[ $MAJOR_VERSION -gt 3 ]]; then
return 0
else
return 1
fi

}

############################################
# determine-latest-dmg-for-major-version
# GLOBALS:
# SENZING_INSTALL_VERSION
# one of: production-v<X>, staging-v<X>
# SENZINGAPI_URI
############################################
determine-latest-dmg-for-major-version() {

get-generic-major-version

aws s3 ls $SENZINGAPI_URI --recursive --no-sign-request | grep -o -E '[^ ]+.dmg$' > /tmp/staging-versions
latest_staging_version=$(< /tmp/staging-versions grep "_$MAJOR_VERSION" | sort -r | head -n 1 | grep -o '/.*')
rm /tmp/staging-versions
echo "[INFO] latest staging version is: $latest_staging_version"

SENZINGAPI_DMG_URL="$SENZINGAPI_URL$latest_staging_version"

}

############################################
# download-dmg
# GLOBALS:
# SENZINGAPI_DMG_URL
############################################
download-dmg() {

echo "[INFO] curl --output /tmp/senzingapi.dmg $SENZINGAPI_DMG_URL"
curl --output /tmp/senzingapi.dmg "$SENZINGAPI_DMG_URL"

}

############################################
# install-senzing
# GLOBALS:
# MAJOR_VERSION
# set prior to this call via either
# get-generic-major-version or
# get-semantic-major-version
############################################
install-senzing() {

ls -tlc /tmp/
hdiutil attach /tmp/senzingapi.dmg
sudo mkdir -p /opt/senzing/
is-major-version-greater-than-3 && SENZING_PATH="er" || SENZING_PATH="g2"
sudo cp -R /Volumes/SenzingAPI/senzing/"$SENZING_PATH" /opt/senzing

}

############################################
# verify-installation
# GLOBALS:
# MAJOR_VERSION
# set prior to this call via either
# get-generic-major-version or
# get-semantic-major-version
############################################
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
echo "[ERROR] /opt/senzing/$BUILD_VERSION_PATH.json not found."
exit 1
else
echo "[INFO] cat /opt/senzing/$BUILD_VERSION_PATH.json"
cat /opt/senzing/"$BUILD_VERSION_PATH".json
fi

}

############################################
# Main
############################################

echo "[INFO] senzing version to install is: $SENZING_INSTALL_VERSION"
configure-vars
determine-latest-dmg-for-major-version
download-dmg
install-senzing
verify-installation
Loading