originix/cloudflare-purge-cache

By originix

Updated 11 months ago

the bitbucket pipeline for purge cache cloudflare

Image
API Management
Integration & Delivery

111

Bitbucket Pipelines Pipe: Cloudflare Cache Purge

Git HubDocker Hub

This Bitbucket Pipelines pipe allows you to request a cache purge of your Cloudflare.

YAML Definition

Add the following snippet to the script section of your bitbucket-pipelines.yml file:

- pipe: docker://originix/cloudflare-purge-cache:0.1.0
  variables:
    CF_API_KEY: '<string>' # required
    CF_ZONE_ID: '<string>' # required
    PURGE_EVERYTHING: '<bool>' # optional
    FILES: '<string>' # optional
    TAGS: '<string>' # optional
    HOSTS: '<string>' # optional
    PREFIXES: '<string>' # optional
    DEBUG: '<string>' # optional

Variables

VariableUsage
CF_API_KEY (*)Cloudflare API key
CF_ZONE_ID (*)Cloudflare Zone ID
PURGE_EVERYTHINGpurge everything
FILESList of white space separated file to purge cache.
TAGSList of white space separated tag to purge cache.
HOSTSList of white space separated host to purge cache.
PREFIXESList of white space separated prefix to purge cache.
DEBUGTurn on extra debug information. Default: false.

(*) = required variable. This variable needs to be specified always when using the pipe.

Examples

Purge all cache example:

Purge cache for everything:

script:
  - pipe: docker://originix/cloudflare-purge-cache:0.1.0
    variables:
      CF_API_KEY: $CF_API_KEY
      CF_ZONE_ID: $CF_ZONE_ID
      PURGE_EVERYTHING: 'true'
Purge files example:

Purge cache for a list of files:

script:
  - pipe: docker://originix/cloudflare-purge-cache:0.1.0
    variables:
      CF_API_KEY: $CF_API_KEY
      CF_ZONE_ID: $CF_ZONE_ID
      FILES: 'www.example.com/img/cat.png www.example.com/img/dog.png'
Purge tags example:

Purge cache for a list of tags:

script:
  - pipe: docker://originix/cloudflare-purge-cache:0.1.0
    variables:
      CF_API_KEY: $CF_API_KEY
      CF_ZONE_ID: $CF_ZONE_ID
      TAGS: 'tag-foo tag-bar'
Purge hosts example:

Purge cache for a list of hosts:

script:
  - pipe: docker://originix/cloudflare-purge-cache:0.1.0
    variables:
      CF_API_KEY: $CF_API_KEY
      CF_ZONE_ID: $CF_ZONE_ID
      HOSTS: 'example.com api.example.com'
Purge prefix example:

Purge cache for a list of prefix:

script:
  - pipe: docker://originix/cloudflare-purge-cache:0.1.0
    variables:
      CF_API_KEY: $CF_API_KEY
      CF_ZONE_ID: $CF_ZONE_ID
      PREFIXES: 'example.com/media/* api.example.com/users/*'

Using the Docker image independently

 docker run \
   -e CF_API_KEY="$CF_API_KEY" \
   -e CF_ZONE_ID="$CF_ZONE_ID" \
   -e PURGE_EVERYTHING="true" \
   originix/cloudflare-purge-cache:0.1.0

Support

If you’d like help with this pipe, or you have an issue or feature request.

If you’re reporting an issue, please include:

  • the version of the pipe
  • relevant logs and error messages
  • steps to reproduce

License

Copyright (c) 2024 originix. MIT License, see LICENSE file.

Docker Pull Command

docker pull originix/cloudflare-purge-cache