Skip to content

Commit

Permalink
Shellcheck and CI for install script (#440)
Browse files Browse the repository at this point in the history
* Terraform fmt

* fmt

* Remove unsued tfsec and tflint

* Rename pipeline file

* k8s plain manifests linters

* Mkdocs for hetzner docs

* Docker update

* fix

* Apply suggestions from code review

* Test image building

* Get rid of advanced image from cloud

* Remove all mentions of advanced image

* fix action

* fix

* fix conflicts

* Pass -e ENABLE_PRIMITIVE=false to ansible

* Return action

* Revert Dockerfile

* Shell linting

* Disable checking for binary

* Try new shellcheck

* Trigger CI

* use docker

* mount

* fix typo

* Return comment

* Use docker for windows

* Use choco for win

* Disable carriage return error

* Fix

Co-authored-by: Bohdan Ivashko <[email protected]>
  • Loading branch information
Amet13 and arriven authored Mar 26, 2022
1 parent dd94570 commit c7f48fe
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/test-installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,32 @@ on:
- "main"
paths:
- 'install.sh'
- '.github/workflows/test-installer.yaml'

jobs:
test:
ubuntu-mac-test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
- name: Installer
run: ./install.sh
windows-test:
strategy:
matrix:
os: [windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run ShellCheck
run: |
choco install shellcheck
shellcheck --exclude SC1017 install.sh
- name: Installer
run: ./install.sh
11 changes: 6 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ esac

INSTALL_VERSION="${INSTALL_OS}_${INSTALL_ARCH}"

BROWSER_DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${REPO}/releases/latest | grep "${INSTALL_VERSION}" | grep -Eo 'https://[^\"]*')
CHECKSUM_DOWNLOAD_URL=$(curl -s https://api.github.com/repos/${REPO}/releases/latest | grep "checksums" | grep -Eo 'https://[^\"]*')
BROWSER_DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep "${INSTALL_VERSION}" | grep -Eo 'https://[^\"]*')
CHECKSUM_DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | grep "checksums" | grep -Eo 'https://[^\"]*')

ARCHIVE=${BROWSER_DOWNLOAD_URL##*/}
CHECKSUMS_FILE=${CHECKSUM_DOWNLOAD_URL##*/}

echo "Downloading an archive..."
echo $BROWSER_DOWNLOAD_URL | xargs -n 1 curl -s -L -O
echo "${BROWSER_DOWNLOAD_URL}" | xargs -n 1 curl -s -L -O
echo "Downloading checksums..."
echo $CHECKSUM_DOWNLOAD_URL | xargs -n 1 curl -s -L -O
echo "${CHECKSUM_DOWNLOAD_URL}" | xargs -n 1 curl -s -L -O

if [ "${INSTALL_OS}" = "darwin" ]
then
Expand All @@ -57,8 +57,9 @@ if ! command -v "${SHA256_BINARY}" &> /dev/null
then
echo "Warning: sha256sum/shasum not found. Could not check archive integrity. Please be careful when launching the executable."
else
# shellcheck disable=SC2086
SHA256SUM=$(${SHA256_BINARY} ${SHA256_SUFFIX} ${ARCHIVE})
if ! grep -q ${SHA256SUM} "$CHECKSUMS_FILE"; then
if ! grep -q "${SHA256SUM}" "${CHECKSUMS_FILE}"; then
echo "shasum for ${ARCHIVE} failed. Please check the shasum. File may possibly be corrupted."
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion terraform/heroku/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Latest release: https://github.com/Arriven/db1000n/releases/latest
app_version = "0.8.2"
app_version = "0.8.9"

# If you want to use more that 1 instance and larger instance type
# make sure that your Credit Card is attached to the account
Expand Down

0 comments on commit c7f48fe

Please sign in to comment.