简体   繁体   中英

How to set the environment variable in cloudbuild.yaml file?

I am trying to set GOOGLE_APPLICATION_CREDENTIALS. Is this correct way to set environment variable? Below is my yaml file:

steps:
- name: 'node:10.10.0'
  id: installing_npm
  args: ['npm', 'install']
  dir: 'API/system_performance'
- name: 'node:10.10.0'
  #entrypoint: bash
  args: ['bash', 'set GOOGLE_APPLICATION_CREDENTIALS=test/emc-ema-cp-d-267406-a2af305d16e2.json']
  id: run_test_coverage
  args: ['npm', 'run', 'coverage']
  dir: 'API/system_performance'

Please help me solve this.

You can use the env step parameter

However, when you execute Cloud Build, the platform uses its own service account (in the future, it will be possible to specify the service account that you want to use)

Thus, if you grant the Cloud Build service account with the correct role, you don't need to use a key file (which is committed in your Git repository, not a really good practice!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM