Skip to content

Commit 28253d8

Browse files
azp: Update README and watch logic of validate/expand
1 parent ebe8c84 commit 28253d8

File tree

2 files changed

+40
-75
lines changed

2 files changed

+40
-75
lines changed

Diff for: src/azure-pipelines-vscode-ext/README.md

+32-73
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
# Azure Pipelines Tools VSCode Extension
1+
# Azure Pipelines Tools for VSCode
22

3-
This is a minimal Azure Pipelines Extension, the first vscode Extension which can Validate and Expand Azure Pipeline YAML files locally without any REST service.
3+
The first VSCode Extension which can Validate and Expand Azure Pipeline YAML files locally without any REST service.
44

5-
![Validate Azure Pipelines via ContextMenu](https://raw.githubusercontent.com/ChristopherHX/runner.server/main/docs/azure-pipelines/images/validate-azure-pipeline-via-contextmenu.gif)
6-
![Expand Azure Pipelines via ContextMenu](https://raw.githubusercontent.com/ChristopherHX/runner.server/main/docs/azure-pipelines/images/expand-azure-pipeline-via-contextmenu.gif)
5+
#### Live syntax checking for pipelines
6+
![Live syntax checking for pipelines](https://raw.githubusercontent.com/wiki/ChristopherHX/runner.server/live-syntax-check.gif)
7+
8+
#### Live preview of the extended / rendered pipeline
9+
![Live preview of the extended / rendered pipeline](https://raw.githubusercontent.com/wiki/ChristopherHX/runner.server/live-preview.gif)
710

811
## Features
912

@@ -17,18 +20,26 @@ Syntax `[<owner>/]<repo>@<ref>=<uri>` per line. `<uri>` can be formed like `file
1720

1821
`> Check Syntax Azure Pipeline`
1922

20-
This command explicitly checks for syntax errors in the yaml structure and expression syntaxes. These are necessary but not sufficient checks for a successful Validation of the Azure Pipeline File.
23+
This command explicitly checks for syntax errors in the yaml structure and expression syntaxes.
24+
25+
Referenced templates are read to apply the correct schema for their parameters, if this fails this check is disabled.
26+
27+
These are necessary but not sufficient checks for a successful Validation of the Azure Pipeline File.
2128

2229
### Validate Azure Pipeline
2330

2431
`> Validate Azure Pipeline`
2532

33+
**Use this command on your entrypoint Pipeline, otherwise parameters may be missing**
34+
2635
This command tries to evaluate your current open Azure Pipeline including templates and notifies you about the result.
2736

2837
### Expand Azure Pipeline
2938

3039
`> Expand Azure Pipeline`
3140

41+
**Use this command on your entrypoint Pipeline, otherwise parameters may be missing**
42+
3243
This command tries to evaluate your current open Azure Pipeline including templates and show the result in a new document, which you can save or validate via the official api.
3344

3445
### Azure Pipelines Linter Task
@@ -104,74 +115,26 @@ You can configure parameters, variables, repositories per task. You can define m
104115
]
105116
}
106117
```
107-
Sample Pipeline which dumps the parameters object (legacy parameters syntax)
118+
Sample Pipeline which dumps the parameters objec
108119
```yaml
109120
parameters:
110-
booleanparam:
111-
numberparam:
112-
stringparam:
113-
objectparam:
114-
arrayparam:
121+
- name: booleanparam
122+
type: boolean
123+
- name: numberparam
124+
type: number
125+
- name: stringparam
126+
type: string
127+
- name: objectparam
128+
type: object
129+
- name: arrayparam
130+
type: object
115131
steps:
116132
- script: echo '${{ converttojson(parameters) }}'
117133
- script: echo '${{ converttojson(variables) }}'
118134
```
119135
120-
### Azure Pipelines Debug Adapter
121-
122-
![Demo](https://raw.githubusercontent.com/ChristopherHX/runner.server/main/docs/azure-pipelines/images/demo.gif)
123-
124-
Sample Debugging configuration
125-
`.vscode/launch.json`
126-
```jsonc
127-
{
128-
"type": "azure-pipelines-vscode-ext",
129-
"request": "launch",
130-
"name": "Test Pipeline (watch)",
131-
"program": "${workspaceFolder}/azure-pipeline.yml",
132-
"repositories": {
133-
"myrepo@windows": "file:///C:/AzurePipelines/myrepo",
134-
"myrepo@unix": "file:///AzurePipelines/myrepo",
135-
"myrepo@github": "vscode-vfs://github/AzurePipelines/myrepo", // Only default branch, url doesn't accept readable ref
136-
"myrepo@azure": "vscode-vfs://azurerepos/AzurePipelines/myrepo/myrepo" // Only default branch, url doesn't accept readable ref
137-
},
138-
"parameters": {
139-
"booleanparam": true,
140-
"numberparam": 12,
141-
"stringparam": "Hello World",
142-
"objectparam": {
143-
"booleanparam": true,
144-
"numberparam": 12,
145-
"stringparam": "Hello World",
146-
},
147-
"arrayparam": [
148-
true,
149-
12,
150-
"Hello World"
151-
]
152-
},
153-
"variables": {
154-
"system.debug": "true"
155-
},
156-
"watch": true,
157-
"preview": true
158-
}
159-
```
160-
161-
Sample Pipeline which dumps the parameters object (legacy parameters syntax)
162-
```yaml
163-
parameters:
164-
booleanparam:
165-
numberparam:
166-
stringparam:
167-
objectparam:
168-
arrayparam:
169-
steps:
170-
- script: echo '${{ converttojson(parameters) }}'
171-
- script: echo '${{ converttojson(variables) }}'
172-
```
136+
Sample output for task with label test
173137
174-
Output of the Sample Pipeline
175138
```yaml
176139
stages:
177140
- stage:
@@ -200,6 +163,7 @@ stages:
200163
inputs:
201164
script: |-
202165
echo '{
166+
"myvar": "testx",
203167
"system.debug": "true"
204168
}'
205169
```
@@ -210,23 +174,18 @@ stages:
210174
- You can run template files with the same template engine locally via the [Runner.Client and Server tool](https://github.com/ChristopherHX/runner.server) using the official Azure Pipelines Agent
211175
- `Runner.Client azexpand` works like Valdate Azure Pipeline by only checking the return value to be zero
212176
- `Runner.Client azexpand -q > final.yml` works like Expand Azure Pipeline, but directly writes the expanded file to disk
213-
- Fast feedback
214-
- Fast to install
215177
- Less trial and error commits
216-
- You can help by reporting bugs
217-
- It's fully Open Source under the MIT license
218178
- Works side by side with the official Azure Pipelines VSCode extension
219179

220180
## Contra
221181
- May contain different bugs than the Azure Pipelines Service
222-
- You could self-host Azure Devops Server and commit your changes to your local system with more accurate results of the template engine
223-
- May not have feature parity with Azure Pipelines
182+
- You can self-host Azure Devops Server and commit your changes to your local system with more accurate results of the template engine
224183
- Missing predefined Variables, feel free to add them manually as needed
225184

226185
## Available in both VSCode Marketplace and Open VSX Registry
227186

228-
[Azure Pipelines Tools (VSCode Marketplace)](https://marketplace.visualstudio.com/items?itemName=christopherhx.azure-pipelines-vscode-ext)
229-
[Azure Pipelines Tools (Open VSX Registry)](https://open-vsx.org/extension/christopherhx/azure-pipelines-vscode-ext)
187+
- [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=christopherhx.azure-pipelines-vscode-ext)
188+
- [Open VSX Registry](https://open-vsx.org/extension/christopherhx/azure-pipelines-vscode-ext)
230189

231190
## Contributing
232191

Diff for: src/azure-pipelines-vscode-ext/index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,9 @@ function activate(context) {
742742
inProgress = true;
743743
try {
744744
var hasErrors = false;
745+
await new Promise((resolve) => {
746+
setTimeout(resolve, 1);
747+
});
745748
await expandAzurePipeline(false, self.repositories ?? args.repositories, args.variables, self.parameters ?? args.parameters, async result => {
746749
if(!args.syntaxOnly) {
747750
task.info(result);
@@ -766,9 +769,12 @@ function activate(context) {
766769
}
767770
}
768771
}, task, self.collection, self, !askForInput, args.syntaxOnly, args.schema);
769-
} catch {
770-
772+
} catch(err) {
773+
task.error(err?.toString() ?? "Unknown Error");
771774
}
775+
await new Promise((resolve) => {
776+
setTimeout(resolve, 1);
777+
});
772778
inProgress = false;
773779
if(!args.watch) {
774780
close();

0 commit comments

Comments
 (0)