Add better custom transformer example
This commit is contained in:
@@ -86,9 +86,7 @@ jobs:
|
||||
|
||||
</details>
|
||||
|
||||
Despite these 2 pipelines using different syntax they will function equivantly.
|
||||
|
||||
<!-- TODO: Add section for templated pipelines -->
|
||||
Despite these 2 pipelines using different syntax they will function equivalently.
|
||||
|
||||
## Next lab
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ env:
|
||||
jobs:
|
||||
Job_1:
|
||||
name: Agent job 1
|
||||
runs-on: windows-latest
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- mechamachine
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -169,7 +171,7 @@ env:
|
||||
Finally, we can use custom transformers to dictate which runners converted workflows should use. To do this we will need to answer the following questions:
|
||||
|
||||
1. What is label of the runner in Azure DevOps to update?
|
||||
- __windows-latest__
|
||||
- __mechamachine__
|
||||
|
||||
2. What is the label of the runner in Actions to use instead?
|
||||
- __ubuntu-latest__
|
||||
@@ -177,7 +179,7 @@ Finally, we can use custom transformers to dictate which runners converted workf
|
||||
With these questions answered, we can add the following code to the `transformers.rb` file:
|
||||
|
||||
```ruby
|
||||
runner "windows-latest", "ubuntu-latest"
|
||||
runner "mechamachine", "ubuntu-latest"
|
||||
```
|
||||
|
||||
In this example, the first parameter to the `runner` method is the Azure DevOps label and the second is the Actions runner label.
|
||||
@@ -185,9 +187,10 @@ In this example, the first parameter to the `runner` method is the Azure DevOps
|
||||
Now, we can perform another `dry-run` command with the `--custom-transformers` CLI option. When you open the converted workflow the `runs-on` statement will use the customized runner label:
|
||||
|
||||
```diff
|
||||
runs-on:
|
||||
- - windows-latest
|
||||
+ - ubuntu-latest
|
||||
- runs-on:
|
||||
- - self-hosted
|
||||
- - mechamachine
|
||||
+ runs-on: ubuntu-latest
|
||||
```
|
||||
|
||||
At this point of the lab the file contents of `transformers.rb` should match this:
|
||||
@@ -216,7 +219,7 @@ end
|
||||
|
||||
env "BUILDCONFIGURATION", "Debug"
|
||||
|
||||
runner "windows-latest", "ubuntu-latest"
|
||||
runner "mechamachine", "ubuntu-latest"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
@@ -1,29 +1,26 @@
|
||||
---
|
||||
variables:
|
||||
- name: BuildParameters.RESTOREBUILDPROJECTS
|
||||
value: "**/*.csproj"
|
||||
- name: BUILDCONFIGURATION
|
||||
value: Release
|
||||
name: "$(date:yyyyMMdd)$(rev:.r)"
|
||||
- name: BuildParameters.RESTOREBUILDPROJECTS
|
||||
value: "**/*.csproj"
|
||||
- name: BUILDCONFIGURATION
|
||||
value: Release
|
||||
name: "custom-transformer-example"
|
||||
jobs:
|
||||
- job: Job_1
|
||||
displayName: Agent job 1
|
||||
pool:
|
||||
vmImage: windows-latest
|
||||
steps:
|
||||
- checkout: self
|
||||
- task: NodeTool@0
|
||||
displayName: Use Node 10.16.3
|
||||
inputs:
|
||||
versionSpec: 10.16.3
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Restore
|
||||
inputs:
|
||||
command: restore
|
||||
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Build
|
||||
inputs:
|
||||
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
|
||||
arguments: "--configuration $(BUILDCONFIGURATION)"
|
||||
|
||||
- job: Job_1
|
||||
displayName: Agent job 1
|
||||
pool: "mechamachine"
|
||||
steps:
|
||||
- checkout: self
|
||||
- task: NodeTool@0
|
||||
displayName: Use Node 10.16.3
|
||||
inputs:
|
||||
versionSpec: 10.16.3
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Restore
|
||||
inputs:
|
||||
command: restore
|
||||
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Build
|
||||
inputs:
|
||||
projects: "$(BuildParameters.RESTOREBUILDPROJECTS)"
|
||||
arguments: "--configuration $(BUILDCONFIGURATION)"
|
||||
|
||||
Reference in New Issue
Block a user