Skip to content

Commit

Permalink
fix: grab jq-1.6 if running with an older version
Browse files Browse the repository at this point in the history
  • Loading branch information
chetan committed Dec 10, 2021
1 parent e49eefd commit 42e3ce8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- name: print versions
shell: bash
run: |
uname
uname -a
aws --version
jq --version
jq --help
Expand Down
17 changes: 16 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ if [ "$DEBUG" = "1" ]; then
set -x
fi

# Ensure we have jq-1.6
jq="jq"
if [[ "$($jq --version)" != "jq-1.6" ]]; then
if [[ $(uname) == "Darwin" ]]; then
jqbin="jq-osx-amd64"
elif [[ $(uname) == "Linux" ]]; then
jqbin="jq-linux64"
fi
if [[ -n "$jqbin" ]]; then
jq="/usr/local/bin/jq16"
wget -O $jq https://github.com/stedolan/jq/releases/download/jq-1.6/$jqbin
chmod 755 $jq
fi
fi

if [[ -n "$PATHS_FROM" ]]; then
echo "*** Reading PATHS from $PATHS_FROM"
if [[ ! -f $PATHS_FROM ]]; then
Expand All @@ -71,7 +86,7 @@ fi
# i.e., if PATHS="/* /foo"
IFS=' ' read -r -a PATHS_ARR <<< "$PATHS"
echo -n "${PATHS}" > "${RUNNER_TEMP}/paths.txt"
JSON_PATHS=$(jq --null-input --compact-output --monochrome-output --rawfile inarr "${RUNNER_TEMP}/paths.txt" '$inarr | rtrimstr(" ") | rtrimstr("\n") | split(" ")')
JSON_PATHS=$($jq --null-input --compact-output --monochrome-output --rawfile inarr "${RUNNER_TEMP}/paths.txt" '$inarr | rtrimstr(" ") | rtrimstr("\n") | split(" ")')
LEN="${#PATHS_ARR[@]}"
CR=$(date +"%s")
cat <<-EOF > "${RUNNER_TEMP}/invalidation-batch.json"
Expand Down

0 comments on commit 42e3ce8

Please sign in to comment.