4.2.2. Google Cloud Platform オブジェクトバケットの変更
{product-title}で Google Cloud Platform ストレージを使用した仮想ビルドを有効にするには、GCP バケットでクロスオリジンリソース共有 (CORS) 設定を設定できます。これにより、ビルドワーカーは Dockerfile をアップロードし、ビルドアーティファクトにアクセスできるようになります。
現在、Google Cloud Platform オブジェクトバケットの変更は、IBM Power および IBM Z ではサポートされていません。
手順
次のリファレンスを使用して、特定の CORS ニーズに合わせた JSON ファイルを作成します。以下に例を示します。
$ cat gcp_cors.json出力例
[ { "origin": ["*"], "method": ["GET"], "responseHeader": ["Authorization"], "maxAgeSeconds": 3600 }, { "origin": ["*"], "method": ["PUT"], "responseHeader": [ "Content-Type", "x-goog-acl", "origin"], "maxAgeSeconds": 3600 } ]次のコマンドを入力して、GCP ストレージバケットを更新します。
$ gcloud storage buckets update gs://<bucket_name> --cors-file=./gcp_cors.json出力例
Updating Completed 1次のコマンドを実行すると、GCP バケットの更新された CORS 設定を表示できます。
$ gcloud storage buckets describe gs://<bucket_name> --format="default(cors)"出力例
cors: - maxAgeSeconds: 3600 method: - GET origin: - '*' responseHeader: - Authorization - maxAgeSeconds: 3600 method: - PUT origin: - '*' responseHeader: - Content-Type - x-goog-acl - origin