Files
importer-labs/azure_devops/6-migrate.md
T

60 lines
2.9 KiB
Markdown
Raw Normal View History

2022-09-07 16:13:27 -07:00
# Perform a production migration of an Azure DevOps pipeline
2022-05-25 10:57:51 -07:00
2022-09-07 16:13:27 -07:00
In this lab, you will use the `migrate` command to convert an Azure DevOps pipeline and open a pull request with the equivalent Actions workflow.
2022-05-10 14:32:07 -07:00
## Prerequisites
2022-09-13 08:55:51 -04:00
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and bootstrap an Azure DevOps project.
2022-09-16 12:35:07 -07:00
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
3. Completed the [dry-run lab](./4-dry-run.md).
2022-05-10 14:32:07 -07:00
2022-09-07 16:13:27 -07:00
## Performing a migration
2022-05-10 14:32:07 -07:00
2022-09-13 08:55:51 -04:00
Answer the following questions before running a `migrate` command:
2022-05-10 14:32:07 -07:00
2022-11-06 16:33:41 -08:00
1. What is the ID of the pipeline to convert?
- __:pipeline_id__. This ID can be found by:
2022-09-07 16:13:27 -07:00
- Navigating to the build pipelines in the bootstrapped Azure DevOps project <https://dev.azure.com/:organization/:project/_build>
2022-11-03 12:47:40 -07:00
- Selecting the pipeline with the name "pipeline2"
2022-11-06 16:33:41 -08:00
- Inspecting the URL to locate the pipeline ID <https://dev.azure.com/:organization/:project/_build?definitionId=:pipeline_id>
2022-09-13 08:55:51 -04:00
2. Where do you want to store the logs?
2022-09-16 12:35:07 -07:00
- __tmp/migrate__
2022-09-07 16:13:27 -07:00
3. What is the URL for the GitHub repository to add the workflow to?
2022-09-20 09:44:41 -07:00
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
2022-05-10 14:32:07 -07:00
2022-09-07 16:13:27 -07:00
### Steps
2022-05-10 14:32:07 -07:00
2022-09-07 16:13:27 -07:00
1. Run the following `migrate` command in the codespace terminal:
2022-05-10 14:32:07 -07:00
2022-09-07 16:13:27 -07:00
```bash
2022-11-02 21:02:30 -07:00
gh actions-importer migrate azure-devops pipeline --pipeline-id :pipeline_id --target-url https://github.com/:owner/:repo --output-dir tmp/migrate
2022-09-07 16:13:27 -07:00
```
2022-05-25 10:57:51 -07:00
2022-11-06 16:33:41 -08:00
2. The command will write the URL to the pull request that is created when the command succeeds.
2022-05-10 14:32:07 -07:00
2022-09-16 12:35:07 -07:00
```console
2022-11-02 21:02:30 -07:00
$ gh actions-importer migrate azure-devops pipeline --pipeline-id 8 --target-url https://github.com/ethanis/labs --output-dir tmp/migrate
2022-11-03 12:47:40 -07:00
[2022-09-07 20:25:08] Logs: 'tmp/dry-run/log/actions-importer-20220907-202508.log'
2022-09-07 16:13:27 -07:00
[2022-09-07 20:25:13] Pull request: 'https://github.com/ethanis/labs/pull/42'
```
2022-05-10 14:32:07 -07:00
2022-09-07 16:13:27 -07:00
3. Open the generated pull request in a new browser tab.
2022-05-25 10:57:51 -07:00
2022-09-07 16:13:27 -07:00
### Inspect the pull request
2022-05-10 14:32:07 -07:00
2022-09-13 08:55:51 -04:00
The first thing to notice about the pull request is that there is a list of manual steps to complete:
2022-05-10 14:32:07 -07:00
2022-09-07 16:49:07 -07:00
![img](https://user-images.githubusercontent.com/8703324/189002125-45561312-dd26-42fd-bd38-a596614ee871.png)
2022-09-07 16:13:27 -07:00
2022-09-13 08:55:51 -04:00
Next, you can inspect the `Files changed` in this pull request to see the converted workflow that is being added. Any additional changes or code reviews that were needed should be done in this pull request.
2022-09-07 16:13:27 -07:00
2022-09-13 08:55:51 -04:00
Finally, you can merge the pull request once your review has completed. You can then view the workflow running by selecting the `Actions` menu in the top navigation bar in GitHub.
2022-09-07 16:13:27 -07:00
![img](https://user-images.githubusercontent.com/19557880/185509704-90243ec5-e77f-4baf-a9b2-d9a4d9fda199.png)
2022-11-06 16:33:41 -08:00
At this point, the migration has completed and you have successfully migrated an Azure DevOps pipeline to Actions.
2022-09-07 16:13:27 -07:00
### Next lab
2022-11-06 16:33:41 -08:00
This concludes all labs for migrating Azure DevOps pipelines to Actions with GitHub Actions Importer.