VS Code extension for working with Azure Pipelines YAML files
Перейти к файлу
Konstantin Tyukalov ac1911a640 Bump schema number to 1.219.1 2023-04-14 17:00:52 +04:00
.azure-pipelines Fixed component governance issue in nodejs package. In the library 'https-proxy-agent', before v2.2.3, there is a failure of TLS enforcement on the socket. Attacker may intercept unencrypted communications. (#462) 2022-04-25 17:36:36 +02:00
.github Update workflow (#512) 2023-03-15 19:43:37 +03:00
.vscode Expand schema auto-detection to all workspaces (#481) 2022-07-20 20:10:42 -04:00
assets add Pipelines icon 2018-08-14 09:11:22 -04:00
examples schema bump to 174 (#343) 2020-08-18 09:55:54 -04:00
resources Added gif for configure-pipeline (#255) 2019-09-06 17:41:10 +05:30
src More auto-detection improvements (#486) 2022-08-11 22:09:40 -07:00
syntaxes Update YAML grammar to match VS Code (#476) 2022-05-25 12:33:34 -04:00
tools/extract-yaml-testcases Bump minimatch from 3.0.4 to 3.1.2 in /tools/extract-yaml-testcases (#500) 2022-11-12 10:28:26 -08:00
.gitattributes generated extension using yo code 2018-08-01 11:00:40 -04:00
.gitignore Update commands for webpack 2021-01-29 10:42:04 -05:00
.vscodeignore Exclude sourcemaps 2021-02-12 23:23:56 -05:00
CHANGELOG.md Release 1.208.0 (#484) 2022-07-20 21:04:04 -04:00
CONTRIBUTING.md split README and CONTRIBUTING 2018-08-09 11:08:26 -04:00
LICENSE Initial commit 2018-07-31 11:39:51 -07:00
README.md Release 1.208.0 (#484) 2022-07-20 21:04:04 -04:00
RELEASE.md Release 1.205.0 (#472) 2022-05-09 21:49:54 -04:00
SECURITY.md Microsoft mandatory file (#473) 2022-05-17 13:27:43 -04:00
language-configuration.json First pass. 2018-08-06 10:36:07 -04:00
package-lock.json Bump xml2js and @azure/ms-rest-js (#518) 2023-04-11 07:55:11 -07:00
package.json Bump webpack from 5.64.2 to 5.76.0 (#511) 2023-03-15 13:57:16 -07:00
service-schema.json Bump schema number to 1.219.1 2023-04-14 17:00:52 +04:00
tsconfig.json WIP: Migrate to new @azure/arm-* packages 2021-01-25 23:36:42 -05:00
tslint.json generated extension using yo code 2018-08-01 11:00:40 -04:00
webpack.config.js Update dependencies (#468) 2022-05-03 15:27:17 -04:00

README.md

Build Status

Azure Pipelines for VS Code

Get it on the VS Code Marketplace!

This VS Code extension adds syntax highlighting and autocompletion for Azure Pipelines YAML to VS Code. It also helps you set up continuous build and deployment for Azure WebApps without leaving VS Code.

Validation

Basic YAML validation is built in to VS Code, but now you can have syntax highlighting that's aware of the Pipelines YAML schema. This means that you get red squigglies if you say tasks: where you meant task:. IntelliSense is also schema-aware. Wherever you are in the file, press Ctrl-Space to see what options you have at that point.

By default, the extension will highlight known Azure Pipelines files in the root of your workspace. You can change the language mode at the lower right to work with one file at a time. Click the language picker, then choose "Azure Pipelines". If you have files which should always use this extension, set your user or workspace settings to match those file paths with this extension. For example:

{
    "files.associations": {
        "**/ci/*.yml": "azure-pipelines"
    }
}

Schema auto-detection

Out of the box, the extension has a generic schema file that includes only in-box tasks. You probably have custom tasks installed in your organization.

To provide the most relevant IntelliSense, the extension will automatically detect and use your organization's schema! All you need to do is follow the instructions when prompted.

If automatic fetching of the organization schema doesn't work, try signing out and signing back in using the Azure: Sign Out and Azure: Sign In commands from the VS Code command palette (Ctrl/Cmd + Shift + P).

Specific schema

If you need to use a specific schema, that is also possible.

  1. Visit https://dev.azure.com/YOUR-ORG-HERE/_apis/distributedtask/yamlschema and save the output as my-schema.json.
  2. Edit your workspace's settings.json to include this:
{
  "azure-pipelines.customSchemaFile": "./path/to/my-schema.json"
}

Document formatting

Since this extension defines a new file type ("azure-pipelines"), any YAML formatter you've installed no longer applies to pipelines documents. Hat tip to @mgexm and @dotnetcanuck for sharing how they restored this functionality. We'll demonstrate with the Prettier VS Code extension:

Add this to your settings.json:

"[azure-pipelines]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},

Both format on save and the Format document command should now work!

Pipeline configuration

Configure Pipeline Demo

To set up a pipeline, choose Azure Pipelines: Configure Pipeline from the command palette (Ctrl/Cmd + Shift + P) or right-click in the file explorer. The guided workflow will generate a starter YAML file defining the build and deploy process.

You can customize the pipeline using all the features offered by Azure Pipelines..

Once the setup is completed, an automatic CI/CD trigger will fire for every code push. To set this up, the extension will ask for a GitHub PAT with repo and admin:repo_hook scope.

GitHub PAT scope

Telemetry

VS Code collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. If you dont wish to send usage data to Microsoft, you can set the telemetry.enableTelemetry setting to false. Learn more in our FAQ.

Troubleshooting failures

  • Selected workspace is not a Git repository: You can configure a pipeline for a Git repository backed by GitHub or Azure Repos. Initialize your workspace as a Git repo, commit your files, and add a remote to GitHub or Azure Repos. Run the following commands to configure git repository:

    git init

    git add *

    git commit -m <commit-message>

    git remote add <remote-name> <remote-url>

  • The current branch doesn't have a tracking branch, and the selected repository has no remotes: You can configure a pipeline for a Git repository backed by GitHub or Azure Repos. To add a new remote Git repository, run git remote add <remote-name> <remote-url>

  • Failed to determine Azure Repo details from remote url: If you're configuring a pipeline for a Git repository backed by Azure Repos, ensure that it has a remote pointing to a valid Azure Repos Git repo URL.

Extension Development

If you are only working on the extension (i.e. syntax highlighting, configure pipeline, and the language client):

  • Run npm install to install all necessary dependencies
  • Run npm run watch to automatically rebuild the extension whenever you make changes
  • Run the "Extension" debug configuration to launch a VS Code window using your modified version of the extension

If you are also working on the language server:

  • Follow the first two steps above
  • Clone the azure-pipelines-language-server repository alongside this repository
  • Run npm link ../azure-pipelines-language-server/language-server
  • Follow the instructions in the language server README to link the language service to the language server
  • Add the azure-pipelines-language-server folder to your VS Code workspace
  • Run the "Launch Extension & Attach to Server" debug configuration
    • Note: In order to attach to the server, the extension must be activated (in other words, make sure you are editing an Azure Pipelines file)
    • In case the attach request timeouts before the server can start, wait for it to start and then run the "Attach to Server" debug configuration

Contributing

See CONTRIBUTING.md if you want to jump in!