Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Hotfix shell script issues #6

Merged
merged 3 commits into from
Aug 22, 2023
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
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ echo "Starting AWS Glue crawler run" | ts '%.s' | tee -a "$TEMP_LOG_FILE"

# Trigger a workflow to run all dbt tests now that new data is uploaded, but
# don't let this step crash the log upload
source scripts/dispatch-dbt-workflow.sh || true \
(source scripts/dispatch-dbt-workflow.sh || true) \
| ts '%.s' \
| tee -a "$TEMP_LOG_FILE"

Expand Down
13 changes: 7 additions & 6 deletions scripts/dispatch-dbt-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ GH_JWT=$(python3 scripts/get-jwt.py)

# Grab the token URL from our current installation
echo "Fetching GitHub tokens URL"
GH_TOKENS_URL=$(curl -s --request GET \
--url "https://api.github.com/app/installations" \
--header "Accept: application/vnd.github+json" \
--header "Authorization: Bearer ${GH_JWT}" \
--header "X-GitHub-Api-Version: 2022-11-28" \
GH_TOKENS_URL=$(curl -s -L \
-X GET \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_JWT}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/app/installations \
| jq -r '.[].access_tokens_url')

# Auth against the tokens URL to get a short-lived (60 second) token
Expand All @@ -29,7 +30,7 @@ GH_TOKEN=$(curl -s -L \

# Use the token to call the API and dispatch the workflow
echo "Dispatching workflow"
curl -v -L \
curl -s -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-sqoop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ for TABLE in ${JOB_TABLES}; do
else
# Make number of mappers roughly equal to number of tax years
if [[ "$QUERY_COND" == \> ]]; then
NUM_MAPPERS=$(($(date +%Y) - "$QUERY_YEAR"))
NUM_MAPPERS=$(($(date +%Y) - QUERY_YEAR))
elif [[ ${QUERY_COND} == \< ]]; then
NUM_MAPPERS=$(("$QUERY_YEAR" - 1998))
NUM_MAPPERS=$((QUERY_YEAR - 1998))
else
NUM_MAPPERS=1
fi
Expand Down