Skip to content
Permalink
Browse files

add Build時のLogDir Option refs #3

optionを設定しない場合、 `gs://[PROJECT_NUMBER].cloudbuild-logs.googleusercontent.com/` にビルド時のログが出力される。
そのbucketを読むにはProject ViewerのRoleが必要なので、 `--gcs-log-dir` を指定して、別の場所に出力させる。

GoogleCloudPlatform/cloud-builders#120
  • Loading branch information...
sinmetal committed Dec 8, 2018
1 parent 6c79923 commit 19d514628fba32b7f4eb14176dd69200c9bc4403
@@ -9,4 +9,5 @@ steps:
args: [ 'apply', '-auto-approve', '.']
dir: 'god'
- name: 'gcr.io/cloud-builders/gcloud'
args: [ 'builds', 'submit', '--project', 'tftest-20181128f', '--config', 'tftest-20181128f/cloudbuild.yaml']
args: [ 'builds', 'submit', '--project', 'tftest-20181128f', '--gcs-log-dir', 'buildlog', '--config', 'tftest-20181128f/cloudbuild.yaml']
logsBucket: 'gs://godtf-sinmetal-buildlog'
@@ -11,3 +11,10 @@ resource "google_storage_bucket" "sinmetal-tfstate-20181128f" {
location = "us-central1"
storage_class = "STANDARD"
}

resource "google_storage_bucket" "godtf-sinmetal-buildlog" {
project = "godtf-sinmetal"
name = "godtf-sinmetal-buildlog"
location = "us-central1"
storage_class = "STANDARD"
}
@@ -3,3 +3,9 @@ resource "google_storage_bucket_iam_member" "sinmetal-tfstate-20181128f-cloud-bu
role = "roles/storage.objectAdmin"
member = "serviceAccount:${google_project.tftest-20181128f.number}@cloudbuild.gserviceaccount.com"
}

resource "google_storage_bucket_iam_member" "godtf-sinmetal-buildlog-cloud-build-log" {
bucket = "${google_storage_bucket.godtf-sinmetal-buildlog.name}"
role = "roles/storage.objectCreator"
member = "serviceAccount:${google_project.tftest-20181128f.number}@cloudbuild.gserviceaccount.com"
}
@@ -7,4 +7,5 @@ steps:
dir: 'tftest-20181128f'
- name: 'hashicorp/terraform:full'
args: [ 'apply', '-auto-approve', '.']
dir: 'tftest-20181128f'
dir: 'tftest-20181128f'
logsBucket: 'gs://godtf-sinmetal-buildlog'

0 comments on commit 19d5146

Please sign in to comment.
You can’t perform that action at this time.