Yaml BuildPipeLine Preview is a small extension to check the syntax and "runabilitly" for a pipeline.
It adds a ability to test your current yaml - pipeline file with the preview api from azure devops to check the syntax of your file - without need to check it in or run a real build/release
It uses a feature mentioned in the forum here: DeveloperCommunity - Ability to test yaml builds locally
You need a azure devOps project and a created pipeline in the specific project you want to run it in. Additionally the extension needs an Personal Access Token to invoke the Azure DevOps Pipelines API.
Pls refer to the Azure DevOps Documentation to create one in your organisation
You just need to open up the yml file and select the command in the context menu or the commandlist
context menu: or here from the list:
Then the extension tries to obtain the information needed to invoke the devops api.
The extension validates the current Situation.
following errors can occur:
no file editor opened - pls open the yaml file!
: well should be self explaining...thats no yml file!!! please open the yaml-pipeline file!
: well should be self explaining...
The extension tries to identify the Azure Devops orgaisation and project.
If the setting do not have the property ymlbuildpipelinepreview.azureDevOpsUrl
is not set, the extension looks if the code is hosted in the Azure DevOps Git repo - if yes the remote url is used to identify it.
If the remote url is found - you see that message:
If this is not possible the extension asks you with an input box Url of the Azure DevOps tenant you are using including the path to the Project. (e.g. https://dev.azure.com/{Organisation}/{Project} or https://{Organisation}.visualstudio.com/DefaultCollection/{Project})
. Please hand over the url and we can proceed...
If the Url is not provided or not parseable - you get the message:
😕 please provide an Azure DevOpsUrl to connect to it! aborting..
if the token is not found in the .vscode/settings.json file (property: ymlbuildpipelinepreview.devOpsApiPAT
)
You will get asked:
Please enter Personal Access Token for the DevOpsAPI in ${organisation} -> ${project}
Please hand over the url and we can proceed...
if you do not enter a value you will get the message no PAT no build 😥 - aborting...
if the token is not found in the .vscode/settings.json file (property: ymlbuildpipelinepreview.pipelineID
)
You will get asked:
Please enter a valid PipelineID
Please hand over the url and we can proceed...
if you do not enter a value you will get the message no Pipeline ID no build 😥 - aborting...
next the extension tries to get the yml content from the editor and send it to the Azure DevOps Pipelines API.
if the response indicates success - the simulation was successful - you get the message
if not you will get for example the following message:
in this example the error is at Line 26 - position 1 - with clicking the button "Jump there" the cursor gets set to the specific position.
Include if your extension adds any VS Code settings through the contributes.configuration
extension point.
For example:
This extension contributes the following settings:
ymlbuildpipelinepreview.devOpsApiPAT
: Personal Access Token for invoking the APIymlbuildpipelinepreview.pipelineID
: Pipeline ID to be used for simulating the pipeline runymlbuildpipelinepreview.azureDevOpsUrl
: devOps Url where your project and pipelines are hosted. if hosted in an azure devops git repo the extension tries to identifiy it from there.
if the settings are not set you get asked on the first run of the extension in your project.
none so far but you are in the early stage of development 😅.
Users appreciate release notes as you update your extension.
Initial release of it :P
Bundle updates and readme fixes...
Fix parsing DevOpsUrl...
Fix in menu definition...
it is published under MIT License.