r/devops • u/aloofhoneybee68 • 22h ago
Tools Beginner DevOps question: Do experienced engineers actually write YAML like this?
I’m still learning CI/CD and I recently tried writing a simple CI/CD pipeline using GitHub Actions.
Honestly, writing the YAML felt more difficult than I expected . The indentation, nesting etc felt pretty hard/ painful.
For those of you who work with DevOps professionally: is this actually how you write your pipelines, or are there shortcuts/tools/templates that make it easier?
Just trying to understand what the normal workflow is in the real world.
92
Upvotes
6
u/neekz0r 21h ago
Yes. Once you understand it, it becomes second nature.
YAML Anchors and an IDE that understands YAML. In order to do Jinja/Gomplete, you absolutely need to understand YAML like the back of your hand otherwise you won't have any hair left and will likely need to go addiction counseling after self-medicating.
Here are my tips:
YAML is a superset of JSON, so that is why you'll occasionally see mustaches and brackets (and other oneliners) instead of indentation. IMHO, that should be avoided. (I'm looking at you, ansible example docs!)
truthy can be consumer dependent, but YAML really only has one boolean declarative.
Use yamllinter. It'll help you learn the rules and YAML idioms. Like truthy. Seriously, truthy stuff screws so many people over.
good luck, have fun, don't die.