@making's memo

All Categories All Tags Premium (Beta)


ConcourseのDocker Image ResourceでGoogle Container Registryを使う

Edit History

メモ

Service Account KeyのJSONファイルを作成する。

export project_id=$(gcloud config get-value project)
export account=gcr-user
export service_account_email=${account}@${project_id}.iam.gserviceaccount.com

gcloud iam service-accounts create gcr-user
gcloud iam service-accounts keys create ~/gcr.key.json --iam-account ${service_account_email}
gcloud projects add-iam-policy-binding ${project_id} --member serviceAccount:${service_account_email} --role roles/storage.admin

~/gcr.key.jsonの内容をcredentials.ymlに設定。

gcr-key: |
  {
    "type": "service_account",
    "project_id": "..."
    "...": "..."
  }

Resource設定は次のように。

  - name: docker
    type: docker-image
    source:
      repository: asia.gcr.io/<project_id>/<repo>
      username: _json_key
      password: ((gcr-key))

参考URL

このエントリーをはてなブックマークに追加