Defining a Pipeline
At this point, your tool executes the first step in the CI pipeline: Go Build. In its current state, the information to execute this step is hard-coded into the run function. While this is a valid approach, adding more steps to this tool using the same approach would cause extensive code repetition. We want a tool that’s maintainable and easy to extend, so let’s make a change to the program’s structure to make the code more reusable.
To do that, you’ll refactor the part of the run function that executes the external program into its own function. To make it easier to configure, let’s add a custom type step that represents a pipeline step and associate the method execute to it. You’ll also add a constructor function called ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access