Sign inSign up

nhammond101/cloudfront-cache-clear

By nhammond101

•Updated about 7 years ago

This pipe will create an invalidation on a Cloudfront distribution

Image
0

1.7K

nhammond101/cloudfront-cache-clear repository overview

⁠Bitbucket Pipelines Pipe: Cloudfront Cache Clear

This pipe will create an invalidation on a Cloudfront distribution⁠

⁠YAML Definition

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

script:
  - pipe: nhammond101/cloudflare-cache-clear:0.1.0
    variables:
      AWS_ACCESS_KEY_ID: "<string>"
      AWS_SECRET_ACCESS_KEY: "<string>"
      DOMAIN: "<string>"
      # DEBUG: "<boolean>" # Optional

⁠Variables

VariableUsage
AWS_ACCESS_KEY_ID (*)Your AWS Access Key.
AWS_SECRET_ACCESS_KEY (*)Your AWS Secret.
DEBUGTurn on extra debug information. Default: false.
DOMAIN (*)The domain name to create the invalidation for

(*) = required variable.

⁠Prerequisites

⁠Examples

Basic example:

script:
  - pipe: nhammond101/cloudflare-cache-clear:0.1.0
    variables:
      AWS_ACCESS_KEY_ID: "AB****************CD"
      AWS_SECRET_ACCESS_KEY: "EF************************************GH"
      DOMAIN: "cloudfront-invalidate.waracle.net"
      # DEBUG: "<boolean>" # Optional

Advanced example:

script:
  - pipe: nhammond101/cloudflare-cache-clear:0.1.0
    variables:
      AWS_ACCESS_KEY_ID: "AB****************CD"
      AWS_SECRET_ACCESS_KEY: "EF************************************GH"
      DOMAIN: "cloudfront-invalidate.waracle.net"
       DEBUG: "true"

⁠Testing

To test locally, you will need to install bats⁠ and an environment file (.env) with your AWS credentials

  • Create a file called .env in the root of the project, and confirm it is referenced in the .gitignore⁠ file, as these values should NOT be in the repo
  • Install bats by running npm i -g bats

Now you can run /usr/local/bin/bats ./test/test.bats
which will run the unit tests, which build the docker image, passes in the environment variables and invalidates the Cloudfront distribution specified in the DOMAIN variable

⁠Support

If you'd like help with this pipe, or you have an issue or feature request, let us know on Community⁠.

If you're reporting an issue, please include:

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

Tag summary

Content type

Image

Digest

Size

31.6 MB

Last updated

about 7 years ago

docker pull nhammond101/cloudfront-cache-clear