The variable is returning empty in my Python script

35 views Asked by At

I am working on a Python script and using GCP Cloud Build to run it. Instead of hardcoding some of the variables, I am trying to use a Cloud Build YAML file to define the variables there and then use them in my Python script. However, it keeps returning an empty string. Can you review the code and let me know why?

yaml file

 steps
    args:
  - 'python3'
  - 'test.py'
  - '--project=${_PROJECT_ID}'
  - '--dataset=${_DATASET_ID}'
  - '--table=${_TABLE_NAME}'

substitutions:
_PROJECT_ID: 'test1det'
_DATASET_ID: 'testdataset'
_TABLE_NAME: 'testtable'

python code test.py

def tst(
    project_id: str=os.getenv('_PROJECT_ID', 'default_project_id'),
    dataset_id: str=os.getenv('_DATASET_ID', 'default_dataset_id'),
    table_name: str=os.getenv('_TABLE_NAME', 'default_table_name')
):
0

There are 0 answers