0

I'm calling Cloud Build from Workflows using the connector. One of the arguments (called command_string_full below) that I pass to Cloud Build (a bash command) contains double quotes which I can't omit. However these double quotes seem to get escaped with \ before/while they are sent to Cloud Build, which makes the content of the argument invalid. From what I can gather, it's the connector that does the escaping. How do I prevent this from happening?

My step looks like:

gcloud:
  params: [args]
  steps:
  - create_build:
      call: googleapis.cloudbuild.v1.projects.builds.create
      args:
        projectId: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
        parent: ${"projects/" + sys.get_env("GOOGLE_CLOUD_PROJECT_ID") + "/locations/global"}
        body:
          serviceAccount: ${sys.get_env("GOOGLE_CLOUD_SERVICE_ACCOUNT_NAME")}
          options:
            logging: CLOUD_LOGGING_ONLY
          steps:
          - name: gcr.io/google.com/cloudsdktool/cloud-sdk
            entrypoint: /bin/bash
            args: ${["-c", command_string_full + " > $$BUILDER_OUTPUT/output"]}
      result: result_builds_create
  - return_build_result:
      return: ${text.split(text.decode(base64.decode(result_builds_create.metadata.build.results.buildStepOutputs[0])), "\n")}

I know a feature is coming which makes it possible to call gcloud directly without using Cloud Build, but I don't have access to the preview (I'm also interested in getting access to preview features in GCP, but I don't know where to apply).

honeybees
  • 41
  • 7

0 Answers0