(this is my first question, I gonna try to be understandable)
Objective : From a Powershell script create a new Pipeline from a YAML file (located on a specific branch)
According to the documentation and my own knowledge I got this JSON to create my own pipeline :
$pipelineJSON = @{
configuration = @{
variables = @{
example = @{
value = "to be defined"
}
}
path = "azure-pipelines.yml"
repository = @{
id = "myRepoId"
name = "myRepoName"
type = "azureReposGit"
}
type = "yaml"
}
name = "pipeline-test"
folder= "\\"
} | ConvertTo-Json
$request = 'https://dev.azure.com/' + $organization + '/' + $projectName + '/_apis/pipelines?api-version=6.0-preview.1'
$responseCreatePipeline = Invoke-RestMethod $request -Method 'POST' -Headers $headers -Body $pipelineJSON -ContentType "application/json"
With this code above I can create a pipeline but only from a YAML which is located on the master branch but in my case I want to create this pipeline from a YAML file located in a different branch.
I guess we should be able to add a field in the JSON to specify it but I did not find anything.
Does anyone know how to do it ?