-
Notifications
You must be signed in to change notification settings - Fork 0
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
drun vNext Ideas #1
Comments
TLDR: I am going to archive drun & gomake and create a totally band new never seen before (well I haven't seen it anyway) kind of task runner. If your looking for a traditional task runner written in either PrefaceYou should read this in conjunction with brad-jones/gomake#14. Both these tickets tell a story, a broken up story but a story non the less. One day I might collect all my notes in these issues together and write a single cohesive blog post but until then you will have to put up with my ramblings. The following examples I am going to use some pseudo yaml to describe the structure of some pseudo task runners / pipelines. Task Runners vs PipelinesOk so I have had a complete change of mind. Yes the above "Class" based idea might actually work to build a type safe parametrized task runner that can de-duplicate the work correctly but I have a better idea, let me explain. A traditional task runner might look like this. notify:
run: acme-slack-client --channel #releases --message "Build 123 has started"
build:
dependsOn:
- build-foo
- build-bar
build-foo:
dependsOn:
- build-baz
run: acme-builder --project foo
build-bar:
dependsOn:
- build-baz
run: acme-builder --project bar
build-baz:
run: acme-builder --project baz You would execute something like this notify:
run: acme-slack-client --channel #releases --message "Build 123 has started"
build-baz:
run: acme-builder --project baz
build-bar:
dependsOn:
- build-baz
run: acme-builder --project bar
build-foo:
dependsOn:
- build-baz
run: acme-builder --project foo Notice how there is no Ignoring the
At least in an imperative task runner like
Even in a truly declarative task runner like go-task it is still possible to pass information from the depender to the dependent. see: https://taskfile.dev/#/usage?id=calling-another-task Where as in a CI/CD pipeline the execution order looks like this.
And so there is no way for Latest IdeaThe solution I am conjuring up is to have a task runner that operates in a very similar model to a pipeline. Lets again look at an example. dns1:
run: ping 1.1.1.1
dns2:
run: ping 1.0.0.1
dns3:
run: ping 8.8.8.8
dns4:
run: ping 8.8.4.4 Executing |
So the issue with this architecture is that it's difficult to provide the "Once" functionality & if we wanted to further extend this to generate CI pipeline config it's difficult to get the dependency graph without actually executing the tasks. We would have to resort to some sort of AST parsing.
So something like this makes it easy to build out the dependency graph & have the actual execution deferred thus allowing us to easily deduplicate tasks. However we can not specify task parameter via
DependsOn
.We could perhaps do something similar to this which is what PyInvoke does http://docs.pyinvoke.org/en/stable/concepts/invoking-tasks.html#parameterizing-pre-post-tasks However it's not typesafe and the values of the parameters can no longer be based on the input to the depender.
At this point I have come to the conclusion that it is very difficult, I don't want to say impossible just in case someone comes up with a brilliant suggestion, to create a task runner with the following properties:
So then I started thinking outside the box, what if we used classes like this. The only thing I don't like about this is that it's just not as succinct as I would like.
The advantage of doing something like this is that we can easily parse the graph and generate say CI/CD config. Additional meta data can easily be added to the task classes via more fields/getters/setters/attributes to support different providers. eg: TeamCity vs Github Actions
The action method could in fact just refer to an actual Github Action. eg:
actions/checkout@v2
oractions/cache@v1
, etc...The text was updated successfully, but these errors were encountered: