Skip to main content
Plugins / BunnyCDN Cache Purge

BunnyCDN Cache Purge

by bentasker

Flush URLs out of BunnyCDN's Cache.


BunnyCDN Cache Purge

This plugin can be used to flush URLs out of the Bunny CDN cache.

It also provides rsync so that static sites can be uploaded before flushing

Sample

- name: Publish
  image: codeberg.org/bentasker/woodpecker-ci-bunnycdn-cache-flush
  pull: true
  settings:
    LOAD_KEY: "y"
    SSH_KEY:
        from_secret: ssh_key
    DO_RSYNC: "y"
    RSYNC_REMOTE: root@sitehost.internal:/mnt/sites/bt/
    RSYNC_PORT: 2222
    RSYNC_SOURCE: public        
    # Disable the cache flush
    DO_FLUSH: "n"
 
- name: Flush CDN Cache
  image: codeberg.org/bentasker/woodpecker-ci-bunnycdn-cache-flush
  settings:
    BUNNY_API_KEY:
      from_secret: bunny_api_key
    FLUSH_URLS: "https://www.bentasker.co.uk/* https://www.bentasker.co.uk/" 

Settings

Setting Description Default
ALWAYS_FLUSH A space seperate list of URLs to flush in addition to those in FLUSH_URLS. This allows you to provide a static list of sitemaps etc even if you're calculating the value of FLUSH_URLS dynamically
BUNNY_API_KEY The API token to authenticate against BunnyCDN's API with
DEBUG Put SSH into verbose mode when rsyncing. Useful if auth is failing n
DO_FLUSH Should we attempt the CDN flush? Setting this to n allows the container image to be used just for rsync y
DO_RSYNC Should we perform a rsync? n
FLUSH_URLS Space seperated list of URLs to flush from the CDN cache
LOAD_KEY Should we install a SSH key within the container n
RSYNC_PORT The SSH port to connect to when rsyncing 22
RSYNC_REMOTE The remote to rsync to (should be user@host:/path
RSYNC_SOURCE The source path to rsync from (for Hugo sites this will be public. For Nikola it'll be output)
SSH_KEY If LOAD_KEY is set to y we'll write the value of SSH_KEY into ~/.ssh/id_rsa