Fully customizable pipeline definitions #1230
Replies: 4 comments 6 replies
-
Why use a C# DSL to generate a pipeline instead of writing the pipeline manually? |
Beta Was this translation helpful? Give feedback.
-
This is pretty sweet! I was hunting for the same thing for a slightly different reason. There are a number of Azure Pipelines features that cannot be executed locally and are only provided via Azure Pipelines YAML. A couple examples:
One thought is that you could potentially auto-generate your POCO classes instead of manually keeping them up to date by tapping into the JSON schema files Github and Azure DevOps use to validate their YAML. High level stepsStep 1 - Download the schemaThe JSON Schema can be downloaded from ADO REST API or a variety of locations for GitHub
Step 2 - Generate the POCO classes
Step 3 - Serialize the classes to YAMLI'm assuming something like YAMLDotNet would fit in good here Some cons to this solution
SuggestionMaybe start a new repo that's just dedicated to auto-generating the POCO classes and publishing them as nuget packages and then once that work is done and on some sort of a schedule to ensure it's always up to date then look at leveraging them within this project. |
Beta Was this translation helpful? Give feedback.
-
I think that every possibility to extend Nuke to own specific need would be great. Actually making sth just a little more complex requires coping hundreds of lines from repository to own code just to provide small functionality. Enough to mention the own Agent Name, which isn't uncommon in professional scenarios. I think it would be great to see some kind of road map for better fulfilling Open-Close Principle - opened to extend, closed to changes. |
Beta Was this translation helpful? Give feedback.
-
I did not read everything, but I think I understand what problem you're trying to solve. Attributes for YAML generation were a pretty novel approach, but they also have the shortcomings of constants-only + no OOP. I'm imagining something like this (
The first step would be to gather enough examples for best use-case coverage. I suggested that in Slack a while back already, but no one raised their hand. If there's interest here, let me know. |
Beta Was this translation helpful? Give feedback.
-
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