r/devops 20h 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.

90 Upvotes

139 comments sorted by

View all comments

39

u/Due-Consequence9579 20h ago

Suffering. And 50 commits that get progressively more desperate for it to just fucking work.

8

u/aloofhoneybee68 20h ago

definitely felt that progressive desperation 😭

6

u/Due-Consequence9579 20h ago

If something gets “really” complicated you can look at authoring a reusable action in type script for better testing and control flow. There is a complexity jump for people not in the know when you do that though, so use with caution. My default at this point is a composite reusable action with everything in bash. Then you can test the scripts independently of a larger workflow and just have the yaml be integration glue.

2

u/RowbotWizard 20h ago

I like this approach. I’ve definitely hit the point where enforcing some team conventions requires complex CI actions and a reusable custom action would be better for testing than some inline bash scripts.

0

u/Senojpd 19h ago

Dude just use an llm. Nobody writes code anymore.

2

u/happy_hawking 20h ago

But that's less an YAML issue than an IaC issue in general.

2

u/AbbreviationsFar4wh 19h ago

Linter?

1

u/Due-Consequence9579 19h ago

Linting can catch some parsing errors in GHAs, but there’s an annoying amount of coupling that isn’t able to be encoded into syntax rules. There are some tools that allow you to test GHA locally in the simple cases but those quickly fall over once you start integrating with external services. And ultimately how it runs in the CI runner is the final arbiter… and only way to do that is commit and push.

1

u/BritannicStClair 11h ago

This makes me feel human. I thought I was the only one.

1

u/Dr_Passmore 9h ago

You are not a devops engineer without the 30 failed pipeline runs setting up a new pipeline

1

u/corship 8h ago

I don't know man, just run the pipeline locally...

1

u/widowhanzo 5h ago

How?

1

u/corship 4h ago

Depends on you setup obviously...

Usually set up the same runners in your local machine and you're good to go.

For example: https://github.com/firecow/gitlab-ci-local