Create ~/.bigqueryrc without GCLOUD_SERVICE_KEY (#112)
This commit is contained in:
Родитель
fddc1ab301
Коммит
c2e416cefd
|
@ -0,0 +1,9 @@
|
|||
--dataset_id=telemetry
|
||||
[mk]
|
||||
--use_legacy_sql=false
|
||||
[query]
|
||||
--use_legacy_sql=false
|
||||
--replace=true
|
||||
--max_rows=0
|
||||
[update]
|
||||
--use_legacy_sql=false
|
|
@ -13,5 +13,6 @@ COPY --from=google/cloud-sdk:alpine /google-cloud-sdk /google-cloud-sdk
|
|||
ENV PATH /google-cloud-sdk/bin:$PATH
|
||||
COPY --from=0 /usr/local /usr/local
|
||||
WORKDIR /app
|
||||
COPY .bigqueryrc /root/
|
||||
COPY . .
|
||||
ENTRYPOINT ["/app/script/entrypoint"]
|
||||
|
|
|
@ -9,22 +9,12 @@ if [ -n "$GCLOUD_SERVICE_KEY" ]; then
|
|||
# See https://cloud.google.com/docs/authentication/production
|
||||
export GOOGLE_APPLICATION_CREDENTIALS="${GOOGLE_APPLICATION_CREDENTIALS:-/tmp/gcp.json}"
|
||||
echo "$GCLOUD_SERVICE_KEY" > "$GOOGLE_APPLICATION_CREDENTIALS"
|
||||
if which -s gcloud; then
|
||||
gcloud --quiet auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
|
||||
python -W ignore -c 'import google.auth; print("project = ", google.auth.default()[1])' >> ~/.config/gcloud/configurations/config_default
|
||||
cat > ~/.bigqueryrc << EOF
|
||||
--project_id=$(gcloud config get-value project)
|
||||
--dataset_id=telemetry
|
||||
[mk]
|
||||
--use_legacy_sql=false
|
||||
[query]
|
||||
--use_legacy_sql=false
|
||||
--replace=true
|
||||
--max_rows=0
|
||||
[update]
|
||||
--use_legacy_sql=false
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$GOOGLE_APPLICATION_CREDENTIALS" ] && which gcloud > /dev/null; then
|
||||
gcloud --quiet auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS"
|
||||
python -W ignore -c 'import google.auth; print("project = ", google.auth.default()[1])' >> ~/.config/gcloud/configurations/config_default
|
||||
sed "1i--project_id=$(gcloud config get-value project)" -i ~/.bigqueryrc
|
||||
fi
|
||||
|
||||
if [ "$#" = 0 ]; then
|
||||
|
|
Загрузка…
Ссылка в новой задаче