📝 BLOG.IK.AM

@making's memo
(🗃 Categories 🏷 Tags)

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

🗃 {Dev/CI/ConcourseCI}

🏷 Concourse CI 🏷 Docker 🏷 GCP

🗓 Updated at 2017-11-26T16:10:09+09:00 by Toshiaki Maki  🗓 Created at 2017-11-26T16:10:46+09:00 by Toshiaki Maki  {✒️️ 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