Skip to content

Commit

Permalink
Invalidate CDN cache and add latest version file (rilldata#1612)
Browse files Browse the repository at this point in the history
* Invalidate CDN cache and add latest version file

* Add comment about the caching strategy
  • Loading branch information
kaspersjo authored Jan 16, 2023
1 parent 8ced803 commit d9b6652
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/cli-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Full releases are published to brew, CDN (for install script), and Github Releases.
# A full release gets its version number from the Git tag that triggered it.
# Nightly releases are only published to CDN and do not have a version. Their version number is "nightly".
# Caching of the release artifacts are intentionally disabled at the bucket level by setting the Cache-Control header of the objects to 'no-store',
# this is done because the files are cached at the CDN layer instead and multiple caching layers makes invalidating the cache difficult.
# The CDN cache is explicitly invalidated as part of the release process, to prevent old versions from being accidentally served after the release is done.
name: Release Rill CLI
on:
# Trigger a full release on new Git tag
Expand Down Expand Up @@ -78,11 +81,27 @@ jobs:
with:
credentials_json: "${{ secrets.RILL_BINARY_SA }}"

- name: Upload install script to CDN
- name: Upload install script to CDN bucket
uses: google-github-actions/upload-cloud-storage@v1
with:
path: scripts/install.sh
destination: prod-cdn.rilldata.com/
headers: |-
cache-control: no-store
- name: Create latest version file
if: env.PUBLISH_NIGHTLY == 'false'
run: |-
echo '${{ github.ref_name }}' >> latest.txt
- name: Upload latest version file to CDN bucket
if: env.PUBLISH_NIGHTLY == 'false'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: latest.txt
destination: prod-cdn.rilldata.com/rill/
headers: |-
cache-control: no-store
- name: Publish nightly docker image
if: env.PUBLISH_NIGHTLY == 'true'
Expand All @@ -98,9 +117,22 @@ jobs:
cp dist/*.zip nightly/
cp dist/checksums.txt nightly/
- name: Upload nightly to CDN
- name: Upload nightly to CDN bucket
if: env.PUBLISH_NIGHTLY == 'true'
uses: google-github-actions/upload-cloud-storage@v1
with:
path: nightly/
destination: prod-cdn.rilldata.com/rill/
headers: |-
cache-control: no-store
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'

- name: Explicitly invalidate the old artifacts from CDN cache
run: |-
gcloud compute url-maps invalidate-cdn-cache prod --path "/install.sh" --async
gcloud compute url-maps invalidate-cdn-cache prod --path "/rill/latest.txt" --async
if [[ ${{ env.PUBLISH_NIGHTLY }} == 'true' ]]; then
gcloud compute url-maps invalidate-cdn-cache prod --path "/rill/nightly/*" --async
fi

0 comments on commit d9b6652

Please sign in to comment.