Voy
Voy

Reputation: 6314

gcloud commands with --flatten or --format not working on Windows CMD or BAT

The following gcloud command using the --format option:

gcloud container images list-tags --format='value(digest)' [MY_IMAGE_URL]

Will run fine in a sh or bash (eg. through CMDER or Git Bash), yet will break if run from Command Prompt or within a CMD or BAT script:

ERROR: (gcloud.container.images.list-tags) Name expected [
    table(
        digest.slice(7:19).join(''),
        tags.list(),
        timestamp.date():optional,
        BUILD_DETAILS.buildDetails.provenance.sourceProvenance.context.cloudRepo.revisionId.notnull().list().slice(:8).join(''):optional:label=GIT_SHA,
        vuln_counts.list():optional:label=VULNERABILITIES,
        IMAGE_BASIS.derivedImage.sort(distance).map().extract(baseResourceUrl).slice(:1).map().list().list().split('//').slice(1:).list().split('@').slice(:1).list():optional:label=FROM,
        BUILD_DETAILS.buildDetails.provenance.id.notnull().list():optional:label=BUILD,
        DISCOVERY[0].discovered.analysisStatus:optional:label=VULNERABILITY_SCAN_STATUS
    )
 *HERE* 'value(digest)':(timestamp:sort=1:reverse)].

I've seen this Name expected ... *HERE* error occur with other Google Cloud Platform commands too. When the commands are run without any --format or --flatten modifiers they execute fine.

Any idea why this happens and how to prevent it?

Running most recent gcloud components: Google Cloud SDK 290.0.1, core 2020.04.24

Upvotes: 2

Views: 1665

Answers (1)

llompalles
llompalles

Reputation: 3186

Replacing single quotes ' with double quotes " solves the problem on Windows.

Upvotes: 5

Related Questions