Skip to content

Commit

Permalink
Merge pull request #42 from DataRecce/refine/oso-codespace-for-anonym…
Browse files Browse the repository at this point in the history
…ous-users

[Refine] oso codespace for anonymous users
  • Loading branch information
kentwelcome authored May 31, 2024
2 parents 3aab744 + 895c161 commit db2a37e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
12 changes: 10 additions & 2 deletions .devcontainer/launch_recce_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ if [ -f "${DIR}/../recce_state.json" ]; then
echo "Launching the Recce server in review mode. The Recce state file is found."
recce server --review ${DIR}/../recce_state.json
else
echo "Launching the Recce server."
recce server
if [ -f "${DBT_GOOGLE_KEYFILE}" ]; then
echo "Preparing the dbt manifest."
pushd ${DIR}/../
dbt deps && dbt build && dbt docs generate
popd
echo "Launching the Recce server."
recce server
else
echo "Google cloud service account key is not found. Skip launching the Recce server."
fi
fi
2 changes: 0 additions & 2 deletions .devcontainer/post_start_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ if [ "${CODESPACES}" == "true" ]; then
# Check environment variables
bash .devcontainer/setup_required_env.sh

bash .devcontainer/prepare_dbt_manifest.sh

bash .devcontainer/launch_recce_server.sh

fi
5 changes: 5 additions & 0 deletions .devcontainer/prepare_dbt_manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if [ -f "${DIR}/../recce_state.json" ]; then
exit 0
fi

if [ ! -f "${DBT_GOOGLE_KEYFILE}" ]; then
echo "Google cloud service account key is not found. Skip preparing the dbt manifest."
exit 0
fi

echo "Preparing the dbt manifest."
pushd ${DIR}/../
dbt deps && dbt build && dbt docs generate
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/setup_required_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ if [ -z "$GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY_CONTENT" ]; then
gcloud auth list
exit 0
else
echo -e "[${GREEN}Action${ENDCOLOR}] Please login to Google cloud to continue."
gcloud auth application-default login
echo "User is not logged in Google cloud. Won't be able to run dbt commands."
fi
else
# Use the service account key to login
Expand Down

0 comments on commit db2a37e

Please sign in to comment.