Add better custom transformer example

This commit is contained in:
Ethan Dennis
2022-09-07 16:57:06 -07:00
parent dc7c478762
commit b23666978e
5 changed files with 37 additions and 39 deletions
+1 -3
View File
@@ -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
+10 -7
View File
@@ -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)"
+1 -1
View File
@@ -198,7 +198,7 @@ jobs:
```
</details>
Despite these 2 pipelines using different syntax they will function equivantly.
Despite these 2 pipelines using different syntax they will function equivalently.
## Perform a dry-run of a pipeline using `include`'d files
+1 -1
View File
@@ -123,7 +123,7 @@ jobs:
</details>
These 2 pipelines function equivantly despite using different syntax. In this case, the pipeline conversion was “partially successful” (i.e. there were item(s) not automatically converted) and the unconverted item was placed as comment in the location the Jenkins pipeline used it. For example:
These 2 pipelines function equivalently despite using different syntax. In this case, the pipeline conversion was “partially successful” (i.e. there were item(s) not automatically converted) and the unconverted item was placed as comment in the location the Jenkins pipeline used it. For example:
```diff
- sleep 80