Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions gcs-fetcher/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gke-deploy/cmd/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gke-deploy/doc/deploying-with-cloud-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions gke-deploy/doc/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ 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
- |
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
Expand Down Expand Up @@ -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@
6 changes: 3 additions & 3 deletions gke-deploy/test/cloudbuild_gcb_prepare_apply_gcs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion gke-deploy/testservices/gsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down