带有 --flatten 或 --format 的 gcloud 命令不适用于 Windows CMD 或 BAT
gcloud commands with --flatten or --format not working on Windows CMD or BAT
以下gcloud command using the --format
option:
gcloud container images list-tags --format='value(digest)' [MY_IMAGE_URL]
将 运行 在 sh
或 bash
中正常(例如通过 CMDER 或 Git Bash),但如果 运行 来自命令提示符或在 CMD 或 BAT 脚本中:
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)].
我发现这个 Name expected ... *HERE*
错误也发生在其他 Google Cloud Platform 命令中。当命令 运行 没有任何 --format
或 --flatten
修饰符时,它们执行得很好。
知道为什么会发生这种情况以及如何预防吗?
运行 最近的 gcloud 组件:Google Cloud SDK 290.0.1, core 2020.04.24
用双引号 "
替换单引号 '
解决了 Windows 上的问题。
以下gcloud command using the --format
option:
gcloud container images list-tags --format='value(digest)' [MY_IMAGE_URL]
将 运行 在 sh
或 bash
中正常(例如通过 CMDER 或 Git Bash),但如果 运行 来自命令提示符或在 CMD 或 BAT 脚本中:
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)].
我发现这个 Name expected ... *HERE*
错误也发生在其他 Google Cloud Platform 命令中。当命令 运行 没有任何 --format
或 --flatten
修饰符时,它们执行得很好。
知道为什么会发生这种情况以及如何预防吗?
运行 最近的 gcloud 组件:Google Cloud SDK 290.0.1, core 2020.04.24
用双引号 "
替换单引号 '
解决了 Windows 上的问题。