Fully customizable pipeline definitions #1230
Replies: 1 comment · 4 replies
-
Why use a C# DSL to generate a pipeline instead of writing the pipeline manually? |
Beta Was this translation helpful? Give feedback.
All reactions
-
😕 1
-
nuke already has all the information about build dependencies.. it makes perfect sense to generate the yaml from that single source of truth.. |
Beta Was this translation helpful? Give feedback.
All reactions
-
It makes sense in the case of simpler pipelines, not so sure if it scales to more complex scenarios. These scenarios may involve:
Let's say nuke does end up generating pipelines for all of these exotic scenarios, how much configurability will nuke allow? Will you have the full control over the generated pipeline? If your goal is maximum configurability, you will end up with a C# DSL that resembles pipeline's YAML dialect. Does this provide more benefits than writing the pipeline directly? I'm doubtful about. |
Beta Was this translation helpful? Give feedback.
All reactions
-
👎 1
-
I'm not doubtful. it's just a challenge that has to be accepted by someone. |
Beta Was this translation helpful? Give feedback.
All reactions
-
I also wanted to add some bits to this dicussion. I also decided to move to Nuke for one of my new OSS projects and we likely also want to adopt it in our company for most of our pipelines written in a variety of languages (powershell, batch, msbuild,..). The post is very long but might give some good insight into what I am thinking. tl;dr: How about, as a first improvement step, we adopt the "GitHub Actions" concept of an "Action" into Nuke? As a "unit" which has inputs, performs steps and produces outputs it can be reused and integrated into Targets. Those special "Actions" can be called multiple times, are producing special build logs (grouping, time measurement etc.) and might even be shown in the execution plans. Long version follows hereThe problemTask/Target based runners have definitly their place and fulfill a nice range of usecases but they suffer often of similar pain points when used in larger workflows:
Here a screenshot of the project I work currently on. This is "only" the GitHub Actions level jobs: In the jobs I often have a Matrix strategy calling parameterized a single target. There are also additional inputs from outside. like whether some cached files should be used or not. The entrypoint is often a target with certain parameters which then has dependent targets being executed. It took me really long time and many tradeoffs to make certain things reusable. I have plenty of Also my pipeline is rather encoded in GitHub Actions yamls and executing the same range of builds locally is not possible out-of-the-box. For many developers it might be a lot more natural to develop conditions, loops and call methods than working on a task list and dependencies. Yes, you can do that today, but you will loose a lot of Nuke capabilities like nice outputs, time measurement, execution plan visualization etc. Brainstorming a solutionI haven't thought through how such a pipeline syntax in Nuke could really look like but it is anyhow more important first to find out what conceptual approach Nuke should follow. I think it could be based on various aspects of GitHub Actions:
Today we have "only" Targets which are somehow a mix between Jobs and Workflows. The concepts would compare like this: Nuke: NukeAction
Nuke: NukeJob
Nuke: NukeWorkflow:
Such a structure should then also allow proper code generation where the Nuke build.exe is ultimately called with the Job name. Locally the whole workflow could also be executed. ConclusionCI/CD systems are focusing on very similar concepts of a "Pipelines > Jobs > Steps" hierarchy which is controlled through further conditions. Nuke has some overlaps on the Steps/Jobs areas but does not fully match into those principles with primarily Targets as first-class citizen. Adopting various principles into Nuke could be a big benefit as devs and devops' dont need to change their mindset when using Nuke but only need to know the terminology. I personally think it would fit into the principles and goals of Nuke quite well to also adopt those aspects. The adoptions could be done stepwise with adding NukeActions as a start to have defined and reusable building blocks. Later job/workflow additions could be made as own construct with execution plans, conditionals, matrix builds etc. With actions available people might be able to build the pipelines already in the way they like and we don't even need to add everything. References:
|
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I have encountered a number of projects where I had to customize pipelines in ways that the Nuke pipeline attributes could not handle. My usual solution would be to either manually write the pipeline or do some hacky workaround to generate a customized pipeline file.
I have been thinking and came up with a solution I would like to pursue, and I would like to get some critique before pushing forward (If I finish this then it will be open sourced). Keep in mind that I have mostly used nuke with GitHub Workflows and Azure Pipelines.
I like nuke's generated pipelines, but they have a few problems:
So, I thought about making an alternative which gives you full control of the generated files.
The sample build we want to run:
Current generation parameters:
My approach:
Right now, this will produce the following output:
Stuff that's missing but might be possible:
.Produces()
.Requires()
So how does this work?
The basic idea is that surely GitHub workflows can be represented with simple POCOs which are then serialized to YAML. So the
GithubWorkflowDefinition
created by the factory will be serialized using tools provided by nuke'sConfigurationAttributeBase
some code from the implementation:
Stuff that is not in scope:
I hope some of you might like this idea, so if you have some feedback, please share (even if you don't like this idea!)
Beta Was this translation helpful? Give feedback.
All reactions