How should I edit my cloudbuild.yaml file so that I can pass multiple environment variables as secrets?
I have stored two authentication tokens in two separate files, SECRET1.txt and SECRET2.txt on my local machine's current working directory.
I want to pass both these authentication tokens as secrets to Google Cloud Build using KMS.
How should the cloudbuild.yaml file look like so that my tokens are safely accessed by Cloud Build?
I tried to use encrypted secrets found here https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-secrets-credentials
Here is what I tried for cloudbuild.yaml:
steps:
- name: "gcr.io/cloud-builders/gcloud"
secretEnv: ['SECRET1', 'SECRET2']
timeout: "1600s"
secrets:
- kmsKeyName: projects/<Project-Name>/locations/global/keyRings/<Key-Ring-Name>/cryptoKeys/<Key-Name>
secretEnv:
SECRET1: <encrypted-key-base64 here>
SECRET2: <encrypted-key-base64 here>
I am getting this error message: Error
Cloud Build is able to read the token(I have struck it out using RED ink here Error), yet it outputs an error message saying that 'Error: ENOENT: no such file or directory'.
Can anyone tell me what went wrong in my approach and why Cloud Build is not able to access these authentication tokens(secrets)?