Refactor CircleCI config to define proper commands for reused fragments #14507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a quick refactor I did recently for #14478 when I wanted to parameterize our
run_build
step. This would allow me to parameterize it with the number of CPUs. In the end I chose a different approach and did not need it, but I think we should still merge it. It's something I wanted to clean up for quite a while but never had a good reason to actually do it.Until now we've been YAML fragments under the
defaults
key to define sequences of steps or lists of artifacts. The downside of that mechanism is that it's pretty crude and requires workarounds to compose well in some situations (e.g. we need to wrap a list of steps in a condition if we're appending to another list rather than replacing it whole). Reusable commands are a way to do that with fewer quirks. They also have parameters, which will make them easier to extend in the future.I recommend viewing the diff with whitespace ignored and preferably looking at individual commits. The changes are pretty straightforward, there's just quite a few of them, and this should make it more apparent.