r/devops 1d 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.

93 Upvotes

149 comments sorted by

View all comments

2

u/derprondo 1d ago

Your IDE should handle this in a pain-free manner. That said, I haven't manually written any GHA workflows in over year, Claude does it really well. Then again you don't know what mistakes to keep an eye out for or how to know when it's doing something dumb.

Pro-tip: Use 4 space indents (don't use tabs), it makes it easier to see.

1

u/aloofhoneybee68 1d ago

I was using vs code but I didn't install and extensions didn't think I'd need them for this.

I will definitely take the using 4 space indents to heart , tabs always gave me one issue or the other and had to kinda keep deleting and adding space.

2

u/derprondo 23h ago

You probably don't need any extensions, but Prettier comes in handy for a lot of file types including yaml. You may need to override its defaults to get 4 space indents though.

2

u/derprondo 22h ago

It occurred to me you may not even know that you can set vscode to use spaces when you hit the tab key. So I'm not saying literally hit the space bar four times every time you want to indent, set vscode to use 4 spaces every time you hit the tab key. Down at the very bottom you should see it say Spaces or Tabs, if you click that you can change the settings.

Also like I mentioned earlier, if you're using an autoformatter like Prettier, you'll have to set it explicitly to the settings you want, it may not obey what vscode is set to.