diff --git a/gcs-fetcher/cloudbuild.yaml b/gcs-fetcher/cloudbuild.yaml index 877494867..95fa87987 100644 --- a/gcs-fetcher/cloudbuild.yaml +++ b/gcs-fetcher/cloudbuild.yaml @@ -29,8 +29,9 @@ steps: args: - '--location=gs://${PROJECT_ID}_cloudbuild/manifest-${BUILD_ID}.json' # Print the manifest. -- name: 'gcr.io/cloud-builders/gsutil' - args: ['cat', 'gs://${PROJECT_ID}_cloudbuild/manifest-${BUILD_ID}.json'] +- name: 'gcr.io/cloud-builders/gcloud' + entrypoint: 'gcloud' + args: ['storage', 'cat', 'gs://${PROJECT_ID}_cloudbuild/manifest-${BUILD_ID}.json'] # Fetch the manifest. - name: 'gcr.io/$PROJECT_ID/gcs-fetcher' args: @@ -48,7 +49,7 @@ steps: - -c - | tar czvf /tmp/out.tar.gz . - gsutil cp /tmp/out.tar.gz gs://${PROJECT_ID}_cloudbuild/ + gcloud storage cp /tmp/out.tar.gz gs://${PROJECT_ID}_cloudbuild/ - name: gcr.io/$PROJECT_ID/gcs-fetcher args: - --type=TarGzArchive @@ -67,7 +68,7 @@ steps: - | apt-get install -y zip zip -r /tmp/out.zip . - gsutil cp /tmp/out.zip gs://${PROJECT_ID}_cloudbuild/ + gcloud storage cp /tmp/out.zip gs://${PROJECT_ID}_cloudbuild/ - name: gcr.io/$PROJECT_ID/gcs-fetcher args: - --type=ZipArchive diff --git a/gke-deploy/cmd/run/run.go b/gke-deploy/cmd/run/run.go index d6dec94c5..3feef6deb 100644 --- a/gke-deploy/cmd/run/run.go +++ b/gke-deploy/cmd/run/run.go @@ -162,7 +162,7 @@ func run(_ *cobra.Command, options *options) error { } applyConfig := expandedOutput if strings.HasPrefix(options.output, "gs://") { - // Without this, gsutil copies the entire expanded output directory, rather than just the files in the directory, which fails applying the deployment if the --recursive flag isn't set. + // Without this, gcloud storage copies the entire expanded output directory, rather than just the files in the directory, which fails applying the deployment if the --recursive flag isn't set. applyConfig = applyConfig + "/*" } if err := d.Apply(ctx, options.clusterName, options.clusterLocation, options.clusterProject, applyConfig, options.namespace, options.waitTimeout, options.recursive); err != nil { diff --git a/gke-deploy/doc/deploying-with-cloud-build.md b/gke-deploy/doc/deploying-with-cloud-build.md index b7aff2793..fb5eaa65a 100644 --- a/gke-deploy/doc/deploying-with-cloud-build.md +++ b/gke-deploy/doc/deploying-with-cloud-build.md @@ -35,7 +35,7 @@ gcloud projects add-iam-policy-binding $PROJECT --member=serviceAccount:$SERVICE # Create a bucket that will be used to store configs suggested and expanded by gke-deploy. BUCKET=my-bucket -gsutil mb -p $PROJECT gs://$BUCKET +gcloud storage buckets create gs://$BUCKET --project=$PROJECT ``` ## Examples diff --git a/gke-deploy/doc/trigger.yaml b/gke-deploy/doc/trigger.yaml index 1e4b43a69..df60523c5 100644 --- a/gke-deploy/doc/trigger.yaml +++ b/gke-deploy/doc/trigger.yaml @@ -32,7 +32,7 @@ build: - --output=output - --annotation=gcb-build-id=$BUILD_ID - id: Save configs - name: gcr.io/cloud-builders/gsutil + name: gcr.io/cloud-builders/gcloud entrypoint: sh args: - -c @@ -40,9 +40,9 @@ build: set -e if [ $_OUTPUT_BUCKET_PATH ]; then - gsutil cp -r output/suggested gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/suggested + gcloud storage cp --recursive output/suggested gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/suggested echo "Copied suggested base configs to gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/suggested" - gsutil cp -r output/expanded gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/expanded + gcloud storage cp --recursive output/expanded gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/expanded echo "Copied expanded configs to gs://$_OUTPUT_BUCKET_PATH/config/$BUILD_ID/expanded" fi - id: Apply deploy @@ -75,4 +75,4 @@ substitutions: _K8S_YAML_PATH: @CONFIGS@ _K8S_APP_NAME: @APP_NAME@ _K8S_NAMESPACE: @NAMESPACE@ - _OUTPUT_BUCKET_PATH: @OUTPUT_BUCKET_PATH@ + _OUTPUT_BUCKET_PATH: @OUTPUT_BUCKET_PATH@ \ No newline at end of file diff --git a/gke-deploy/test/cloudbuild_gcb_prepare_apply_gcs.yaml b/gke-deploy/test/cloudbuild_gcb_prepare_apply_gcs.yaml index c44f2b258..252164862 100644 --- a/gke-deploy/test/cloudbuild_gcb_prepare_apply_gcs.yaml +++ b/gke-deploy/test/cloudbuild_gcb_prepare_apply_gcs.yaml @@ -10,15 +10,15 @@ steps: - '--label=foo=bar' - '--annotation=hi=bye' - '--output=$_OUTPUT' -- name: 'gcr.io/cloud-builders/gsutil' +- name: 'gcr.io/cloud-builders/gcloud' entrypoint: 'sh' args: - '-c' - | set -x # Print commands set -e # Fail if any command below fails - gsutil -q stat $_OUTPUT/expanded/expanded-resources.yaml - gsutil -q stat $_OUTPUT/suggested/suggested-resources.yaml + gcloud -q storage objects list --stat --fetch-encrypted-object-hashes $_OUTPUT/expanded/expanded-resources.yaml + gcloud -q storage objects list --stat --fetch-encrypted-object-hashes $_OUTPUT/suggested/suggested-resources.yaml - name: 'gcr.io/$PROJECT_ID/gke-deploy' args: - 'apply' diff --git a/gke-deploy/testservices/gsutil.go b/gke-deploy/testservices/gsutil.go index bfa378197..84be0d8b5 100644 --- a/gke-deploy/testservices/gsutil.go +++ b/gke-deploy/testservices/gsutil.go @@ -81,7 +81,7 @@ func copyDir(srcdir, destdir string, info os.FileInfo) error { return nil } -// Copy simulates the gsutil copy. +// Copy simulates the gcloud storage cp. func Copy(src, dest string) error { info, err := os.Stat(src) if err != nil {