azure-pipelines
How to create new build pipeline using Azure DevOps REST API?
How to create new build pipeline using Azure DevOps REST API? To create the new build pipeline, we could use the REST API Definitions – Create: POST https://dev.azure.com/{organization}/{project}/_apis/build/definitions?api-version=5.0 But we need provide too much information in the Request Body, this will be a big project and error-prone. That also the reason why the document not … Read more
How to use a variable in each loop in Azure DevOps yaml pipeline
No, you can’t. It only works for parameters, not variables: You can use the each keyword to loop through parameters This is because: before it runs, the yaml is parsed and compiled into a pipeline structure, with all the stages, jobs and tasks defined. This is the point when the loop condition is evaluated, and … Read more
Fatal: Could not read password for ‘https://[email protected]’: terminal prompts disabled
As you mentioned you need to use PAT but in this way: git push https://{PAT}@dev.azure.com/{organization}/{project}/_git/{repo-name} Another solution is to “Allow scripts to access the OAuth token” in the job options: In the git push use the System.AccessToken: git push https://$env:[email protected]/…… And give push permissions to the build user (in the repo settings):
How to get the IP Address for Azure DevOps Hosted Agents to add to the white list
I have a step in a release that gets the Hosted Agent IP address in powershell with: Invoke-RestMethod http://ipinfo.io/json | Select -exp ip Hope that helps.
Share variables across stages in Azure DevOps Pipelines
Updated: Share variables across stages feature has been released in Sprint 168 now. Please use below format to access output variables from previous stage: stageDependencies.{stageName}.{jobName}.outputs[‘{stepName}.{variableName}’] Original: Share variables across stages in Azure DevOps Pipelines I’m afraid to say that it does not supported to share the variable which defined in one stage and pass it … Read more
Is it possible to conditionally set the artifact name in my Azure DevOps build pipeline “publish artifact” task?
Is it possible to conditionally set the artifact name in my Azure DevOps build pipeline “publish artifact” task? I am afraid there is no such out of box way to do that. If you want to conditionally set the artifact name, we have to use the nested variables in the pipeline. However, At this moment, … Read more
Copy one file in target directory on deploy from visual studio team services
You need to specify the copy root if you want to copy files only without folder structure. Since the project.exe is in a different path with script.ps1 file, you need to copy them in different copy task. Following the steps below: Add a “Copy Files” step to copy “project.exe”. Settings like following: Add a “Copy … Read more
Checkout part of a branch in Azure DevOps Pipelines (GetSources)
In Azure DevOps you don’t have option to get only part of the repository, but there is a workaround: Disable the “Get sources” step and get only the source you want by manually executing the according git commands in a script. To disable the default “Get Sources” just specify none in the checkout statement: – … Read more
Triggering Azure DevOps builds based on changes to sub folders
You can do like below Create variables based on your microservices with the values “False” E.g,MicroserviceAUpdated= “False”,MicroserviceBUpdated= “False” etc., Add a Powershell script task at the begin of your build definition. The powershell script will do the following: Get the changeset/commit in the build to check which files are changed. Update the MicroserviceAUpdated variable to … Read more