77 points · by kiyanwang · 6y ago · 29 comments
jobs:
format:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, 'wip')"Java people must have ptsd flashbacks
jobs:
format:
runs-on: ubuntu-latest
if: |
! contains(github.event.head_commit.message, ‘wip’)
Other systems that output YAML (e.g. Kubernetes) always emit block literals for embedded user-supplied strings, reserving inline string literals for the cases where the string isn’t expected to need quoting — e.g. string-serialized enum option-values; symbol/atom/keyword-typed values; and sometimes URLs. if: "! contains(github.event.head_commit.message, 'wip')"
is technically yaml, but in truth it's a completely different language with completely different grammar embedded in a yaml string. if pure yaml structure isn't good enough to fulfill use cases of the product, what's the point of using it? you now have a yaml parser and a whatever-this-is parser that needs to be invoked... sometimes, according to some yaml schema? why not create a proper grammar for the whole thing instead of only for a subset? as is, you have two problems: yaml and your custom language - i'd rather have one problem.Honestly not sure why YAML is used so much. It either has stuff like this hacked in, or some templating structure, or both. Never the same between one CI tool and another, so you're always having to re-learn how to substitute an environment variable, or use some constructs provided by the tool itself.
And for any half-way complex pipeline, this YAML file will be a few thousand lines long, if not more, and basically impossible to follow.
On the other end, we now use Jenkins (the newer version), so every job is a huge Groovy script pretending to be a config file. Much steeper learning curve for anything simple.
Pick your poison.
But it's super confusing because ! usually means NOT in any programming context so you would mentally parse that as the message NOT containing "wip" when in reality, the opposite is what happens. CloudFormation does this too and they have "If" defined as a custom function so you end up with !If which is super confusing for a condition where you expect "if condition is true do this else that".
Regular expressions and SQL in my Python
JavaScript and CSS in my HTML
Sed / Awk / etc in my Bash
Embedding a custom conditional syntax in YAML feels pretty tame in comparison to those.
I guess this applies to solo developers who mainly work out of master and like to compulsively push upstream to save their work. (Or am I wrong?)
if: "! contains(github.event.head_commit.message, '[skip ci]')"if: contains(github.event.pull_request.labels.*.name, 'wip')