Testing TK blocking

Jack Jackson 1 year ago
parent d48756de6f
commit a2e5d4c238
  1. 25
      .drone.yml
  2. 25
      blog/content/posts/testing-tk-blocking.md

@ -7,9 +7,9 @@ platform:
arch: arm64
steps:
# - name: block-posts-containing-tk
# image: busybox
# commands:
- name: block-posts-containing-tk
image: busybox
commands:
# # This is necessary because, if `grep ...` doesn't find anything, it will _return_ (not print) a value of 1
# # (non-zero return codes indicating errors in Unix - since there are many more ways for something to go wrong
# # than there are for it to go right!), and so the `files=` assignment will also return 1, and the whole operation
@ -19,18 +19,18 @@ steps:
# # if the first one errors out. So, this line can be translated to English as:
# # "Set the variable `files` to a list of all the files that contain `TK` - unless there aren't any, in which case
# # set it to `FILES NOT FOUND"
# - files=$(grep -rl 'TK' blog/content/posts || echo "FILES NOT FOUND")
- files=$(grep -rl 'TK' blog/content/posts || echo "FILES NOT FOUND")
# # We have to filter out (`grep -v`) the "marker" value of `FILES NOT FOUND`, otherwise the no-matches case would
# # be recorded as having 1 matching file, leading to an error-out below.
# # (I guess _technically_ there's an edge case in that, if I ever make a blog post titled "FILES NOT FOUND" _which also_
# # contains the string `TK`, it would slip through this check. But that feels pretty unlikely - not least because spaces
# # are very rare in my filesystem names - so I'm ok taking that risk)
# - count=$(wc -l <(echo "$files" | grep -v "FILES NOT FOUND") | awk '{print $1}')
# - if [[ "$count" -gt "0" ]]; then
# - echo "Found TK in $count files:"
# - echo $files
# - exit 1 # TODO - and alerting via Matrix!
# - fi
- count=$(wc -l <(echo "$files" | grep -v "FILES NOT FOUND") | awk '{print $1}')
- if [[ "$count" -gt "0" ]]; then
- echo "Found TK in $count files:"
- echo $files
- exit 1 # TODO - and alerting via Matrix!
- fi
- name: build-blog
image: alpine
# Very unlikely to need updates, and pulling images seems slow on this setup -
@ -84,11 +84,16 @@ steps:
- "curl -s -X POST \"https://api.cloudflare.com/client/v4/zones/c86d55d225ed973d5da45239beac2f99/purge_cache\" -H \"Authorization: Bearer ${CLOUDFLARE_TOKEN}\" -H \"Content-Type:application/json\" -d '{\"files\":[\"https://blog.scubbo.com\"]}'"
- name: telegram_notification
image: appleboy/drone-telegram
when:
status:
- failure
- success
settings:
token:
from_secret: telegram_token
to:
from_secret: telegram_convo_id
image_pull_secrets:
- dockerconfigjson

@ -0,0 +1,25 @@
---
title: "Testing Tk Blocking"
date: 2023-03-05T21:39:54-08:00
tags:
- CI/CD
- communication
- homelab
- information-management
- leisure
- mathematics
- MentalHealth
- meta
- observability
- politics
- productivity
- reading
- real-life
- short-thoughts
- snippets
- transhumanism
- web3
- wordle
---
Here's some content, but TK it should get blocked!
Loading…
Cancel
Save