Artifact Registry 服務代理

Artifact Registry 會使用名為「Artifact Registry 服務代理程式」的 Google 管理服務帳戶,在連線至其他 Google Cloud 服務時代表您執行動作。您可以將 IAM 角色授予服務代理程式,以便與 Cloud Key Management Service 中的客戶自行管理的加密金鑰 (CMEK) 和 Pub/Sub 中的存放區事件通知等服務整合。

在Google Cloud 專案中建立第一個 Artifact Registry 存放區時,Artifact Registry 會建立 Artifact Registry 服務代理程式。服務代理 ID 為:

service-PROJECT-NUMBER@gcp-sa-artifactregistry.iam.gserviceaccount.com

PROJECT-NUMBER 是 Artifact Registry 執行的Google Cloud 專案「專案編號」。

您可以在沒有任何存放區的專案中,使用下列指令手動建立服務代理:

gcloud beta services identity create \
    --service=artifactregistry.googleapis.com \
    --project=PROJECT-ID

將 PROJECT-ID 替換為 Google Cloud 專案 ID。

系統會為專案中的資源,授予 Artifact Registry 服務代理 Artifact Registry 服務代理角色 (roles/artifactregistry.serviceAgent)。為強制執行最小權限安全原則,這個角色只具備最低必要權限:

  • 發布 Pub/Sub 主題:pubsub.topics.publish
  • 從 Artifact Registry 存放區下載構件: artifactregistry.repositories.downloadArtifacts
  • 讀取存放區中繼資料:artifactregistry.repositories.get
  • 使用虛擬存放區讀取構件: artifactregistry.repositories.readViaVirtualRepository
  • 刪除構件:artifactregistry.versions.delete

後續步驟

瞭解 Artifact Registry 角色,以及如何設定存放區的存取權。