Skip to content

Commit

Permalink
deploy-to-gcs: Use gcloud storage rsync
Browse files Browse the repository at this point in the history
rsync features:
* exclude list (used for timestamp)
* --delete-unmatched-destination-objects may be useful in future to
  delete unused metadata files

Note that gcloud rsync CLI is not the same as unix rsync: the SOURCE
and DEST arguments in particular function completely differently.

Also put some variables into actual named variables.

Signed-off-by: Jussi Kukkonen <[email protected]>
  • Loading branch information
jku committed Feb 14, 2024
1 parent 963cc0b commit 870e286
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/deploy-to-gcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ jobs:

- name: Upload repository to GCS
run: |
BUCKET="gs://tuf-root-staging/"
LOAD_BALANCER="tuf-repo-cdn-lb"
# Upload metadata, make sure we upload timestamp last
mv repository/timestamp.json .
gcloud storage cp --cache-control=no-store -r repository/* gs://tuf-root-staging/
gcloud storage cp --cache-control=no-store timestamp.json gs://tuf-root-staging/
gcloud storage rsync --cache-control=no-store --recursive --exclude=timestamp.json \
repository/ $BUCKET
gcloud storage cp --cache-control=no-store repository/timestamp.json $BUCKET
# invalidate CDN cache
gcloud compute url-maps invalidate-cdn-cache tuf-repo-cdn-lb --path "/*" --async
gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --path "/*" --async

0 comments on commit 870e286

Please sign in to comment.