我想获取与特定模式匹配的标签列表,为此我一直在使用以下命令:
gcloud container images list-tags gcr.io/project/reposiory --format="json" --filter="tags:*_master"
但我收到这个警告:
WARNING: --filter : operator evaluation is changing for consistency across Google APIs. tags:*_master currently matches but will not match in the near future. Run `gcloud topic filters` for details.
我已经四处搜寻,但找不到我应该如何继续执行此操作。有谁知道我如何以这种方式匹配模式,即所有以“_master”结尾的标签?
我configurations通过gcloud init命令创建了多个。如何configurations在 Google Cloud Shell (CLI) 中进行切换?
在本地计算机中成功安装 google cloud SDK 后,我遇到了命令行问题:“gcloud init”。错误出现如下:
云初始化
欢迎!此命令将引导您完成 gcloud 的配置。
您当前的配置已设置为:[默认]
您可以使用以下标志下次跳过诊断:gcloud init --skip-diagnostics
网络诊断检测并修复本地网络连接问题。检查网络连接...完成。
可达性检查已通过。
网络诊断已通过(1/1 检查已通过)。
您需要登录才能继续操作。您想登录(是/否)吗?是
错误:gcloud 崩溃(NotADirectoryError):[Errno 20] 不是目录:“xdg-settings”
如果您想报告此问题,请运行以下命令:
云反馈
要检查 gcloud 是否存在常见问题,请运行以下命令:
gcloud 信息 --run-diagnostics "
我尝试使用此链接进行修复,但它在我的环境中不起作用。如果您有任何想法并希望我提供任何内容,请告诉我,请随时询问我。
最好的问候,PNV
我计划使用“in”查询选择器根据 ID 列表返回多个文档。不过,在此示例中我简化为使用“==”:
collection := server.Firestore.Collection("foo")
// Add a document:
ref, _, err := collection.Add(ctx, map[string]string{"a": "b"})
if err != nil {
panic(err)
}
// Here's the document ID:
fmt.Println("ref.ID", ref.ID)
// Get all the documents in the collection just to check it's there:
allDocs, err := collection.Query.Documents(ctx).GetAll()
if err != nil {
panic(err)
}
fmt.Println("len(allDocs):", len(allDocs))
// Check our document is the one in the collection:
fmt.Println("allDocs[0].Ref.ID", allDocs[0].Ref.ID)
// Get the document using __name__ query:
docQuery, err := collection.Query.Where(firestore.DocumentID, …Run Code Online (Sandbox Code Playgroud) 我有一个带有 DockerFile 的 java 项目,如下所示:
FROM openjdk:8-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} shape-shop-backend.jar
ENTRYPOINT ["java","-jar","/shape-shop-backend.jar"]
Run Code Online (Sandbox Code Playgroud)
如果我像这样运行 docker :
C:\dev\shape-shop>docker build -t testtest:1.0
Run Code Online (Sandbox Code Playgroud)
它完美地构建了一个图像。
我假设“gcloud builds Submit”以同样的方式工作。我在谷歌云上有一个名为whataboutanewproject的项目,因此在同一目录中我运行以下命令:
C:\dev\shape-shop>gcloud builds submit --tag gcr.io/whataboutanewproject/shapeshop
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
Digest: sha256:94792824df2df33402f201713f932b58cb9de94a0cd524164a0f2283343547b3
Status: Downloaded newer image for openjdk:8-jdk-alpine
---> a3562aa0b991
Step 2/6 : RUN addgroup -S spring && adduser -S spring -G spring
---> Running in 36cf2156a797
Removing intermediate container 36cf2156a797
---> 7320b32f6fe1
Step 3/6 …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取我的 GCP 项目的项目名称。首先,我尝试使用命令:
gcloud projects describe $PROJECT_ID
Run Code Online (Sandbox Code Playgroud)
在这里您可以获取项目 ID、编号名称、组织和其他详细信息。
然后接下来使用grep命令获取项目名称。
我正在开发一个新项目,计划用 Google Cloud Go API 和客户端库替换一组调用 和 的一次性 shellgcloud脚本gsutil。这背后的主要驱动力是让我可以拥有更容易维护和可测试的代码来管理大型 GCP 自动化项目。
我翻遍了所有 Google 文档,似乎找不到任何涵盖底层 APIglcoud调用或glcoud源代码的内容。除此之外,GCP go API 似乎并没有涵盖我正在寻找的内容。我已经能够在 REST API 中找到我需要的一些内容,但即便如此,仍不完全清楚哪些gcloud命令映射到哪些 REST API 端点。
一个例子是:gcloud addresses describe gce_vm_foo
我能找到的唯一合适的就是 REST API 中的这个端点,它是通过挖掘大量文档和反复试验发现的: https: //godoc.org/google.golang.org/api/compute/v1#实例服务.Get
我意识到这是一个非常开放式的问题,但是任何指向正确方向的指示都非常感谢。
我有一个 fastapi 应用程序,我想将其部署到 google cloud run。
对于 gRPC python 项目,我们将其部署为
gcloud beta run deploy countries --source .
Run Code Online (Sandbox Code Playgroud)
但这并没有按预期部署。我观看了一个使用Google cloud buildpacks从源代码部署的视频。
有没有人有办法做到这一点?
我的代码就像
from typing import List
import geopandas as gpd
from fastapi import FastAPI
from geojson_pydantic.geometries import Geometry
from geojson_pydantic.features import Feature
from pydantic import BaseModel
from shapely.geometry.geo import shape
import json
import shapely
class Country(BaseModel):
name: str
code: str
type: str
geometry: Feature
app = FastAPI(
title="Natural Earth Countries",
description="This is a list of endpoints which you …Run Code Online (Sandbox Code Playgroud) 我有通过部署的简单测试可调用函数firebase deploy --only functions。
这是内容:
export const test = region('europe-west1').https.onCall((data, context) => {
logger.debug('test call info', data, context);
return 'hello, world!';
});
Run Code Online (Sandbox Code Playgroud)
我可以通过 HTTP 调用https://europe-west1-{project}.cloudfunctions.net/test并接收来成功调用它{"result": "hello, world!"}。
现在想通过 IAM 策略来保护此功能。
allUsersCloud Functions Invoker 角色中删除,并使用 Cloud Functions Invoker 角色添加在 #1 中创建的服务帐户。<--- 现在,当我尝试调用我的测试函数时,如预期的那样,我收到 403 Forbiddenconst auth = new GoogleAuth({keyFile: './key.json'});
targetAudience = new URL('https://europe-west1-{project}.cloudfunctions.net/test');
const client = await auth.getIdTokenClient(targetAudience as string);
const idToken = await client.idTokenProvider.fetchIdToken(targetAudience as …Run Code Online (Sandbox Code Playgroud) authentication firebase gcloud google-cloud-functions google-iam
我在直接从浏览器连接到新实例时遇到问题。这实际上是 Fedora 操作系统的一个新实例,所以我没有配置任何东西。它不能开箱即用。
我还有其他带有 Debian 10 (Buster) 等操作系统的服务器,通过 SSH 连接时它们似乎工作正常。
以下是我用于虚拟机的服务器规格:
Machine type: e2-medium (2 vCPUs, 4 GB memory)
CPU platform: Intel Broadwell
Zone: us-central1-a
OS Image: fedora-coreos-34-20210904-3-0-gcp-x86-64
Disk Size: 30GB
Disk Type: SSD
Run Code Online (Sandbox Code Playgroud)
以下是来自串行端口的日志:(链接到来自串行端口的整个日志)
[ 545.747496] audit: type=2404 audit(1633250527.525:300): pid=1892 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=destroy kind=server fp=SHA256:80:d3:1d:38:a5:96:e3:02:50:e1:55:11:ec:61:1b:65:89:6e:08:ad:4d:50:09:82:2d:a6:cb:c8:fa:35:6c:c7 direction=? spid=1893 suid=74 exe="/usr/sbin/sshd" hostname=? addr=? terminal=? res=success'
[ 545.780996] audit: type=1109 audit(1633250527.525:301): pid=1892 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=PAM:bad_ident grantors=? acct="?" exe="/usr/sbin/sshd" hostname=74.125.73.141 addr=74.125.73.141 terminal=ssh res=failed'
[ 545.806261] audit: …Run Code Online (Sandbox Code Playgroud)