This is part of the Fake.BuildServer.TeamFoundation module.
native support for Azure DevOps (previously VSTS) / Team Foundation Server specific APIs.
The general documentation on how to use CI server integration can be found here
Secret Variables
This CI server supports the concept of secret variables and uses the Vault to store them.
In order to access secret variables you need to use one of the fake 5 tasks from vsts-fsharp.
Example implementation (supports runner and vault tasks)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
|
// Either use a local vault filled by the 'FAKE_VAULT_VARIABLES' environment variable
// or fall back to the build process if none is given
let vault =
match Vault.fromFakeEnvironmentOrNone() with
| Some v -> v // fake 5 vault task, uses 'FAKE_VAULT_VARIABLES' by default
| None -> TeamFoundation.variables // fake 5 runner task
// Only needed if you want to fallback to 'normal' environment variables (locally for example)
let getVarOrDefault name =
match vault.TryGet name with
| Some v -> v
| None -> Environment.environVarOrFail name
Target.create "Deploy" (fun _ ->
let token = getVarOrDefault "github_token"
// Use token to deploy to github
let apiKey = getVarOrDefault "nugetkey"
// Use apiKey to deploy to nuget
()
)
|
val vault : obj
union case Option.Some: Value: 'T -> Option<'T>
val v : obj
union case Option.None: Option<'T>
val getVarOrDefault : name:'a -> 'b
val name : 'a
val v : 'b
Function or value | Description |
TeamFoundation.defaultTraceListener
Signature: ITraceListener
|
|
TeamFoundation.detect()
Signature: unit -> bool
|
|
TeamFoundation.install(force)
Signature: force:bool -> unit
|
|
TeamFoundation.Installer
Signature: BuildServerInstaller
|
|
TeamFoundation.logIssue(...)
Signature: isWarning:bool -> sourcePath:string option -> lineNumber:string option -> columnNumber:string option -> code:string option -> message:string -> unit
|
|
TeamFoundation.setBuildState(...)
Signature: state:string -> message:string -> unit
|
|
TeamFoundation.setLogDetailProgress(...)
Signature: id:Guid -> progress:int -> unit
|
|
TeamFoundation.setVariable(...)
Signature: variableName:string -> value:string -> unit
|
|
TeamFoundation.variables
Signature: Vault
|
Access (secret) build variables
|
TeamFoundation.write(...)
Signature: action:string -> properties:seq<string * string> -> message:string -> unit
|
|