Files
importer-labs/jenkins/5-migrate.md
T

56 lines
2.7 KiB
Markdown
Raw Normal View History

2022-09-06 12:20:34 -07:00
# Perform a production migration of a Jenkins pipeline
2022-08-18 16:02:26 -07:00
2022-09-06 12:20:34 -07:00
In this lab, you will use the `migrate` command to convert a Jenkins pipeline and open a pull request with the equivalent Actions workflow.
2022-08-18 16:02:26 -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 start a Jenkins server.
2022-09-06 12:20:34 -07:00
2. Completed the [configure lab](./1-configure-lab.md#configuring-credentials).
3. Completed the [dry-run lab](./3-dry-run.md).
4. Completed the [custom transformers lab](./4-custom-transformers.md).
2022-08-18 16:02:26 -07:00
2022-09-06 12:47:23 -07:00
## Performing a migration
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
Answer the following questions before running a `migrate` command:
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
1. What is the source URL of the pipeline you want to convert?
2022-09-06 12:20:34 -07:00
- __<http://localhost:8080/monas_dev_work/job/monas_freestyle>__
2022-09-13 08:55:51 -04:00
2. Where do you want to store the logs?
2022-09-06 12:20:34 -07:00
- __./tmp/migrate__
3. What is the URL for the GitHub repository to add the workflow to?
2022-09-09 08:21:26 -07:00
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
2022-08-18 16:02:26 -07:00
2022-09-06 12:47:23 -07:00
### Steps
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
1. Run the following `migrate` command in your codespace terminal:
2022-08-18 16:02:26 -07:00
2022-08-25 16:28:07 -07:00
```bash
2022-09-07 16:13:27 -07:00
gh valet migrate jenkins --target-url https://github.com/:owner/:repo --output-dir ./tmp/migrate --source-url http://localhost:8080/job/monas_dev_work/job/monas_freestyle
2022-08-25 16:28:07 -07:00
```
2022-08-18 16:02:26 -07:00
2022-09-06 12:20:34 -07:00
2. The command will write the URL to the pull request that was created when the command succeeds.
2022-09-06 12:47:23 -07:00
2022-09-06 12:20:34 -07:00
![img](https://user-images.githubusercontent.com/19557880/185509412-ab64d92d-2a56-4d5a-bbb4-35a41a2ca48c.png)
2022-08-18 16:02:26 -07:00
2022-09-06 12:20:34 -07:00
3. Open the generated pull request in a new browser tab.
2022-08-18 16:02:26 -07:00
2022-09-06 12:20:34 -07:00
### Inspect the pull request
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
The first thing we should notice about the pull request is that there is a list of manual steps to complete:
2022-08-25 16:28:07 -07:00
2022-09-06 12:20:34 -07:00
![img](https://user-images.githubusercontent.com/19557880/186784161-b7882ac4-ac99-4462-b69f-f49b9202527b.png)
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
Next, review the workflow you are adding by clicking on the `Files changed` tab. This is where you double check that everything looks good. If it didn't, you could push commits with the required changes, prior to merging.
2022-08-18 16:02:26 -07:00
2022-09-13 08:55:51 -04:00
Next, you can inspect the "Files changed" in this pull request and 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-08-18 16:02:26 -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-06 12:20:34 -07:00
![img](https://user-images.githubusercontent.com/19557880/185509704-90243ec5-e77f-4baf-a9b2-d9a4d9fda199.png)
At this point, the migration has completed and you have successfully migrated a Jenkins pipeline to Actions!
### Next lab
[Forecast potential build runner usage](6-forecast.md)