Skip to content

Commit c94e5ee

Browse files
committed
Add docs and last patch
1 parent e0f7b63 commit c94e5ee

File tree

5 files changed

+57
-6
lines changed

5 files changed

+57
-6
lines changed

LEARN.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Learning Bicep and how the tasks works
2+
3+
Bicep is a Domain Specific Language (DSL) for deploying Azure resources declaratively. The official documentation and sources to learn Bicep can be found in [the oficial repository](https://github.com/Azure/bicep).
4+
5+
In order to compile `.bicep` files, the Bicep CLI is used.
6+
The aim of this extension is to manage the installation and use of the Bicep CLI in Azure DevOps pipelines and ease the process of `.bicep` files compilation.
7+
8+
# How the tasks works
9+
10+
The extension has two tasks, one to install and make available the CLI for subsequent tasks and other to execute the `bicep build` command with a series of files (with globbing support).
11+
12+
The first task (`BicepInstall`) should be executed always before the second task (`BicepBuild`). For example:
13+
14+
```yaml
15+
- task: BicepInstall@0
16+
displayName: 'Install Bicep CLI'
17+
18+
- task: BicepBuild@0
19+
displayName: 'Compile .bicep files'
20+
inputs:
21+
sourceDirectory: 'bicep_files/**.bicep'
22+
```
23+
24+
The `BicepInstall` has a optional argument to specify the version of Bicep to be used (in the format `major.minor.patch`). For example:
25+
26+
```yaml
27+
- task: BicepInstall@0
28+
displayName: 'Install Bicep CLI'
29+
inputs:
30+
version: '0.2.328'
31+
```
32+
33+
Also, the `BicepBuild` task, accepts glob patterns and single files. The example above, shows how to use glob patterns, and if you want specify only a single file, just specify its relative or full path:
34+
35+
```yaml
36+
- task: BicepBuild@0
37+
displayName: 'Compile .bicep files'
38+
inputs:
39+
sourceDirectory: 'bicep_files/sample1.bicep'
40+
```
41+
42+
A full example of pipeline can be found in this repository, in the `azure-pipelines.yml` file in the repository root directory.
43+
44+
# See it in action
45+
46+
A complete pipeline using different environments is run in every commit push and its available to review if you would like to see it.
47+
48+
[See the pipeline](https://raulejea.visualstudio.com/Bicep%20Tasks/_build?definitionId=19&_a=summary)

src/install/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 0
19+
"Patch": 1
2020
},
2121
"instanceNameFormat": "Install Bicep CLI",
2222
"inputs": [

src/run/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ async function run() {
2626
try {
2727
if (bicepToolName && bicepToolVersion) {
2828
bicepTool = toolLib.findLocalTool(bicepToolName, bicepToolVersion);
29+
if (bicepTool) {
30+
bicepTool = path.join(bicepTool, bicepToolName);
31+
}
2932
}
3033

3134
if (!bicepTool) {
32-
const defaultToolName = platform() === 'win32' ? 'bicep.exe' : 'bicep';
33-
bicepTool = taskLib.which(defaultToolName);
35+
bicepTool = taskLib.getVariable('BICEP_PATH');
3436
}
3537

3638
if (!bicepTool) {
37-
bicepTool = taskLib.getVariable('BICEP_PATH');
39+
const defaultToolName = platform() === 'win32' ? 'bicep.exe' : 'bicep';
40+
bicepTool = taskLib.which(defaultToolName);
3841
}
3942
} catch (error) {
4043
throw new Error(

src/run/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 0,
1818
"Minor": 1,
19-
"Patch": 0
19+
"Patch": 1
2020
},
2121
"instanceNameFormat": "Run Bicep CLI build command",
2222
"inputs": [

vss-extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifestVersion": 1,
33
"id": "bicep-tasks",
4-
"version": "0.1.0",
4+
"version": "0.1.1",
55
"name": "Bicep Tasks",
66
"publisher": "piraces",
77
"description": "Provides Azure DevOps tasks to install and run Microsoft Bicep CLI commands (cross-platform)",

0 commit comments

Comments
 (0)