Hi,
Need help in resolving the following error in theCloudBuild run with following content in cloudbuild.yaml file,:
steps:
- name: gcr.io/cloud-builders/docker
entrypoint: bash
args:
- -c
- |
docker run --rm --mount type=bind,source=$(PWD),target=/scan registry.fortidevsec.forticloud.com/fdevsec_sast:latest
Here, the main differences between $(pwd) and $PWD have been discussed, where the first one that uses the parentheses is only a variable that ends up replacing it with the built-in $PWD variable from the shell. At the end, both variables can fail if they are not properly set up or if the shell you are using to deploy these files does support the $() syntax.
It was tested without the parentheses and it worked fine. However, you should check how it works on your side and if you have the correct working directory when deploying.
As an extra comment, I would like to say that even if PWD is not a substitution, you need to follow certain guidelines described here, and these do not include the parentheses either, instead try using curly brackets {} (or not using them also works) and an _underscore at the beginning.