Module for working with a Make
Type | Description |
A computation expression builder for creating a memoized Make with parallel access. This is used with MakeBuilders.memoRace. |
|
A computation expression builder for creating a retryable Make. This is used with MakeBuilders.retry. |
Function or value | Description |
Full Usage:
bind binder make ctx
Parameters:
'T -> Make<'U>
-
The binder function.
make : Make<'T>
-
The existing Make.
ctx : MakeContext
-
The current MakeContext.
Returns: Result<'U, MakeError>
A new Make.
|
Takes a binder function to create a new Make from the result of an existing Make. This is typically used in computation expressions automatically, but can be used manually.
Example
let newMake : Make<unit> = let exampleMake : Make<string list> = fun (ctx: MakeContext) -> Ok ctx.ExtraArgs exampleMake |> Make.bind (fun args -> Cmd.createWithArgs "dotnet" args |> Cmd.run) |
Full Usage:
context arg0
Parameters:
MakeContext
Returns: Result<MakeContext, MakeError>
The Make contains a MakeContext.
|
Gets a Make that can be used to retrieve the current MakeContext. This is typically used in computation expressions.
Example
let ctxMake = make { let! ctx = Make.context printfn "%s" ctx.PipelineName } |
Full Usage:
fail message arg2
Parameters:
string
-
The message to be printed as the failure reason.
arg1 : MakeContext
Returns: Result<'T, MakeError>
An Error Make
|
Example
let errMake = make { do! Make.fail "Oh no!" } |
Full Usage:
failMessages messages arg2
Parameters:
Message list
-
The messages to be printed.
arg1 : MakeContext
Returns: Result<'T, MakeError>
An Error Make
|
Fails the current Make with a list of Message to be printed. This can be used to create detailed multi-line failures.
Example
let failMake = make { do! [ Console.error "Oh " |> Console.appendToken "no!" ] |> Make.failMessages } |
Full Usage:
map mapping make ctx
Parameters:
'T -> 'U
-
The mapping function.
make : Make<'T>
-
The existing Make.
ctx : MakeContext
-
The current MakeContext.
Returns: Result<'U, MakeError>
A new Make.
|
Takes a mapping function to create a new Make from the result of an existing Make. This is typically used in computation expressions automatically, but can be used manually.
Example
let boolMake : Make<bool> = let stringMake : Make<string> = fun (ctx: MakeContext) -> Ok ctx.StepName stringMake |> Make.map (fun stepName -> stepName = "build") |
Memoizes a Make so it is only executed once. Subsequent executions return the result immediately. This only allows single access to the Make, so if it is run in parallel, only one will run and the rest will block until a result is available. Example
let versionMake = Cmd.createWithArgs "dotnet" [ "gitversion" ] |> Cmd.run |> Make.memo |
|
|
Memoizes a Make so it is only executed once. Subsequent executions return the result immediately. Unlike Make.memo, this allows parallel executions to occur. If it is run in parallel, it will be run multiple times until a result has been stored. Once a result has been stored, subsequent runs will immediately return the result. Example
let versionMake = Cmd.createWithArgs "dotnet" [ "gitversion" ] |> Cmd.result |> Make.memoRace |
|
Creates a new Make from an existing one, that adds retry behaviour. This will "catch" all errors except for MakeError.MakeAbort. Example
let cmdWithRetry = Cmd.createWithArgs "dotnet" [ "test" ] |> Cmd.run |> Make.retry 2 |
Full Usage:
return' value arg2
Parameters:
'T
-
The value to be wrapped.
arg1 : MakeContext
Returns: Result<'T, MakeError>
The wrapped value.
|
Wraps a value in a Make. This is typically used in computation expressions automatically, but can be used manually.
Example
let wrappedValue : Make<int> = Make.return' 5 |
Full Usage:
zero arg1
Parameters:
MakeContext
Returns: Result<unit, MakeError>
An empty Make.
|
Creates an empty Make. This is typically used in computation expressions automatically, but can be used manually.
Example
let emptyMake : Make<unit> = Make.zero |
Full Usage:
zip make1 make2 ctx
Parameters:
Make<'T>
-
The first make.
make2 : Make<'T1>
-
The second make.
ctx : MakeContext
-
The current MakeContext.
Returns: Result<('T * 'T1), MakeError>
The tupled result.
|
Takes two Make and creates a tuple Make of their results. This is typically used in computation expressions automatically, but can be used manually.
Example
let make1 = Make.zero let make2 = Make.zero let exampleMake : Make<unit * unit> = Make.zip make1 make2 |