edits to custom transformers

This commit is contained in:
Jennifer Kerns
2022-11-07 09:51:44 -08:00
committed by GitHub
parent 6f3c122e01
commit ca4eecca2c
+7 -7
View File
@@ -1,6 +1,6 @@
# Use custom transformers to customize GitHub Actions Importer's behavior
In this lab you will build upon the `dry-run` command to override GitHub Actions Importer's default behavior and customize the converted workflow using "custom transformers". Custom transformers can be used to:
In this lab you will build upon the `dry-run` command to override GitHub Actions Importer's default behavior and customize the converted workflow using "custom transformers." Custom transformers can be used to:
1. Convert items that are not automatically converted.
2. Convert items that were automatically converted using different actions.
@@ -13,7 +13,7 @@ In this lab you will build upon the `dry-run` command to override GitHub Actions
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
3. Completed the [dry-run lab](./4-dry-run.md).
## Perform a dry-run
## Perform a dry run
You will be performing a `dry-run` command to inspect the workflow that is converted by default. Run the following command within the codespace terminal:
@@ -109,7 +109,7 @@ transform "sleep" do |item|
end
```
This method can use any valid ruby syntax and should return a `Hash` that represents the YAML that should be generated for a given step. GitHub Actions Importer will use this method to convert a step with the provided identifier and will use the `item` parameter for the original values configured in Jenkins.
This method can use any valid Ruby syntax and should return a `Hash` that represents the YAML that should be generated for a given step. GitHub Actions Importer will use this method to convert a step with the provided identifier and will use the `item` parameter for the original values configured in Jenkins.
Now you can perform another `dry-run` command and use the `--custom-transformers` CLI option to provide this custom transformer. Run the following command within your codespace terminal:
@@ -117,7 +117,7 @@ Now you can perform another `dry-run` command and use the `--custom-transformers
gh actions-importer dry-run jenkins --source-url http://localhost:8080/job/test_pipeline --output-dir tmp/dry-run --custom-transformers transformers.rb
```
Open the workflow that is generated and inspect the contents. Now the `sleep` step is converted and uses the customized behavior!
Open the workflow that is generated and inspect the contents. Now the `sleep` step is converted and uses the customized behavior.
```diff
- # # This item has no matching transformer
@@ -158,7 +158,7 @@ transform "junit" do |item|
end
```
Now, we can perform another `dry-run` command with the `--custom-transformers` CLI option. The output of the `dry-run` command should look similar to this:
Now, you can perform another `dry-run` command with the `--custom-transformers` CLI option. The output of the `dry-run` command should look similar to this:
```console
$ gh actions-importer dry-run jenkins --source-url http://localhost:8080/job/test_pipeline --output-dir tmp/dry-run --custom-transformers transformers.rb
@@ -226,7 +226,7 @@ env:
Finally, you can use custom transformers to dictate which runners the converted workflows should use. To do this, answer the following questions:
1. What is label of the runner in Jenkins to update?
1. What is the label of the runner in Jenkins to update?
- __TeamARunner__
2. What is the label of the runner in Actions to use instead?
@@ -287,7 +287,7 @@ At this point the file contents of `transformers.rb` should match this:
</details>
That's it! Congratulations, you have overridden GitHub Actions Importer's default behavior by customizing the conversion of:
That's it. Congratulations, you have overridden GitHub Actions Importer's default behavior by customizing the conversion of:
- Unknown steps
- Known steps