2022-09-28

No Deploy Friday action

No Deploy Friday action

There is no worst idea than deploying on Friday. Here I will show you how to prevent it at a pipeline level.

At some point, Volkan Özçelik mentioned an idea about preventing deployments on Friday. In general, it's straightforward to add such an action.

Buddy

We just have to a local shell action with:

if [[ $(date +%u) == 5 ]]; then echo 'Do not deploy on Firday.' && exit 1; fi;

and that's it. In the end, our pipeline would look like this:

GitHub Actions

If you are more into GHA, then just add something like this before the deploy action:

jobs:
  example-job:
    runs-on: ubuntu-latest
    name: Block on Friday
    steps:
      - shell: bash
        run: |
          if [[ $(date +%u) == 5 ]]; then echo 'Do not deploy on Firday.' && exit 1; fi;

Time to sum up

Will this work? Of course, it will. Should you use it? Rather not - it's a bit of a joke. Things like this should be handled at the organizational level.

But if for some reason you see that Friday deployments are a problem at your company - then don't hesitate to add this to your pipelines.

Never miss a post

  • Get an weekly email with news from around the web
  • Get updated about new blog posts
  • No spam