millim.no

Github Actions and cake mixes

Skrive av admin den April 25, 2024, 11:34 p.m.

Github’s Workflows have become the go-to CI/CD solution, but I have a huge issue with about half of them: The half consisting of Actions.

I dived a little into Workflows when rewriting my CI/CD scripts to Workflows. I was somewhat surprised to see that almost none of Workflow examples you'll find online look similar to your old shell scripts; instead they use the other flavour of Workflows: Actions. This is what Github tutorial presents as your first Workflow:

name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on: [push]
jobs:
  check-bats-version:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm install -g bats
      - run: bats -v

A 1st year CS student could probably follow this tutorial. It also shows how workflows come in two flavours: your standard shell commands and actions.

Actions let you abstract away often used commands and processes. It sounds great to instruct the computer to actions/checkout your code, actions/setup-node and then just run: npm run build.

But what when some action doesn’t work, as in the case of this bug reported to actions/checkout? It was first reported in 2021, yet I struggled with it as late as in February 2024.

And what if you want to customise the action? What if you want to checkout another repository, another branch, or have other requirements specific for your project? It’s just a matter of finding the correct parameter, and the README is nicely written. But let me reiterate: If you want to checkout a branch you have to learn another incantation. At the same time you probably have the correct git command in your fingertips already. Are Actions actually worth it?

How checkout action’s issue #417 manifests. How checkout action’s issue #417 manifests.

Cake mixes in programming

It's a metaphor that I first heard about in a short talk (8 min) by Christin Gorman. Cake mixes, Christin says, seem to be a great and easy way to bake a cake — until you realise that if you want to deviate from the recipe in the slightest, you’ll be better off without the cake mix. Do you bake one single brownie every year? Great, use the cake mix. Do you add your own ingredients to the cake mix and bake once per month? Just bake your own cake, it will be tastier and cheaper, and the process more fulfilling.

Our modern development tools have become cake mixes. Christin shows examples of Hibernate code that technically is still Java, but so verbose that the utility of using a framework disappears. It would be easier to just write the query oneself.

Actions have the problem of cake mixes. You depend on a third party to do something that you already can do, but in a more opaque way. And whenever you want to tweak the recipe a little bit, it's actually easier to do this thing yourself.

If you add that to the fact that we developers have a tendency to follow the new shiny thing, there’s also a danger that what was supposed to be a cake mix becomes a gatekeeping tool. Introducing unnecessary complexity increases the barrier of entry, and deters people from trying the new thing.

I don’t rule out Actions completely, and when an opportunity shows up, I’ll write my own. But they will have to provide actual value to me — something I don’t see in replacing two lines of shell script with several lines of YAML.