-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPP-2313 Add proper support for custom jobs in CircleCI #753
base: main
Are you sure you want to change the base?
Conversation
51fa35c
to
3b2e670
Compare
3b2e670
to
31ec896
Compare
Our previous logic for guessing whether to prepend our Tool Kit orb namespace to a workflow job didn't account for approval jobs, which don't need to be declared in a `jobs` stanza ahead of time. Also add some comments justifying why we're inferring whether to prepend the Tool Kit namespace as the logic is getting increasingly complicated.
All jobs specified in a CircleCI config need to have an execution environment assigned to it. Let's use the default node executor for our generated jobs, including a matrix of the node executors if appropriate.
This increases the complexity of the workflow job logic even further so I've refactored the code significantly as part of this in an effort to make it more readable.
This means we can reuse the aggregate error formatting instead of rewriting another version. It also means that the details field of ToolKitErrors can be preserved.
31ec896
to
93d6d49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pairing on this one. I have a better understanding of how this plugin works now.
The refactors made the code much more readable too. Thanks
// value to if it's from the orb or if it's a custom job that needs to be | ||
// run for multiple Node versions | ||
prefixedName.startsWith('tool-kit/') || | ||
(runsOnMultipleNodeVersions && customJob && (customJob.splitIntoMatrix ?? true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: I was a little confused about this logic.
So a custom job that runs on multiple node versions will split into a matrix unless we opt out in the job definition or the workflow job definition? Opting out only at the workflow level will still set one executor.
Opting out at the job definition level won't set any executors because it should have been added at the job level by generateJob
. Is that right?
If that's so, maybe expanding a bit more on why we return none
for custom jobs would be useful.
Description
Our initial 4.0 release of Tool Kit only contained minimal support for defining custom jobs in CircleCI. They didn't define the executor the job would run in, resulting in CircleCI validation errors unless they were added explicitly in a
custom
block, so even calling it 'minimal support' might be a stretch. This PR adds proper support for the execution property, as well as adding asplitIntoMatrix
option to jobs which works the same as it does for workflow jobs. Efforts have also been made to refactor the code so that it's easier to follow.This now allows us to generate a CircleCI config for next-preflight using Tool Kit config exclusively without manual intervention.
Closes #740, as this PR carries on from the changes made in that PR.
Checklist:
feat(circleci): add support for nightly workflows
,fix: set Heroku app name for staging apps too