issue: termcolor error when using bq from github actions
terekete opened this issue · comments
terekete commented
TL;DR
When running a BQ command from github actions, there is an error about not being able to resolve termcolor.
Expected behavior
This worked previously. The BQ command runs successfully.
Observed behavior
Errors out on the BQ command like this:
File "/opt/hostedtoolcache/gcloud/457.0.0/x64/platform/bq/bq.py", line [76](https://github.com/owner/project/actions/runs/7212960765/job/19651769692#step:8:77)[80](https://github.com/owner/project/actions/runs/7212960765/job/19651769692#step:8:81), in RunWithArgs
termcolor.cprint(
^^^^^^^^^
NameError: name 'termcolor' is not defined
Action YAML
name: get_carto
on:
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
get_carto:
runs-on: ubuntu-latest
permissions:
contents: "write"
pull-requests: "write"
id-token: "write"
steps:
- name: repo_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: get_auth
id: get_auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER_GCP }}
service_account: cicd@project.iam.gserviceaccount.com
project_id: project
token_format: access_token
- name: get_gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: project
- name: get_carto
run: |
gsutil cp gs://carto-analytics-toolbox-advanced/bigquery/carto-analytics-toolbox-bigquery-1.9.0.zip .
unzip carto-analytics-toolbox-bigquery-1.9.0.zip
ls -la
pip install --upgrade termcolor
cd carto-analytics-toolbox-bigquery-1.9.0
bq query --use_legacy_sql=false --project_id=project 'CREATE TABLE IF NOT EXISTS carto.spatial_catalog_datasets(dataset_id string,dataset_slug string,dataset_name string,dataset_country string,dataset_category string,dataset_provider string,dataset_version string,dataset_geom_type string,dataset_is_public boolean,dataset_is_product boolean,associated_geography_id string);'
Log output
========================================
== Platform ==
CPython:3.11.6:Linux-6.2.0-1018-azure-x86_64-with-glibc2.35
== bq version ==
2.0.100
== Command line ==
['/opt/hostedtoolcache/gcloud/457.0.0/x64/platform/bq/bq.py', '--application_default_credential_file', '/home/runner/.config/gcloud/legacy_credentials/project@e.iam.gserviceaccount.com/adc.json', '--credential_file', '/home/runner/.config/gcloud/legacy_credentials/project.iam.gserviceaccount.com/singlestore_bq.json', '--project_id=project', 'query', '--use_legacy_sql=false', '--project_id=project', 'CREATE TABLE IF NOT EXISTS carto.spatial_catalog_datasets(dataset_id string,dataset_slug string,dataset_name string,dataset_country string,dataset_category string,dataset_provider string,dataset_version string,dataset_geom_type string,dataset_is_public boolean,dataset_is_product boolean,associated_geography_id string);']
== UTC timestamp ==
2023-12-14 18:22:08
== Error trace ==
Traceback (most recent call last):
File "/opt/hostedtoolcache/gcloud/457.0.0/x64/platform/bq/bq.py", line 891, in RunSafely
return_value = self.RunWithArgs(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/gcloud/457.0.0/x64/platform/bq/bq.py", line [76](https://github.com/... /actions/runs/7212960765/job/19651769692#step:8:77)[80](https://github.com/owner/project/actions/runs/7212960765/job/19651769692#step:8:81), in RunWithArgs
termcolor.cprint(
^^^^^^^^^
NameError: name 'termcolor' is not defined
Additional information
No response
terekete commented
Additional note, I tried with version set to : 455.0.0 (2023-11-14), this works.
Seth Vargo commented
Duplicate of #666. Please file a bug with the bq CLI: https://issuetracker.google.com/issues/new?component=187149&template=0