Comments (10)
Nice! These make sense:
- Id validation can happen for strings too
- Strong-typed logic operators are also nice!
I updated the description.
I am not sure about whether mixing fluent with declaration wouldn't be beneficial (Trigger().Batched()
). Maybe not for those ones but I can imagine for example:
{
Variable("Configuration", "Release").Readonly(),
Variable("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", true),
}
from sharpliner.
I'd go for less typing, also, we can let people define several pipelines if needed and reference them as resources (yes, is a thing and very useful).
from sharpliner.
Comments about the above:
Triggers
I would go the declarative way form
Trigger = Trigger.ForBranch("main", "production").Batch().Exclude("tools/*"),
to
Trigger = {
new {
Branch = {"main", "production"}
IsBatch = true,
Exclude = { "tools/*" }
},
}
Also, should be a collection, we can have more than one trigger AFAIK
PRs
Same comment as with triggers.
Variables
I LOVE this syntax:
If("eq(variables['Build.Reason'], 'PullRequest')")
.Variable("TargetBranch", "$(System.PullRequest.SourceBranch)"),
But I think we should do the following, add the basic conditions in the yaml, there are not than many AND we can be able o validate them:
If.Eq(Variable("Name"), "MyValue")
.Variable("TargetBranch", "$(System.PullRequest.SourceBranch)")
Job
I don't get the idea of the Id, is it really needed if we do static validations?
The rest looks good to me.
from sharpliner.
Yes! We need to find the right balance between the two approaches. I think that adjectives should be all fluent, while properties should all be declarative even if optional. Then use declarative for all conditions. The question is what reads better:
If().Equals("varname", "value")
.Variable("conditionalVar","value");
Or
If(Equals("varname", "value"))
.Variable("condition","value");
I'm going for the second one, because with complex expressions it looks shorter/nicer:
If(And(Equals("var", "value"),Equals("var","value")))
.Variable("var","value");
We should look at Nunit and xUnit for ideas since they have a lot of assertions and more experience. I think with some smart use of genetics this will me very doable.
PS: I think will be shorter because the concatenation of several ands would be very verbose
from sharpliner.
Also, thinking about serialization, 2 is closer to the one used by yaml
from sharpliner.
👍 Makes sense with adjectives
👍 Second one looks almost like YAML so yeah, let's do that one
from sharpliner.
@mandel-macaque another idea:
We could move the top level properties of the Pipeline POCO to the PipelineDefinition
class itself and the user would override those. Rather than having:
protected override Pipeline Pipeline => new()
{
Name = "$(Date:yyyMMdd).$(Rev:rr)",
Variables = new[]
{
Variable("Configuration", "Release"),
},
}
you would do
protected override string Name => "$(Date:yyyMMdd).$(Rev:rr)";
protected override IEnumerable<Variable> Variables => new[]
{
Variable("Configuration", "Release"),
};
But I guess that will be more confusing? I guess it's more typing..
from sharpliner.
I have the API for variable definition ready but I will be moving rooms this weekend so I might be offline.
If you want to have a look or work on top of that it's in the api branch in my fork:
https://github.com/premun/sharpliner/blob/prvysoky/api/tests/Sharpliner.Serialization.Tests/MockPipeline.cs
The whole API now works for VariableDefinition but it can be made generic and applied to steps/jobs too
from sharpliner.
I have this for nested ifs:
from sharpliner.
Closing as it was implemented already in #14 and #15
from sharpliner.
Related Issues (20)
- The "PublishDefinitions" task failed unexpectedly in 1.5.0 HOT 6
- RepositoryResource doesn't serialize RepositoryType.Git HOT 10
- Missing a top level `pool` property on pipeline definition HOT 1
- Add support for each-expressions HOT 8
- Extends definition HOT 3
- Conditionally define `Arguments` for DotNetCoreCLI@2 task HOT 6
- Nested conditioned blocks (`if`, `each`...) not working
- Parameterize ExtendsPipelineDefinition to allow easier inheritance of PipelineWithExtends
- Make FlattenDefinition method on Conditioned public HOT 1
- Referencing a Sharpliner library project directly does not build
- Allow registration of custom validations via `SharplinerConfiguration`
- Allow overriding PipelineBase.Validation in subclasses outside of the Sharpliner project HOT 1
- Add models for PublishTestResults@2 and PublishCodeCoverageResults@1 ADO tasks
- DotNetInstallBuilder.FromGlobalJson() fails to set the useGlobalJson input HOT 1
- Add models for file operation tasks
- Make it easier to export new API
- Workspace = JobWorkspace.All result in error on DevOps Pipeline HOT 2
- How do I use runtime expressions? HOT 3
- Pwsh.Inline() Command HOT 2
- extension methods HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharpliner.