Compare commits
161 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a3e38018d | |||
| 9fae1e2f98 | |||
| 2993e78968 | |||
| f0ed52f038 | |||
| eec4a08f3c | |||
| 2353dbcd01 | |||
| 3350ff1f50 | |||
| 9a9debca99 | |||
| dd1aaafca0 | |||
| 811c306549 | |||
| 8675b7f2c8 | |||
| e058da6a01 | |||
| 7ce343a687 | |||
| 33a0d421a1 | |||
| f1e83f2239 | |||
| 7517b9070d | |||
| f1306b3ed3 | |||
| caa5e9a3f8 | |||
| 4481eef856 | |||
| 25fad773dc | |||
| cdd19b7f92 | |||
| 6ee6678cbf | |||
| f9475dde2f | |||
| 597c53896c | |||
| 4af988afe7 | |||
| dd7f063fed | |||
| 2bead72366 | |||
| d06e69b75d | |||
| f98963a7f0 | |||
| 54c96b13a1 | |||
| be726d3f41 | |||
| 1c5b58c0bd | |||
| fcdb140ee1 | |||
| 60b0811484 | |||
| ae278d1117 | |||
| 59458685b5 | |||
| 2054b73280 | |||
| 124e02a205 | |||
| 491aa0b8f6 | |||
| 3c52632220 | |||
| fa7b9a7ae0 | |||
| c8437b934f | |||
| 4b04f91a54 | |||
| d86f482d72 | |||
| 0d8457a47d | |||
| 7442d905b9 | |||
| 2c1bb69a29 | |||
| 5aee14b780 | |||
| 5e5f771af3 | |||
| a778993f72 | |||
| 6657d643b0 | |||
| fde943babc | |||
| 2ca47ca3cb | |||
| 6cae6721b6 | |||
| d803e738fe | |||
| ea93a54bbd | |||
| 12b938c03d | |||
| d749e6a7ae | |||
| c1a7803b17 | |||
| d2bdef163b | |||
| e315d70f7f | |||
| 49b9740a60 | |||
| 9a13315187 | |||
| b3f5687f96 | |||
| 77c9c1ace1 | |||
| 0c7b876f2b | |||
| fa792998ea | |||
| 27dca266dd | |||
| 600cd55114 | |||
| dfdf139a11 | |||
| 4727555680 | |||
| 70498223b4 | |||
| 7e87a54116 | |||
| 3a1f819309 | |||
| 05f38299a1 | |||
| fd0ec20770 | |||
| 9c72eddfff | |||
| d023f964e1 | |||
| cc65edf859 | |||
| 4b0f54c96e | |||
| 0e7d888728 | |||
| 173902d5bb | |||
| e2f3f5a9fd | |||
| 33e00d97b8 | |||
| 5e1a824c4d | |||
| 2a8b7b83ba | |||
| cf019c6c07 | |||
| 92f0b33803 | |||
| cfe6caf8bc | |||
| 137ae80d9d | |||
| 31fd4761b6 | |||
| c8a639c48a | |||
| d5133b77e2 | |||
| 2946620cc0 | |||
| 3c3ede3b89 | |||
| 6d80cdbd7d | |||
| bc8fa917ce | |||
| 16f8d5a323 | |||
| cef7385f42 | |||
| 1a3fd1ef5b | |||
| 3efee3e1d7 | |||
| 6c070b8e3f | |||
| d077fe9773 | |||
| 07b2ef2938 | |||
| ff002aa1dd | |||
| b2b01dd98a | |||
| 95afadd4f7 | |||
| c77329cd4d | |||
| 6601664b88 | |||
| 5fdf5f90fe | |||
| c7272d85b9 | |||
| ca4eecca2c | |||
| 1e7f2ab323 | |||
| 5421a25f8d | |||
| 88810f4ceb | |||
| b214284196 | |||
| 94002e3cf2 | |||
| 6f3c122e01 | |||
| 9f3c5595bd | |||
| b9cc59be01 | |||
| 90aeb74f38 | |||
| ac6bedf263 | |||
| dd9faf0584 | |||
| 2ead842c21 | |||
| 900e978dc5 | |||
| f39d65d1ca | |||
| 56baee6a36 | |||
| 7d3e07190a | |||
| c4b92c0c1e | |||
| 4aaf6acc09 | |||
| 5e3bfb324f | |||
| ecff705a2f | |||
| 13613acde9 | |||
| fb4952b646 | |||
| 218b175a7f | |||
| 9fada52c09 | |||
| f0a9aa6803 | |||
| fc682fdb0c | |||
| 3ca3e8892f | |||
| 1bd72a56b2 | |||
| a65de52b71 | |||
| c710981ac4 | |||
| 5a8f6cf548 | |||
| b58809dba6 | |||
| 52cf54e628 | |||
| dc2401535b | |||
| f0c38094ef | |||
| 4f76389f74 | |||
| 6ff2e73b30 | |||
| a928d518b0 | |||
| 080ceaca74 | |||
| 23f3aa35fa | |||
| 4c6408eb5b | |||
| 90f372591c | |||
| 5ce36485fe | |||
| 31edc2ef46 | |||
| cb256c8c34 | |||
| 8518aa6262 | |||
| 400b212787 | |||
| 4ed3b8f2bd | |||
| ddeb9a1249 |
@@ -1,9 +1,13 @@
|
||||
{
|
||||
"name": "Codespace to perform GitHub Actions Importer Labs",
|
||||
"remoteEnv": {
|
||||
"DOCKER_ARGS": "--network=host",
|
||||
"INSTALLATION_TYPE": "labs"
|
||||
},
|
||||
"hostRequirements": {
|
||||
"cpus": 4,
|
||||
"memory": "8gb",
|
||||
"storage": "32gb"
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
@@ -16,4 +20,4 @@
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "gh extension install github/gh-actions-importer || echo 'Could not auto-build. Skipping.' "
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
* @actions/importer
|
||||
* @actions/migration-tools-reviewers
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 GitHub
|
||||
Copyright (c) 2023 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -29,10 +29,10 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Legacy tokens` (if present).
|
||||
- Click `Generate new token` and then `Generate new legacy token`. You may be required to authenticate with GitHub during this step.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scopes: `workflow` and `read:packages`.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
|
||||
@@ -40,8 +40,6 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- Select the `TERMINAL` tab from within the codespace terminal.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `Azure DevOps`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub handle prompt, enter the GitHub handle used to generate the GitHub PAT in step 2 and press enter.
|
||||
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 2 and press enter.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 2 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Azure DevOps token prompt, enter the access token from step 1 and press enter.
|
||||
@@ -53,8 +51,6 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Azure DevOps
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ GitHub handle used to authenticate with the GitHub Container Registry: mona
|
||||
✔ Personal access token to authenticate with the GitHub Container Registry: ***************
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Azure DevOps: ***************
|
||||
@@ -66,7 +62,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify our environment is configured correctly, run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
To verify your environment is configured correctly, run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal, run the following command:
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ Supported: **5 (100%)**
|
||||
- YAML: **3**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Pipelines" section in the above example:
|
||||
Here are some key terms in the "Pipelines" section:
|
||||
|
||||
- __Successful__ pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- __Partially successful__ pipelines had all of the pipeline constructs converted, however, there were some individual items (e.g. build tasks or build triggers) that were not converted automatically to their GitHub Actions equivalent.
|
||||
@@ -111,7 +111,7 @@ Actions: **19**
|
||||
- actions/setup-node@v2: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Build steps" section in the above example:
|
||||
Here are some key terms in the "Build steps" section:
|
||||
|
||||
- A __known__ build step is a step that was automatically converted to an equivalent action.
|
||||
- An __unknown__ build step is a step that was not automatically converted to an equivalent action.
|
||||
@@ -138,7 +138,7 @@ Self hosted runners: **1**
|
||||
- `mechamachine`: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Manual tasks" section in the above example:
|
||||
Here are some key terms in the "Manual tasks" section:
|
||||
|
||||
- A __secret__ refers to a repository or organization level secret that is used by the converted pipelines. These secrets will need to be created manually in Actions in order for these pipelines to function properly.
|
||||
- A __self-hosted runner__ refers to a label of a runner that is referenced by a converted pipeline that is not a GitHub-hosted runner. You will need to manually define these runners in order for these pipelines to function properly.
|
||||
@@ -176,7 +176,7 @@ Each pipeline will have a variety of files written that include:
|
||||
- The converted workflow.
|
||||
- Stack traces that can used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage csv file
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
@@ -33,11 +33,34 @@ Answer the following questions before running the `forecast` command:
|
||||
|
||||
3. The command will output a message that says "No jobs found" because no jobs have been executed in your bootstrapped project.
|
||||
|
||||

|
||||
```console
|
||||
$ gh actions-importer forecast azure-devops --output-dir tmp/forecast
|
||||
[2022-08-20 22:08:20] Logs: 'tmp/forecast/log/actions-importer-20220916-021004.log'
|
||||
[2022-08-20 22:08:20] Forecasting 'http://dev.azure.com/mona/actions-bootstrap/_build'
|
||||
[2022-08-20 22:08:20] No jobs found
|
||||
```
|
||||
|
||||
4. If you inspect the help menu using the `gh actions-importer forecast --help` command, you will see a `--source-file-path` option. You can use this option to perform a `forecast` using json files that are already present on the filesystem. These labs come bundled with sample json files located [here](./bootstrap/jobs.json).
|
||||
4. If you inspect the help menu using the `gh actions-importer azure-devops forecast --help` command, you will see a `--source-file-path` option. You can use this option to perform a `forecast` using json files that are already present on the filesystem. These labs come bundled with sample json files located [here](./bootstrap/jobs.json).
|
||||
|
||||

|
||||
```console
|
||||
$ gh actions-importer forecast azure-devops -h
|
||||
Options:
|
||||
-g, --azure-devops-organization <azure-devops-organization> The Azure DevOps organization name.
|
||||
-p, --azure-devops-project <azure-devops-project> The Azure DevOps project name.
|
||||
-u, --azure-devops-instance-url <azure-devops-instance-url> The URL of the Azure DevOps instance.
|
||||
-t, --azure-devops-access-token <azure-devops-access-token> Access token for the Azure DevOps instance.
|
||||
--source-file-path <source-file-path> The file path(s) to existing jobs data.
|
||||
-o, --output-dir <output-dir> (REQUIRED) The location for any output files.
|
||||
--start-date <start-date> The start date of the forecast analysis in YYYY-MM-DD format. [default:
|
||||
10/31/2022 8:35:17 AM]
|
||||
--time-slice <time-slice> The time slice in seconds to use for computing concurrency metrics.
|
||||
[default: 60]
|
||||
--credentials-file <credentials-file> The file containing the credentials to use.
|
||||
--no-telemetry Boolean value to disallow telemetry.
|
||||
--no-ssl-verify Disable ssl certificate verification.
|
||||
--no-http-cache Disable caching of http responses.
|
||||
-?, -h, --help Show help and usage information
|
||||
```
|
||||
|
||||
5. Run the following `forecast` command while specifying the path to the sample json files:
|
||||
|
||||
@@ -47,7 +70,13 @@ Answer the following questions before running the `forecast` command:
|
||||
|
||||
6. The command will list all the files written to disk when the command succeeds.
|
||||
|
||||

|
||||
```console
|
||||
$ gh actions-importer forecast azure-devops --output-dir tmp/forecast --source-file-path azure_devops/bootstrap/jobs.json
|
||||
[2022-08-20 22:08:20] Logs: 'tmp/forecast/log/actions-importer-20220916-021004.log'
|
||||
[2022-08-20 22:08:20] Forecasting 'http://dev.azure.com/mona/actions-bootstrap/_build'
|
||||
[2022-08-20 22:08:20] Outfile file(s):
|
||||
[2022-08-20 22:08:20] ./tmp/forecast/forecast_report.md
|
||||
```
|
||||
|
||||
## Review the forecast report
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ end
|
||||
|
||||
The `transform` 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 Azure DevOps.
|
||||
|
||||
Now, we can perform a `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 a `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 azure-devops pipeline --pipeline-id 6 --output-dir tmp/dry-run --custom-transformers transformers.rb
|
||||
@@ -153,7 +153,7 @@ Now you can perform another `dry-run` command and use the `--custom-transformers
|
||||
gh actions-importer dry-run azure-devops pipeline --pipeline-id :pipeline_id --output-dir tmp/dry-run --custom-transformers transformers.rb
|
||||
```
|
||||
|
||||
Open the workflow that is generated and inspect the contents. Now the `DotnetCoreCLI@2` steps are converted using the customized behavior!
|
||||
Open the workflow that is generated and inspect the contents. The `DotnetCoreCLI@2` steps are now converted using the customized behavior.
|
||||
|
||||
```diff
|
||||
- - name: Restore
|
||||
|
||||
@@ -12,11 +12,11 @@ In this lab, you will use the `migrate` command to convert an Azure DevOps pipel
|
||||
|
||||
Answer the following questions before running a `migrate` command:
|
||||
|
||||
1. What is the id of the pipeline to convert?
|
||||
- __:pipeline_id__. This id can be found by:
|
||||
1. What is the ID of the pipeline to convert?
|
||||
- __:pipeline_id__. This ID can be found by:
|
||||
- Navigating to the build pipelines in the bootstrapped Azure DevOps project <https://dev.azure.com/:organization/:project/_build>
|
||||
- Selecting the pipeline with the name "pipeline2"
|
||||
- Inspecting the URL to locate the pipeline id <https://dev.azure.com/:organization/:project/_build?definitionId=:pipeline_id>
|
||||
- Inspecting the URL to locate the pipeline ID <https://dev.azure.com/:organization/:project/_build?definitionId=:pipeline_id>
|
||||
2. Where do you want to store the logs?
|
||||
- __tmp/migrate__
|
||||
3. What is the URL for the GitHub repository to add the workflow to?
|
||||
@@ -30,7 +30,7 @@ Answer the following questions before running a `migrate` command:
|
||||
gh actions-importer migrate azure-devops pipeline --pipeline-id :pipeline_id --target-url https://github.com/:owner/:repo --output-dir tmp/migrate
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
2. The command will write the URL to the pull request that is created when the command succeeds.
|
||||
|
||||
```console
|
||||
$ gh actions-importer migrate azure-devops pipeline --pipeline-id 8 --target-url https://github.com/ethanis/labs --output-dir tmp/migrate
|
||||
@@ -52,8 +52,8 @@ Finally, you can merge the pull request once your review has completed. You can
|
||||
|
||||

|
||||
|
||||
At this point, the migration has completed and you have successfully migrated an Azure DevOps pipeline to Actions!
|
||||
At this point, the migration has completed and you have successfully migrated an Azure DevOps pipeline to Actions.
|
||||
|
||||
### Next lab
|
||||
|
||||
This concludes all labs for migrating Azure DevOps pipelines to Actions with GitHub Actions Importer!
|
||||
This concludes all labs for migrating Azure DevOps pipelines to Actions with GitHub Actions Importer.
|
||||
|
||||
@@ -32,15 +32,62 @@ def post_request(uri, body, access_token)
|
||||
request.content_type = 'application/json'
|
||||
|
||||
response = http.request request
|
||||
abort_on_ado_error!(response, uri)
|
||||
|
||||
yield(response) if block_given?
|
||||
|
||||
sleep(5)
|
||||
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
end
|
||||
|
||||
def get_request(uri, access_token)
|
||||
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
||||
request = Net::HTTP::Get.new(uri)
|
||||
request.basic_auth "", access_token
|
||||
response = http.request request
|
||||
|
||||
yield(response) if block_given?
|
||||
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
end
|
||||
|
||||
def abort_on_ado_error!(response, uri)
|
||||
return if response.code.start_with?("20")
|
||||
|
||||
message = case response.code
|
||||
when "401"
|
||||
"Please ensure that your Azure DevOps access token has the correct permissions."
|
||||
when "404"
|
||||
JSON.parse(response.body)["message"]
|
||||
when "302"
|
||||
"Please ensure that your Azure DevOps access token is entered correctly"
|
||||
else
|
||||
begin
|
||||
JSON.parse(response.body)["message"]
|
||||
rescue JSON::ParserError
|
||||
response.body
|
||||
end
|
||||
end
|
||||
abort "Error encountered on request:#{uri}\n StatusCode:#{response.code}\n Message: '#{message}'"
|
||||
end
|
||||
|
||||
|
||||
|
||||
def project_exists?(options)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
access_token = options[:access_token]
|
||||
|
||||
uri = URI("https://dev.azure.com/#{organization}/_apis/projects/#{project}?api-version=6.0")
|
||||
get_request(uri, access_token) do |response|
|
||||
return response.code.start_with?("20")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create_project(options)
|
||||
organization = options[:organization]
|
||||
project = options[:project]
|
||||
@@ -62,9 +109,7 @@ def create_project(options)
|
||||
}
|
||||
}
|
||||
|
||||
post_request(uri, project_to_create, access_token) do |response|
|
||||
raise "Error creating project (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
post_request(uri, project_to_create, access_token)
|
||||
end
|
||||
|
||||
def create_repository(options)
|
||||
@@ -92,7 +137,7 @@ def create_repository(options)
|
||||
}],
|
||||
commits: [{
|
||||
comment: "Initial commit.",
|
||||
changes: Dir[File.join(tmp_dir, "**/*")].reject {|f| File.directory?(f) }.map do |entry|
|
||||
changes: Dir[File.join(tmp_dir, "**/*.{cs,csproj,sln,yml}")].reject {|f| File.directory?(f) }.map do |entry|
|
||||
{
|
||||
changeType: "add",
|
||||
item: {
|
||||
@@ -107,10 +152,7 @@ def create_repository(options)
|
||||
}]
|
||||
}
|
||||
|
||||
result = post_request(uri, repository_to_create, access_token) do |response|
|
||||
raise "Error creating repository (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
|
||||
result = post_request(uri, repository_to_create, access_token)
|
||||
[result, tmp_dir]
|
||||
end
|
||||
|
||||
@@ -143,9 +185,7 @@ def create_yaml_pipelines(options, repository, tmp_dir)
|
||||
}
|
||||
}
|
||||
|
||||
post_request(uri, pipeline_to_create, access_token) do |response|
|
||||
raise "Error creating pipeline (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
post_request(uri, pipeline_to_create, access_token)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -170,9 +210,7 @@ def create_classic_pipelines(options, repository)
|
||||
pipeline_to_create["repository"]["name"] = repository_name
|
||||
pipeline_to_create["repository"]["id"] = repository_id
|
||||
|
||||
post_request(uri, pipeline_to_create, access_token) do |response|
|
||||
raise "Error creating pipeline (#{response.code}:#{response.message})" unless response.code.start_with?("20")
|
||||
end
|
||||
post_request(uri, pipeline_to_create, access_token)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -186,7 +224,14 @@ def update_forecast_source_file(options, tmp_dir)
|
||||
File.write(File.join(root_dir, jobs_data_file), jobs_data)
|
||||
end
|
||||
|
||||
create_project(options)
|
||||
|
||||
if project_exists?(options)
|
||||
print "Project '#{options[:project]}' already exists. Would you like to continue? [y/N]"
|
||||
abort unless gets.chomp.casecmp? "y"
|
||||
else
|
||||
create_project(options)
|
||||
end
|
||||
|
||||
repository, tmp_dir = create_repository(options)
|
||||
create_yaml_pipelines(options, repository, tmp_dir)
|
||||
create_classic_pipelines(options, repository)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Azure Pipelines to Actions migrations powered by GitHub Actions Importer
|
||||
# Azure Pipelines migrations powered by GitHub Actions Importer
|
||||
|
||||
These instructions will guide you through configuring the GitHub Codespaces environment that will be used in these labs to demonstrate how to use GitHub Actions Importer to migrate Azure DevOps pipelines to GitHub Actions.
|
||||
These instructions will guide you through configuring the GitHub Codespaces environment that you will use in these labs to learn how to use GitHub Actions Importer to migrate Azure DevOps pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
@@ -34,7 +34,7 @@ These steps **must** be completed prior to starting other labs.
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the troubleshooting [guide](#troubleshoot-the-actions-importer/cli).
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Bootstrap your Azure DevOps organization
|
||||
|
||||
@@ -45,7 +45,7 @@ These steps **must** be completed prior to starting other labs.
|
||||
- Click `Personal access tokens`.
|
||||
- Select `+ New Token`
|
||||
- Name your token, select the organization where you want to use the token, and set your token to automatically expire after a set number of days.
|
||||
- Select the following scopes (you may need to `Show all scopes` at the bottom of the page to reveal all scopes):
|
||||
- Select the following scopes (you may need to select `Show all scopes` at the bottom of the page to reveal all scopes):
|
||||
- Agents Pool: `Read`
|
||||
- Build: `Read & execute`
|
||||
- Code: `Read & write`
|
||||
@@ -101,9 +101,6 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- If you get an error similar to the image below, click the link in the terminal output to authorize the token.
|
||||
- Restart the codespace after clicking the link.
|
||||

|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# Configure credentials for GitHub Actions Importer
|
||||
|
||||
In this lab, you will use the `configure` CLI command to set the required credentials and information for GitHub Actions Importer to use when working with Bamboo and GitHub.
|
||||
|
||||
You will need to complete all of the [setup instructions](./readme.md#configure-your-codespace) prior to performing this lab.
|
||||
|
||||
## Configuring credentials
|
||||
|
||||
1. Create a GitHub personal access token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
|
||||
2. Create a Bamboo personal access token using the Bamboo [documentation](https://confluence.atlassian.com/bamboo/personal-access-tokens-976779873.html). This step is optional since we are using local files throughout the labs and a random value can be used instead.
|
||||
|
||||
3. Run the `configure` CLI command:
|
||||
- Select the `TERMINAL` tab from within the codespace terminal.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `Bamboo`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 1 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Bamboo token prompt, enter the access token from step 2 and press enter.
|
||||
- At the Bamboo URL prompt, enter your Bamboo Base URL.
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify your environment is configured correctly, run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal, run the following command:
|
||||
|
||||
```bash
|
||||
gh actions-importer update
|
||||
```
|
||||
|
||||
2. You should see a confirmation that you were logged into the GitHub Container Registry and the image was updated to the latest version.
|
||||
|
||||
```console
|
||||
$ gh actions-importer update
|
||||
Updating ghcr.io/actions-importer/cli:latest...
|
||||
ghcr.io/actions-importer/cli:latest up-to-date
|
||||
```
|
||||
|
||||
### Next lab
|
||||
|
||||
[Perform an audit of audit of a Bamboo project](2-audit.md)
|
||||
@@ -0,0 +1,187 @@
|
||||
# Perform an audit of an Bamboo plan
|
||||
|
||||
In this lab, you will use the `audit` command to get a high-level view of all pipelines in a Bamboo config file. This lab uses local config files to demonstrate the actions-importer functionality.
|
||||
|
||||
The `audit` command will perform the following steps:
|
||||
|
||||
1. Determine the build plans and deployment projects defined in a local config file.
|
||||
2. Convert each pipeline to their equivalent GitHub Actions workflow.
|
||||
3. Generate a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and bootstrap a Bamboo project.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
|
||||
## Perform an audit
|
||||
|
||||
You will audit the configured Bamboo pipelines. Answer the following questions before running this command:
|
||||
|
||||
1. Where is the local configuration file?
|
||||
- __bamboo/bootstrap/config.yml__
|
||||
|
||||
2. Where do you want to store the result?
|
||||
- __tmp/audit__
|
||||
- This can be any path within the working directory from which GitHub Actions Importer commands are executed.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to the codespace terminal.
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer audit bamboo -o tmp/audit --config-file-path bamboo/bootstrap/config.yml
|
||||
```
|
||||
> Note: The `--config-file-path` option is not required and is used throughout these labs to convert files that are stored locally for this lab. When performing a migration on your own Bamboo Server, `config-file-path` can be omitted and GitHub Actions Importer will programmatically fetch pipelines using the Bambooo REST APIs.
|
||||
|
||||
3. The command will list all the files written to disk in green when the command succeeds.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
1. Find the `audit_summary.md` file in the file explorer.
|
||||
2. Right-click the `audit_summary.md` file and select `Open Preview`.
|
||||
3. This file contains details that summarize what percentage of your pipelines were converted automatically.
|
||||
|
||||
### Review audit summary
|
||||
|
||||
#### Pipelines
|
||||
|
||||
The pipeline summary section contains high level statistics regarding the conversion rate done by GitHub Actions Importer:
|
||||
|
||||
```md
|
||||
## Pipelines
|
||||
|
||||
Total: **2**
|
||||
|
||||
- Successful: **2 (100%)**
|
||||
- Partially successful: **0 (0%)**
|
||||
- Unsupported: **0 (0%)**
|
||||
- Failed: **0 (0%)**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Pipelines" section:
|
||||
|
||||
- __Successful__ pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- __Partially successful__ pipelines had all of the pipeline constructs converted, however, there were some individual items (e.g. build tasks or build triggers) that were not converted automatically to their GitHub Actions equivalent.
|
||||
- __Unsupported__ pipelines are definition types that are not supported by GitHub Actions Importer.
|
||||
- __Failed__ pipelines encountered a fatal error when being converted. This can occur for one of three reasons:
|
||||
- The pipeline was misconfigured and not valid in Bamboo.
|
||||
- GitHub Actions Importer encountered an internal error when converting it.
|
||||
- There was an unsuccessful network response, often due to invalid credentials, that caused the pipeline to be inaccessible.
|
||||
|
||||
#### Job Types
|
||||
The "Job types" section will summarize which types of pipelines are being used and which are supported or unsupported by GitHub Actions Importer.
|
||||
|
||||
```
|
||||
### Job types
|
||||
|
||||
Supported: **2 (100%)**
|
||||
|
||||
- build: **2**
|
||||
```
|
||||
|
||||
#### Build steps
|
||||
|
||||
The build steps summary section presents an overview of the individual build steps that are used across all pipelines and how many were automatically converted by GitHub Actions Importer.
|
||||
|
||||
```md
|
||||
### Build steps
|
||||
|
||||
Total: **15**
|
||||
|
||||
Known: **15 (100%)**
|
||||
|
||||
- checkout: **6**
|
||||
- script: **4**
|
||||
- any-task/plugin-key/com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-aws-codedeploy:task.aws.codeDeploy: **2**
|
||||
- any-task/plugin-key/com.atlassian.bamboo.plugins.bamboo-nodejs-plugin:task.reporter.mocha: **1**
|
||||
- test-parser/type/junit: **1**
|
||||
- any-task/plugin-key/com.atlassian.bamboo.plugins.bamboo-nodejs-plugin:task.builder.npm: **1**
|
||||
|
||||
Actions: **17**
|
||||
|
||||
- actions/checkout@v3.5.0: **6**
|
||||
- run: **6**
|
||||
- EnricoMi/publish-unit-test-result-action@v2.9.0: **2**
|
||||
- actions/setup-node@v3.7.0: **1**
|
||||
- aws-actions/configure-aws-credentials@v2.2.0: **1**
|
||||
- actions/upload-artifact@v3.1.1: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Build steps" section:
|
||||
|
||||
- A __known__ build step is a step that was automatically converted to an equivalent action.
|
||||
- An __unknown__ build step is a step that was not automatically converted to an equivalent action.
|
||||
- An __unsupported__ build step is a step that is either:
|
||||
- A step that is fundamentally not supported by GitHub Actions.
|
||||
- A step that is configured in a way that is incompatible with GitHub Actions.
|
||||
- An __action__ is a list of the actions that were used in the converted workflows. This is important for the following scenarios:
|
||||
- Gathering the list of actions to sync to your appliance if you use GitHub Enterprise Server.
|
||||
- Defining an organization-level allowlist of actions that can be used. This list of actions is a comprehensive list of which actions their security and/or compliance teams will need to review.
|
||||
|
||||
There is an equivalent breakdown of build triggers, environment variables, and other uncategorized items displayed in the audit summary file.
|
||||
|
||||
#### Manual Tasks
|
||||
|
||||
The manual tasks summary section presents an overview of the manual tasks that you will need to perform that GitHub Actions Importer is not able to complete automatically.
|
||||
|
||||
```
|
||||
### Manual tasks
|
||||
|
||||
Total: **3**
|
||||
|
||||
Secrets: **3**
|
||||
|
||||
- `${{ secrets.AWS_ACCESS_KEY_ID }}`: **1**
|
||||
- `${{ secrets.AWS_SECRET_ACCESS_KEY }}`: **1**
|
||||
- `${{ secrets.AWS_S3_BUCKET_KEY }}`: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Manual tasks" section:
|
||||
|
||||
- A __secret__ refers to a repository or organization level secret that is used by the converted pipelines. These secrets will need to be created manually in Actions in order for these pipelines to function properly.
|
||||
- A __self-hosted runner__ refers to a label of a runner that is referenced by a converted pipeline that is not a GitHub-hosted runner. You will need to manually define these runners in order for these pipelines to function properly.
|
||||
|
||||
#### Files
|
||||
|
||||
The final section of the audit report provides a manifest of all of the files that are written to disk during the audit.
|
||||
|
||||
Each pipeline will have a variety of files written that include:
|
||||
|
||||
- The original pipeline as it was defined in Bamboo.
|
||||
- Any network responses used to convert a pipeline.
|
||||
- The converted workflow.
|
||||
- Stack traces that can used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
```csv
|
||||
Pipeline,Action,File path
|
||||
sam/sample,actions/checkout@v3.5.0,tmp/audit/build/sam/sample/.github/workflows/sample.yml
|
||||
sam/sample,actions/upload-artifact@v3.1.1,tmp/audit/build/sam/sample/.github/workflows/sample.yml
|
||||
demo/mar,actions/checkout@v3.5.0,tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
demo/mar,actions/setup-node@v3.7.0,tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
demo/mar,EnricoMi/publish-unit-test-result-action@v2.9.0,tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
demo/mar,aws-actions/configure-aws-credentials@v2.2.0,tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
|
||||
Pipeline,Secret,File path
|
||||
demo/mar,${{ secrets.AWS_ACCESS_KEY_ID }},tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
demo/mar,${{ secrets.AWS_SECRET_ACCESS_KEY }},tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
demo/mar,${{ secrets.AWS_S3_BUCKET_KEY }},tmp/audit/build/demo/mar/.github/workflows/mar.yml
|
||||
|
||||
Pipeline,Runner,File path
|
||||
```
|
||||
|
||||
The contents of this file can be useful in answering questions similar to the following:
|
||||
|
||||
- What workflows will depend on which actions?
|
||||
- What workflows use an action that must go through a security review?
|
||||
- What workflows use specific secrets?
|
||||
- What workflows use specific runners?
|
||||
|
||||
### Next lab
|
||||
|
||||
[Forecast potential build runner usage](3-forecast.md)
|
||||
@@ -0,0 +1,102 @@
|
||||
# Forecast potential build runner usage
|
||||
|
||||
In this lab you will use the `forecast` command to forecast potential GitHub Actions usage by computing metrics from completed plan runs in Bamboo.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the [steps to set up your GitHub Codespaces](./readme.md#configure-your-codespace) environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
|
||||
## Perform a forecast
|
||||
|
||||
Answer the following questions before running the `forecast` command:
|
||||
|
||||
1. What workspace do you want to run the forecast for?
|
||||
- **actions-importer**
|
||||
2. What is the date you want to start forecasting from?
|
||||
- **2023-08-01**. By default, the value is set to one week ago, but it's recommended that you choose a start date that provides a representative view of typical usage.
|
||||
3. Where do you want to store the results?
|
||||
- **tmp/forecast**
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to your codespace terminal
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer forecast bamboo --start-date 2023-08-01 --output-dir tmp/forecast --source-file-path bamboo/**/source_files/*.json
|
||||
```
|
||||
> Note: The `--source-file-path` option is not required and is used throughout this lab to convert files that are stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch historical pipeline runs using the Bamboo REST APIs.
|
||||
3. The command will list all the files written to disk when the command succeeds.
|
||||
```console
|
||||
Logs: 'tmp/forecast/log/valet-20230915-223223.log'
|
||||
Forecasting 'https://<bamboo-server>.com'
|
||||
Output file(s):
|
||||
tmp/forecast/forecast_report.md
|
||||
```
|
||||
## Review the forecast report
|
||||
The forecast report, logs, and completed job data will be located within the `tmp/forecast` folder.
|
||||
1. Find the `forecast_report.md` file in the file explorer.
|
||||
2. Right-click the `forecast_report.md` file and select `Open Preview`.
|
||||
3. This file contains metrics used to forecast potential GitHub Actions usage.
|
||||
|
||||
### Total
|
||||
|
||||
The "Total" section of the forecast report contains high level statistics related to all the jobs completed after the `--start-date` CLI option:
|
||||
|
||||
```md
|
||||
- Job count: **40**
|
||||
- Pipeline count: **4**
|
||||
|
||||
- Execution time
|
||||
|
||||
- Total: **64 minutes**
|
||||
- Median: **1 minutes**
|
||||
- P90: **4 minutes**
|
||||
- Min: **0 minutes**
|
||||
- Max: **4 minutes**
|
||||
|
||||
- Queue time
|
||||
|
||||
- Median: **0 minutes**
|
||||
- P90: **2 minutes**
|
||||
- Min: **0 minutes**
|
||||
- Max: **2 minutes**
|
||||
|
||||
- Concurrent jobs
|
||||
|
||||
- Median: **0**
|
||||
- P90: **0**
|
||||
- Min: **0**
|
||||
- Max: **3**
|
||||
```
|
||||
|
||||
Here are some key terms of items defined in the forecast report:
|
||||
- The `job count` is the total number of completed jobs.
|
||||
- The `pipeline count` is the number of unique pipelines used.
|
||||
- `Execution time` describes the amount of time a runner spent on a job. This metric can be used to help plan for the cost of GitHub-hosted runners.
|
||||
- This metric is correlated to how much you should expect to spend in GitHub Actions. This will vary depending on the hardware used for these minutes. You can use the [Actions pricing calculator](https://github.com/pricing/calculator) to estimate a dollar amount.
|
||||
- `Concurrent jobs` metrics describe the amount of jobs running at any given time. This metric can be used to define the number of runners a customer should configure.
|
||||
Additionally, these metrics are defined by hosted and self-hosted runners.
|
||||
## Forecasting multiple providers
|
||||
You can examine the available options for the `forecast` command by running `gh actions-importer forecast --help`. When you do this you will see the `--source-file-path` option:
|
||||
```console
|
||||
$ gh actions-importer forecast -h
|
||||
Options:
|
||||
--source-file-path <source-file-path> (REQUIRED) The file path(s) to existing jobs data.
|
||||
-o, --output-dir <output-dir> (REQUIRED) The location for any output files.
|
||||
--start-date <start-date> The start date of the forecast analysis in YYYY-MM-DD format. [default: 9/12/2022 12:42:39 PM]
|
||||
--time-slice <time-slice> The time slice in seconds to use for computing concurrency metrics. [default: 60]
|
||||
--credentials-file <credentials-file> The file containing the credentials to use.
|
||||
--no-telemetry Boolean value to disallow telemetry.
|
||||
--no-ssl-verify Disable ssl certificate verification.
|
||||
--no-http-cache Disable caching of http responses.
|
||||
-?, -h, --help Show help and usage information
|
||||
```
|
||||
You can use the `--source-file-path` CLI option to combine data from multiple reports into a single report. This becomes useful if you use multiple CI/CD providers and want to get a holistic view of the runner usage. This works by using the `.json` files generated by `forecast` commands as space-delimited values for the `--source-file-path` CLI option. Optionally, this value could be a glob pattern to dynamically specify the list of files (e.g. `**/*.json`).
|
||||
Below is a example command that would generate a report for all files matching `tmp/**/jobs/*.json`:
|
||||
```bash
|
||||
gh actions-importer forecast --source-file-path tmp/**/jobs/*.json --output-dir tmp/forecast-combined
|
||||
```
|
||||
## Next steps
|
||||
[Perform a dry-run migration of a Bamboo pipeline](4-dry-run.md)
|
||||
@@ -0,0 +1,58 @@
|
||||
# Perform a dry-run migration of a Bamboo build plan.
|
||||
|
||||
In this lab you will use the `dry-run` command to convert a Bamboo build plan to its equivalent GitHub Actions workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the [steps to set up your GitHub Codespaces](./readme.md#configure-your-codespace) environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [audit lab](./2-audit.md).
|
||||
|
||||
## Perform a dry run
|
||||
|
||||
You will be performing a dry run against a single Bamboo pipeline. Answer the following questions before running this command:
|
||||
|
||||
1. What is the plan slug of the pipeline you want to convert?
|
||||
|
||||
- __MARS-ROCKET__
|
||||
|
||||
2. Where do you want to store the result?
|
||||
- __tmp/dry-run__
|
||||
- This can be any path within the working directory from which GitHub Actions Importer commands are executed.
|
||||
|
||||
3. Which file would you like to convert?
|
||||
|
||||
- __bamboo/bootstrap/source_files/bamboo/bamboo.yml__
|
||||
|
||||
4. Are you converting a build or deployment plan?
|
||||
- The supplied configuration is a build plan.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to your codespace terminal.
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bamboo build --source-file-path bamboo/bootstrap/source_files/bamboo/bamboo.yml -p MARS-ROCKET --output-dir tmp/dry-run
|
||||
```
|
||||
> Note: The `--source-file-path` option is not required and is used throughout this lab to convert a pipeline that is stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch pipelines using the Bamboo REST APIs
|
||||
|
||||
3. The command will list all the files written to disk when the command succeeds.
|
||||
|
||||
```console
|
||||
Logs: 'tmp/dry-run/log/valet.log'
|
||||
Output file(s):
|
||||
tmp/dry-run/build/mars/sample_plan/.github/workflows/sample_plan.yml
|
||||
```
|
||||
|
||||
4. View the converted workflow:
|
||||
- Find `tmp/dry-run/build/mars/sample_plan/.github/workflows` in the file explorer pane in your codespace.
|
||||
- Click `sample_plan.yml` to open.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
The files generated from the `dry-run` command represent the equivalent Actions workflow for the provided Bamboo pipeline.
|
||||
|
||||
## Next lab
|
||||
|
||||
[Use custom transformers to customize GitHub Actions Importer's behavior](5-custom-transformers.md)
|
||||
@@ -0,0 +1,186 @@
|
||||
# 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:
|
||||
|
||||
1. Convert items that are not automatically converted.
|
||||
2. Convert items that were automatically converted using different actions.
|
||||
3. Convert environment variable values differently.
|
||||
4. Convert references to runners to use a different runner name in GitHub Actions.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the [steps to set up your GitHub Codespaces](./readme.md#configure-your-codespace) environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
|
||||
## 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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bamboo build --output-dir tmp/custom-dry-run --plan-slug DEMO-MAR --source-file-path bamboo/bootstrap/source_files/custom/bamboo.yml
|
||||
```
|
||||
|
||||
The converted workflow generated by the above command can be seen below:
|
||||
|
||||
<details>
|
||||
<summary><em>Converted workflow 👇</em></summary>
|
||||
|
||||
```yaml
|
||||
name: demo/sample_plan
|
||||
on:
|
||||
# # The shortest interval you can run scheduled workflows is once every 5 minutes.
|
||||
# period: '180'
|
||||
jobs:
|
||||
Custom-Dry-Run-Build:
|
||||
runs-on:
|
||||
- self-hosted
|
||||
- bamboo-runner
|
||||
steps:
|
||||
- uses: actions/checkout@v3.5.0
|
||||
with:
|
||||
clean: false
|
||||
- run: |-
|
||||
mkdir -p falcon/red
|
||||
echo wings > falcon/red/wings
|
||||
sleep 1
|
||||
echo 'Built it'
|
||||
# # This item has no matching transformer
|
||||
# - any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknowncache:
|
||||
# any-task:
|
||||
# plugin-key: com.atlassian.bamboo.plugins.builder.unknowncache
|
||||
# configuration:
|
||||
# key: cache_key
|
||||
# path: falcon/red/wings
|
||||
- uses: actions/upload-artifact@v3.1.1
|
||||
with:
|
||||
name: FOO-BAR_Red rocket built
|
||||
path: falcon/red/wings
|
||||
if-no-files-found: error
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
_Note_: You can refer to the previous [lab](./4-dry-run.md) to learn about the fundamentals of the `dry-run` command.
|
||||
|
||||
## Custom transformers for an unknown step
|
||||
|
||||
The converted workflow contains a `any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknowncache` step that was not automatically converted. Let's write a custom transformer to handle this unknown task!
|
||||
|
||||
Let's answer the following questions before proceeding to write a custom transformer.
|
||||
|
||||
1) What is the "identifier" of the step to customize? This should be the identifier from the comment in the workflow without the version, or in other words the name untransformed step.
|
||||
- __any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknown__
|
||||
|
||||
2) What is the desired Actions syntax to use instead?
|
||||
- Upon conducting some research, you've discovered that the [Actions Cache](https://github.com/marketplace/actions/cache) action in the marketplace offer comparable functionality.
|
||||
|
||||
```yaml
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: <path>
|
||||
key: <key>
|
||||
```
|
||||
|
||||
Now you can begin to write the custom transformer. Custom transformers use a DSL built on top of Ruby and should be defined in a file with the `.rb` file extension. You can create this file by running the following command in your codespace terminal:
|
||||
|
||||
```bash
|
||||
touch transformers.rb && code transformers.rb
|
||||
```
|
||||
|
||||
Next, you will define a `transform` method for the `any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknowncache` identifier by adding the following code to `transformers.rb`:
|
||||
|
||||
```ruby
|
||||
transform "any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknowncache" do |item|
|
||||
[
|
||||
{
|
||||
"uses" => "actions/cache@v3",
|
||||
"with" => {
|
||||
"path" => item["configuration"]["path"],
|
||||
"key" => item["configuration"]["key"]
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
This method can use any valid Ruby syntax and should return a `Hash` or `Array` 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 Bamboo. The Bamboo task configuration can be accessed in the `item` parameter via `item["configuration"]["<item_configuration_key>"]`.
|
||||
|
||||
```yaml
|
||||
plugin-key: com.atlassian.bamboo.plugins.builder.unknowncache
|
||||
configuration:
|
||||
key: cache_key
|
||||
path: falcon/red/wings
|
||||
```
|
||||
|
||||
To access the values of the `key` and `path` information in the transformer, we are using `item["configuration"]["key"]` and `item["configuration"]["path"]`.
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bamboo build --output-dir tmp/custom-dry-run --plan-slug DEMO-MAR --source-file-path bamboo/bootstrap/source_files/custom/bamboo.yml --custom-transformers transformers.rb
|
||||
```
|
||||
|
||||
The converted workflow that is generated by the above command will now use the custom logic for the `unknowncache` step.
|
||||
|
||||
## Custom transformers for runners
|
||||
|
||||
Next, we will use a custom transformers to dictate which runners the converted workflows should use. To do this, answer the following questions:
|
||||
|
||||
1. What is the label of the runner in Bamboo to change?
|
||||
- __bamboo-runner__
|
||||
|
||||
2. What is the label of the runner in GitHub Actions to use instead?
|
||||
- __some-other-runner__
|
||||
|
||||
With these questions answered, you can add the following code to the `transformers.rb` file:
|
||||
|
||||
```ruby
|
||||
runner "bamboo-runner", "some-other-runner"
|
||||
```
|
||||
|
||||
In this example, the first parameter to the `runner` method is the runner label in Bamboo and the second is the new runner label to use in GitHub Actions.
|
||||
|
||||
Now you 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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bamboo build --output-dir tmp/custom-dry-run --plan-slug DEMO-MAR --source-file-path bamboo/bootstrap/source_files/custom/bamboo.yml --custom-transformers transformers.rb
|
||||
```
|
||||
> Note: we are using a different pipeline than before that defines a `runs-on` tag with the target label.
|
||||
|
||||
```diff
|
||||
runs-on:
|
||||
- - bamboo-runner
|
||||
+ - some-other-runner
|
||||
```
|
||||
|
||||
At this point the file contents of `transformers.rb` should match this:
|
||||
|
||||
<details>
|
||||
<summary><em>Custom transformers 👇</em></summary>
|
||||
|
||||
```ruby
|
||||
runner "bamboo-runner", "some-other-runner"
|
||||
|
||||
transform "any-task/plugin-key/com.atlassian.bamboo.plugins.builder.unknowncache" do |item|
|
||||
[
|
||||
{
|
||||
"uses" => "actions/cache@v3",
|
||||
"with" => {
|
||||
"path" => item["configuration"]["path"],
|
||||
"key" => item["configuration"]["key"]
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Congratulations! You have overridden GitHub Actions Importer's default behavior by customizing the conversion of:
|
||||
|
||||
- Unknown steps
|
||||
- Runners
|
||||
|
||||
## Next lab
|
||||
[Perform a production migration of a Bamboo pipeline](6-migrate.md)
|
||||
@@ -0,0 +1,58 @@
|
||||
# Perform a production migration of a Bamboo plan
|
||||
|
||||
In this lab, you will use the `migrate` command to convert a Bamboo plan and open a pull request with the equivalent Actions workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the [steps to set up your GitHub Codespaces](./readme.md#configure-your-codespace) environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
|
||||
## Performing a migration
|
||||
|
||||
Answer the following questions before running a `migrate` command:
|
||||
|
||||
1. What is the plan slug of the pipeline you want to migrate?
|
||||
- __MARS-ROCKET__
|
||||
|
||||
2. Where do you want to store the logs?
|
||||
- __tmp/migrate__
|
||||
|
||||
3. Which file would you like to convert?
|
||||
- __bamboo/bootstrap/source_files/bamboo/bamboo.yml__
|
||||
|
||||
4. Are you converting a build or deployment plan?
|
||||
- The supplied configuration is a build plan.
|
||||
|
||||
5. What is the URL for the GitHub repository to add the workflow to?
|
||||
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Run the following `migrate` command in your codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer migrate bamboo build -p MARS-ROCKET --target-url <target_url> --output-dir tmp/migrate --source-file-path bamboo/bootstrap/source_files/bamboo/bamboo.yml
|
||||
```
|
||||
|
||||
Note: The `--source-file-path` option is not required and is used throughout this lab to convert files that are stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch pipeline definitions using the Bamboo REST APIs.
|
||||
|
||||
2. The command will write the URL to the pull request that is created when the command succeeds.
|
||||
|
||||
|
||||
3. Open the generated pull request in a new browser tab.
|
||||
|
||||
### Inspect the pull request
|
||||
|
||||
The pull request contains a list of manual steps to complete.
|
||||
|
||||
Inspect the "Files changed" in this pull request and see the converted workflow. Any additional changes or code reviews that were needed should be done in this pull request.
|
||||
|
||||
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.
|
||||
|
||||
At this point, the migration has completed and you have successfully migrated a Bamboo build plan to Actions!
|
||||
|
||||
### Next lab
|
||||
|
||||
This concludes all labs for migrating a Bamboo plan Actions with GitHub Actions Importer!
|
||||
@@ -0,0 +1,6 @@
|
||||
source_files:
|
||||
- repository_slug: SAM/SAMPLE
|
||||
path: bamboo/bootstrap/source_files/bamboo/bamboo.yml
|
||||
- repository_slug: DEMO/MAR
|
||||
path: bamboo/bootstrap/source_files/bonnie/source.yml
|
||||
|
||||
@@ -0,0 +1,442 @@
|
||||
[
|
||||
{
|
||||
"id": 11043093,
|
||||
"build_number": 11043093,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-15T00:00:00+00:00",
|
||||
"start_time": "2023-09-15T00:00:00+00:00",
|
||||
"finish_time": "2023-09-15T00:02:00+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043078,
|
||||
"build_number": 11043078,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-14T00:00:00+00:00",
|
||||
"start_time": "2023-09-14T00:00:15+00:00",
|
||||
"finish_time": "2023-09-14T00:02:15+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043067,
|
||||
"build_number": 11043067,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-13T00:00:00+00:00",
|
||||
"start_time": "2023-09-13T00:00:00+00:00",
|
||||
"finish_time": "2023-09-13T00:02:00+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043053,
|
||||
"build_number": 11043053,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-12T00:00:00+00:00",
|
||||
"start_time": "2023-09-12T00:00:15+00:00",
|
||||
"finish_time": "2023-09-12T00:02:15+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043037,
|
||||
"build_number": 11043037,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-11T00:00:00+00:00",
|
||||
"start_time": "2023-09-11T00:00:00+00:00",
|
||||
"finish_time": "2023-09-11T00:02:00+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043026,
|
||||
"build_number": 11043026,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-10T00:00:00+00:00",
|
||||
"start_time": "2023-09-10T00:00:00+00:00",
|
||||
"finish_time": "2023-09-10T00:02:00+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043011,
|
||||
"build_number": 11043011,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-09T00:00:00+00:00",
|
||||
"start_time": "2023-09-09T00:00:00+00:00",
|
||||
"finish_time": "2023-09-09T00:02:00+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11042998,
|
||||
"build_number": 11042998,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-08T00:00:00+00:00",
|
||||
"start_time": "2023-09-08T00:00:15+00:00",
|
||||
"finish_time": "2023-09-08T00:02:15+00:00",
|
||||
"definition_id": "FORT-BUIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043102,
|
||||
"build_number": 11043102,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-15T01:00:00+00:00",
|
||||
"start_time": "2023-09-15T01:00:00+00:00",
|
||||
"finish_time": "2023-09-15T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043087,
|
||||
"build_number": 11043087,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-14T01:00:00+00:00",
|
||||
"start_time": "2023-09-14T01:00:00+00:00",
|
||||
"finish_time": "2023-09-14T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043074,
|
||||
"build_number": 11043074,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-13T01:00:00+00:00",
|
||||
"start_time": "2023-09-13T01:00:00+00:00",
|
||||
"finish_time": "2023-09-13T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043061,
|
||||
"build_number": 11043061,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-12T01:00:00+00:00",
|
||||
"start_time": "2023-09-12T01:00:00+00:00",
|
||||
"finish_time": "2023-09-12T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043046,
|
||||
"build_number": 11043046,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-11T01:00:00+00:00",
|
||||
"start_time": "2023-09-11T01:00:00+00:00",
|
||||
"finish_time": "2023-09-11T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043033,
|
||||
"build_number": 11043033,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-10T01:00:00+00:00",
|
||||
"start_time": "2023-09-10T01:00:00+00:00",
|
||||
"finish_time": "2023-09-10T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043020,
|
||||
"build_number": 11043020,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-09T01:00:00+00:00",
|
||||
"start_time": "2023-09-09T01:00:00+00:00",
|
||||
"finish_time": "2023-09-09T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043007,
|
||||
"build_number": 11043007,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-08T01:00:00+00:00",
|
||||
"start_time": "2023-09-08T01:00:00+00:00",
|
||||
"finish_time": "2023-09-08T01:03:20+00:00",
|
||||
"definition_id": "FORT-RS",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043095,
|
||||
"build_number": 11043095,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-15T00:00:00+00:00",
|
||||
"start_time": "2023-09-15T00:02:00+00:00",
|
||||
"finish_time": "2023-09-15T00:02:00+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043080,
|
||||
"build_number": 11043080,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-14T00:00:00+00:00",
|
||||
"start_time": "2023-09-14T00:02:15+00:00",
|
||||
"finish_time": "2023-09-14T00:02:15+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043065,
|
||||
"build_number": 11043065,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-13T00:00:00+00:00",
|
||||
"start_time": "2023-09-13T00:02:15+00:00",
|
||||
"finish_time": "2023-09-13T00:02:15+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043052,
|
||||
"build_number": 11043052,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-12T00:00:00+00:00",
|
||||
"start_time": "2023-09-12T00:00:00+00:00",
|
||||
"finish_time": "2023-09-12T00:00:00+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043044,
|
||||
"build_number": 11043044,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-11T00:00:00+00:00",
|
||||
"start_time": "2023-09-11T00:02:00+00:00",
|
||||
"finish_time": "2023-09-11T00:02:00+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043024,
|
||||
"build_number": 11043024,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-10T00:00:00+00:00",
|
||||
"start_time": "2023-09-10T00:02:15+00:00",
|
||||
"finish_time": "2023-09-10T00:02:15+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043013,
|
||||
"build_number": 11043013,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-09T00:00:00+00:00",
|
||||
"start_time": "2023-09-09T00:02:15+00:00",
|
||||
"finish_time": "2023-09-09T00:02:15+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043000,
|
||||
"build_number": 11043000,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-08T00:00:00+00:00",
|
||||
"start_time": "2023-09-08T00:02:15+00:00",
|
||||
"finish_time": "2023-09-08T00:02:15+00:00",
|
||||
"definition_id": "PAN-CON",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043104,
|
||||
"build_number": 11043104,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-15T21:54:00+00:00",
|
||||
"start_time": "2023-09-15T21:54:00+00:00",
|
||||
"finish_time": "2023-09-15T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043097,
|
||||
"build_number": 11043097,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-15T00:00:00+00:00",
|
||||
"start_time": "2023-09-15T00:02:00+00:00",
|
||||
"finish_time": "2023-09-15T00:02:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043091,
|
||||
"build_number": 11043091,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-14T21:54:00+00:00",
|
||||
"start_time": "2023-09-14T21:54:00+00:00",
|
||||
"finish_time": "2023-09-14T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043082,
|
||||
"build_number": 11043082,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-14T00:00:00+00:00",
|
||||
"start_time": "2023-09-14T00:00:00+00:00",
|
||||
"finish_time": "2023-09-14T00:00:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043076,
|
||||
"build_number": 11043076,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-13T21:54:00+00:00",
|
||||
"start_time": "2023-09-13T21:54:00+00:00",
|
||||
"finish_time": "2023-09-13T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043069,
|
||||
"build_number": 11043069,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-13T00:00:00+00:00",
|
||||
"start_time": "2023-09-13T00:02:00+00:00",
|
||||
"finish_time": "2023-09-13T00:02:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043063,
|
||||
"build_number": 11043063,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-12T21:54:00+00:00",
|
||||
"start_time": "2023-09-12T21:54:00+00:00",
|
||||
"finish_time": "2023-09-12T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043056,
|
||||
"build_number": 11043056,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-12T00:00:00+00:00",
|
||||
"start_time": "2023-09-12T00:00:00+00:00",
|
||||
"finish_time": "2023-09-12T00:00:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043050,
|
||||
"build_number": 11043050,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-11T21:54:00+00:00",
|
||||
"start_time": "2023-09-11T21:54:00+00:00",
|
||||
"finish_time": "2023-09-11T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043042,
|
||||
"build_number": 11043042,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-11T00:00:00+00:00",
|
||||
"start_time": "2023-09-11T00:02:00+00:00",
|
||||
"finish_time": "2023-09-11T00:02:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043035,
|
||||
"build_number": 11043035,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-10T21:54:00+00:00",
|
||||
"start_time": "2023-09-10T21:54:00+00:00",
|
||||
"finish_time": "2023-09-10T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043028,
|
||||
"build_number": 11043028,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-10T00:00:00+00:00",
|
||||
"start_time": "2023-09-10T00:02:00+00:00",
|
||||
"finish_time": "2023-09-10T00:02:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043022,
|
||||
"build_number": 11043022,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-09T21:54:00+00:00",
|
||||
"start_time": "2023-09-09T21:54:00+00:00",
|
||||
"finish_time": "2023-09-09T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043015,
|
||||
"build_number": 11043015,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-09T00:00:00+00:00",
|
||||
"start_time": "2023-09-09T00:02:00+00:00",
|
||||
"finish_time": "2023-09-09T00:02:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043009,
|
||||
"build_number": 11043009,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-08T21:54:00+00:00",
|
||||
"start_time": "2023-09-08T21:54:00+00:00",
|
||||
"finish_time": "2023-09-08T21:54:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
},
|
||||
{
|
||||
"id": 11043002,
|
||||
"build_number": 11043002,
|
||||
"result": "Successful",
|
||||
"queue_time": "2023-09-08T00:00:00+00:00",
|
||||
"start_time": "2023-09-08T00:00:00+00:00",
|
||||
"finish_time": "2023-09-08T00:00:15+00:00",
|
||||
"definition_id": "PAN-DAIL",
|
||||
"runner_name": "",
|
||||
"runner_group": ""
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,61 @@
|
||||
---
|
||||
version: 2
|
||||
|
||||
plan:
|
||||
project-key: SAM
|
||||
key: SAMPLE
|
||||
name: Sample Plan
|
||||
stages:
|
||||
- Build the rocket stage:
|
||||
manual: false
|
||||
final: false
|
||||
jobs:
|
||||
- Build
|
||||
Build:
|
||||
key: JOB1
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
- script:
|
||||
interpreter: SHELL
|
||||
scripts:
|
||||
- |-
|
||||
mkdir -p falcon/red
|
||||
echo wings > falcon/red/wings
|
||||
sleep 1
|
||||
echo 'Built it'
|
||||
artifacts:
|
||||
- name: Red rocket built
|
||||
pattern: falcon/red/wings
|
||||
shared: true
|
||||
required: true
|
||||
artifact-subscriptions: []
|
||||
variables:
|
||||
global_variable: global_variable_value
|
||||
plan_variable_override: plan_variable_overrid
|
||||
repositories:
|
||||
- yaml-test-repo:
|
||||
scope: global
|
||||
triggers:
|
||||
- polling:
|
||||
period: '180'
|
||||
branches:
|
||||
create: for-new-branch
|
||||
delete:
|
||||
after-deleted-days: 1
|
||||
after-inactive-days: 30
|
||||
link-to-jira: true
|
||||
notifications:
|
||||
- events:
|
||||
- plan-failed
|
||||
recipients:
|
||||
- responsible
|
||||
- watchers
|
||||
labels: []
|
||||
dependencies:
|
||||
require-all-stages-passing: false
|
||||
enabled-for-branches: true
|
||||
block-strategy: none
|
||||
plans: []
|
||||
other:
|
||||
concurrent-build-plugin: system-default
|
||||
@@ -0,0 +1,164 @@
|
||||
---
|
||||
version: 2
|
||||
plan:
|
||||
project-key: DEMO
|
||||
key: MAR
|
||||
name: Bonnie
|
||||
stages:
|
||||
- Git Fun:
|
||||
description: All the git things
|
||||
manual: false
|
||||
final: false
|
||||
jobs:
|
||||
- All The Git
|
||||
- Run tests:
|
||||
manual: false
|
||||
final: false
|
||||
jobs:
|
||||
- Integration tests
|
||||
- Unit tests
|
||||
- Deploy:
|
||||
manual: true
|
||||
final: false
|
||||
jobs:
|
||||
- Deploy
|
||||
- Cleanup:
|
||||
manual: false
|
||||
final: true
|
||||
jobs:
|
||||
- Cleanup
|
||||
All The Git:
|
||||
key: GIT
|
||||
description: All things GIT!
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
description: Checkout Repo
|
||||
- script:
|
||||
interpreter: SHELL
|
||||
scripts:
|
||||
- |-
|
||||
echo $RANDOM > random.txt
|
||||
cat random.txt
|
||||
description: Write some nonsense to a file
|
||||
artifact-subscriptions: []
|
||||
source_plan: DEMO-MAR
|
||||
enabled: true
|
||||
Integration tests:
|
||||
key: IT
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: true
|
||||
- script:
|
||||
interpreter: SHELL
|
||||
scripts:
|
||||
- touch report.xml
|
||||
- any-task:
|
||||
plugin-key: com.atlassian.bamboo.plugins.bamboo-nodejs-plugin:task.builder.npm
|
||||
configuration:
|
||||
isolatedCache: 'false'
|
||||
runtime: alt
|
||||
command: install
|
||||
final-tasks:
|
||||
- any-task:
|
||||
plugin-key: com.atlassian.bamboo.plugins.bamboo-nodejs-plugin:task.reporter.mocha
|
||||
configuration:
|
||||
testPattern: mocha-1.json, mocha-2.json
|
||||
workingSubDirectory: "/this_is_a_subdir"
|
||||
pickupOutdatedFiles: 'true'
|
||||
artifact-subscriptions: []
|
||||
source_plan: DEMO-MAR
|
||||
enabled: true
|
||||
Unit tests:
|
||||
key: UT
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
- script:
|
||||
interpreter: SHELL
|
||||
scripts:
|
||||
- touch report.xml
|
||||
- test-parser:
|
||||
type: junit
|
||||
ignore-time: true
|
||||
test-results: "**/test-reports/*.xml"
|
||||
conditions:
|
||||
- variable:
|
||||
exists: test
|
||||
description: this is not a final task
|
||||
artifact-subscriptions: []
|
||||
source_plan: DEMO-MAR
|
||||
enabled: true
|
||||
Deploy:
|
||||
key: JOB1
|
||||
docker:
|
||||
image: oracle
|
||||
volumes:
|
||||
"/home/user": "/home/user"
|
||||
"/opt": "/opt"
|
||||
docker-run-arguments: []
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
- any-task:
|
||||
plugin-key: com.atlassian.bamboo.plugins.atlassian-bamboo-plugin-aws-codedeploy:task.aws.codeDeploy
|
||||
configuration:
|
||||
deploymentTimeout: '15'
|
||||
deploymentGroup: DgpECS-user_cluster-alt_service
|
||||
credentialsId: '10092545'
|
||||
region: US_WEST_1
|
||||
applicationName: AppECS-user_cluster-alt_service
|
||||
s3Bucket: elasticbeanstalk-us-west-1-12345
|
||||
workingSubDirectory: this_is_a_subdir
|
||||
conditions:
|
||||
- variable:
|
||||
exists: test
|
||||
artifact-subscriptions: []
|
||||
source_plan: DEMO-MAR
|
||||
enabled: true
|
||||
Cleanup:
|
||||
key: CLEAN
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
artifact-subscriptions: []
|
||||
source_plan: DEMO-MAR
|
||||
enabled: true
|
||||
variables:
|
||||
password: BAMSCRT@0@0@V2tJ1qmyHu7Rpm0N/jQ6k2552ul9JTDCUVI0r6sMo9k=
|
||||
username: admin
|
||||
repositories:
|
||||
- User Actions Playground:
|
||||
type: git
|
||||
url: git@github.com:User/actions-playground.git
|
||||
branch: main
|
||||
shared-credentials: User Bamboo SSH Key
|
||||
command-timeout-minutes: '180'
|
||||
lfs: false
|
||||
verbose-logs: false
|
||||
use-shallow-clones: false
|
||||
cache-on-agents: true
|
||||
submodules: false
|
||||
ssh-key-applies-to-submodules: true
|
||||
fetch-all: false
|
||||
triggers:
|
||||
- cron:
|
||||
expression: 0 10,44 14 ? 3 WED
|
||||
branches:
|
||||
create: manually
|
||||
delete: never
|
||||
link-to-jira: false
|
||||
notifications:
|
||||
- events:
|
||||
- plan-failed
|
||||
recipients:
|
||||
- responsible
|
||||
- watchers
|
||||
labels: []
|
||||
dependencies:
|
||||
require-all-stages-passing: false
|
||||
enabled-for-branches: true
|
||||
block-strategy: none
|
||||
plans: []
|
||||
other:
|
||||
concurrent-build-plugin: system-default
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
version: 2
|
||||
|
||||
plan:
|
||||
project-key: FOO
|
||||
key: BAR
|
||||
name: Sample Plan
|
||||
stages:
|
||||
- Custom Dry Run:
|
||||
manual: false
|
||||
final: false
|
||||
jobs:
|
||||
- Build
|
||||
Build:
|
||||
key: JOB1
|
||||
requirements:
|
||||
- bamboo-runner
|
||||
tasks:
|
||||
- checkout:
|
||||
force-clean-build: false
|
||||
- script:
|
||||
interpreter: SHELL
|
||||
scripts:
|
||||
- |-
|
||||
mkdir -p falcon/red
|
||||
echo wings > falcon/red/wings
|
||||
sleep 1
|
||||
echo 'Built it'
|
||||
- any-task:
|
||||
plugin-key: com.atlassian.bamboo.plugins.builder.unknowncache
|
||||
configuration:
|
||||
key: cache_key
|
||||
path: falcon/red/wings
|
||||
artifacts:
|
||||
- name: Red rocket built
|
||||
pattern: falcon/red/wings
|
||||
shared: true
|
||||
required: true
|
||||
artifact-subscriptions: []
|
||||
variables:
|
||||
global_variable: global_variable_value
|
||||
plan_variable_override: plan_variable_override
|
||||
repositories:
|
||||
- yaml-test-repo:
|
||||
scope: global
|
||||
triggers:
|
||||
- polling:
|
||||
period: '180'
|
||||
branches:
|
||||
create: for-new-branch
|
||||
delete:
|
||||
after-deleted-days: 1
|
||||
after-inactive-days: 30
|
||||
link-to-jira: true
|
||||
notifications:
|
||||
- events:
|
||||
- plan-failed
|
||||
recipients:
|
||||
- responsible
|
||||
- watchers
|
||||
labels: []
|
||||
dependencies:
|
||||
require-all-stages-passing: false
|
||||
enabled-for-branches: true
|
||||
block-strategy: none
|
||||
plans: []
|
||||
other:
|
||||
concurrent-build-plugin: system-default
|
||||
@@ -0,0 +1,73 @@
|
||||
# Bamboo Server migrations powered by GitHub Actions Importer
|
||||
|
||||
The instructions below will guide you through configuring a GitHub Codespace environment to learn how to use GitHub Actions Importer to migrate Bamboo pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
## Create your own repository for these labs
|
||||
|
||||
- Ensure that you have created a repository using the [actions/importer-labs](https://github.com/actions/importer-labs) as a template.
|
||||
|
||||
## Configure your codespace
|
||||
|
||||
1. Start a new codespace.
|
||||
|
||||
- Click the `Code` button on your repository's landing page.
|
||||
- Click the `Codespaces` tab.
|
||||
- Click `Create codespaces on main` to create the codespace.
|
||||
- After the codespace has initialized there will be a terminal present.
|
||||
|
||||
2. Verify the GitHub Actions Importer CLI is installed and working. More information on the GitHub Actions Importer extension for the official GitHub CLI can be found [here](https://github.com/github/gh-actions-importer).
|
||||
|
||||
- Run the following command in the codespace's terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
```
|
||||
|
||||
- Verify the output is similar to below.
|
||||
|
||||
```console
|
||||
$ gh actions-importer version
|
||||
gh actions-importer github/gh-actions-importer v1.3.4
|
||||
actions-importer/cli:latest v1.3.20618
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Labs for Bamboo
|
||||
|
||||
Perform the following labs to learn more about Actions migrations with GitHub Actions Importer:
|
||||
|
||||
1. [Configure credentials for GitHub Actions Importer](1-configure.md)
|
||||
2. [Perform an audit on Bamboo](2-audit.md)
|
||||
3. [Forecast potential build runner usage](3-forecast.md)
|
||||
4. [Perform a dry-run migration of a Bamboo pipeline](4-dry-run.md)
|
||||
5. [Use custom transformers to customize GitHub Actions Importer's behavior](5-custom-transformers.md)
|
||||
6. [Perform a production migration of a Bamboo pipeline](6-migrate.md)
|
||||
|
||||
|
||||
|
||||
## Troubleshoot the GitHub Actions Importer CLI
|
||||
|
||||
The CLI extension for GitHub Actions Importer can be manually installed by following these steps:
|
||||
|
||||
- Verify you are in the codespace terminal
|
||||
- Run this command from within the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh extension install github/gh-actions-importer
|
||||
```
|
||||
|
||||
- Verify the result of the install contains:
|
||||
|
||||
```console
|
||||
$ gh extension install github/gh-actions-importer
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- Verify the GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
```
|
||||
@@ -0,0 +1,61 @@
|
||||
# Configure credentials for GitHub Actions Importer
|
||||
|
||||
In this lab, you will use the `configure` CLI command to set the required credentials and information for GitHub Actions Importer to use when working with Bitbucket and GitHub.
|
||||
|
||||
You will need to complete all of the setup instructions [here](./readme.md#configure-your-codespace) prior to performing this lab.
|
||||
|
||||
## Configuring credentials
|
||||
|
||||
1. Create a GitHub personal access token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save in a safe location.
|
||||
2. Follow Bitbucket's [documentation](https://support.atlassian.com/bitbucket-cloud/docs/create-a-workspace-access-token/) to generate a workspace access token with read scopes for pipeline, project, and repository, and ensure that you store the token securely. This step is optional since we are using source files in this lab.
|
||||
|
||||
3. Run the `configure` CLI command:
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Using the down arrow key to highlight `Bitbucket`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 1 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Bitbucket token prompt, enter the Bitbucket access token from step 2 or any random string if no token was generated, and press enter.
|
||||
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Bitbucket
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Bitbucket: ***************
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify your environment is configured correctly, you are going to run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal run the following command:
|
||||
|
||||
```bash
|
||||
gh actions-importer update
|
||||
```
|
||||
|
||||
2. You should see a confirmation that you were logged into the GitHub Container Registry and the image was updated to the latest version.
|
||||
|
||||
```console
|
||||
$ gh actions-importer update
|
||||
Login Succeeded
|
||||
latest: Pulling from actions-importer/cli
|
||||
Digest: sha256:a7d00dee8a37e25da59daeed44b1543f476b00fa2c41c47f48deeaf34a215bbb
|
||||
Status: Image is up to date for ghcr.io/actions-importer/cli:latest
|
||||
ghcr.io/actions-importer/cli:latest
|
||||
```
|
||||
|
||||
### Next lab
|
||||
|
||||
[Perform an audit of Bitbucket](./2-audit.md)
|
||||
@@ -0,0 +1,217 @@
|
||||
# Perform an audit of Bitbucket
|
||||
|
||||
In this lab, you will use the `audit` command to get a high-level view of all pipelines in your Bitbucket workspace.
|
||||
|
||||
The `audit` command will perform the following steps:
|
||||
|
||||
1. Fetch all of the pipelines in the Bitbucket workspace.
|
||||
2. Convert each pipeline to its equivalent GitHub Actions workflow(s).
|
||||
3. Generate a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
|
||||
## Perform an audit
|
||||
|
||||
Answer the following questions before running this command:
|
||||
|
||||
1. What workspace do you want to audit?
|
||||
- __actions-importer__. In this example we will be instructing Actions Importer to audit the `actions-importer` workspace.
|
||||
|
||||
2. Where do you want to store the result?
|
||||
- __tmp/audit__. This can be any path within the working directory from which GitHub Actions Importer commands are executed.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to the codespace terminal.
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer audit bitbucket --output-dir tmp/audit --workspace actions-importer --config-file-path bitbucket/bootstrap/config.yml
|
||||
```
|
||||
> Note: The `--config-file-path` option is not required and is used throughout these labs to convert files that are stored locally for this lab. When performing a migration on your own workspace, it can be omitted and GitHub Actions Importer will programmatically fetch pipelines using the Bitbucket REST APIs.
|
||||
3. The command will list all the files written to disk in green when the command succeeds.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
1. Find the `audit_summary.md` file in the file explorer.
|
||||
2. Right-click the `audit_summary.md` file and select `Open Preview`.
|
||||
3. This file contains details that summarize what percentage of your pipelines were converted automatically.
|
||||
|
||||
### Review audit summary
|
||||
|
||||
#### Pipelines
|
||||
|
||||
The pipeline summary section contains high level statistics regarding the conversion rate done by GitHub Actions Importer:
|
||||
|
||||
```md
|
||||
## Pipelines
|
||||
|
||||
Total: **4**
|
||||
|
||||
- Successful: **4 (100%)**
|
||||
- Partially successful: **0 (0%)**
|
||||
- Unsupported: **0 (0%)**
|
||||
- Failed: **0 (0%)**
|
||||
|
||||
### Job types
|
||||
|
||||
Supported: **4 (100%)**
|
||||
|
||||
- YAML: **4**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Pipelines” section:
|
||||
|
||||
- __Successful__ pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- __Partially successful__ pipelines had all of the pipeline constructs converted, however, there were some individual items (e.g. build tasks or build triggers) that were not converted automatically to their GitHub Actions equivalent.
|
||||
- __Unsupported__ pipelines are definition types that are not supported by GitHub Actions Importer.
|
||||
- __Failed__ pipelines encountered a fatal error when being converted. This can occur for one of three reasons:
|
||||
- The pipeline was misconfigured and not valid in Bitbucket.
|
||||
- GitHub Actions Importer encountered an internal error when converting it.
|
||||
- There was an unsuccessful network response, often due to invalid credentials, that caused the pipeline to be inaccessible.
|
||||
|
||||
The "Job types" section will summarize which types of pipelines are being used and which are supported or unsupported by GitHub Actions Importer.
|
||||
|
||||
#### Build steps
|
||||
|
||||
The build steps summary section presents an overview of the individual build steps that are used across all pipelines and how many were automatically converted by GitHub Actions Importer.
|
||||
|
||||
```md
|
||||
### Build steps
|
||||
|
||||
Total: **22**
|
||||
|
||||
Known: **22 (100%)**
|
||||
|
||||
- script: **11**
|
||||
- atlassian/git-secrets-scan: **3**
|
||||
- cache-node: **3**
|
||||
- cache-docker: **2**
|
||||
- atlassian/aws-cloudfront-invalidate: **1**
|
||||
- atlassian/aws-s3-deploy: **1**
|
||||
- cache-pip: **1**
|
||||
|
||||
Actions: **40**
|
||||
|
||||
- run: **15**
|
||||
- actions/checkout@v3.6.0: **14**
|
||||
- actions/cache@v3.3.1: **6**
|
||||
- actions/upload-artifact@v3.1.1: **2**
|
||||
- actions/download-artifact@v3.0.1: **2**
|
||||
- aws-actions/configure-aws-credentials@v3.0.1: **1**
|
||||
|
||||
```
|
||||
|
||||
Here are some key terms in the "Build steps" section:
|
||||
|
||||
- A __known__ build step is a step that was automatically converted to an equivalent action.
|
||||
- An __unknown__ build step is a step that was not automatically converted to an equivalent action.
|
||||
- An __unsupported__ build step is a step that is either:
|
||||
- A step that is fundamentally not supported by GitHub Actions.
|
||||
- A step that is configured in a way that is incompatible with GitHub Actions.
|
||||
- An __action__ is a list of the actions that were used in the converted workflows. This is important for the following scenarios:
|
||||
- Gathering the list of actions to sync to your appliance if you use GitHub Enterprise Server.
|
||||
- Defining an organization-level allowlist of actions that can be used. This list of actions is a comprehensive list of which actions their security and/or compliance teams will need to review.
|
||||
|
||||
There is an equivalent breakdown of build triggers, environment variables, and other uncategorized items displayed in the audit summary file.
|
||||
|
||||
#### Manual Tasks
|
||||
|
||||
The manual tasks summary section presents an overview of the manual tasks that you will need to perform that GitHub Actions Importer is not able to complete automatically.
|
||||
|
||||
```md
|
||||
### Manual tasks
|
||||
|
||||
Total: **2**
|
||||
|
||||
Self hosted runners: **2**
|
||||
|
||||
- `my.custom.label`: **2**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Manual tasks” section:
|
||||
|
||||
- A __secret__ refers to a repository or organization level secret that is used by the converted pipelines. These secrets will need to be created manually in Actions in order for these pipelines to function properly.
|
||||
- A __self-hosted runner__ refers to a label of a runner that is referenced by a converted pipeline that is not a GitHub-hosted runner. You will need to manually define these runners in order for these pipelines to function properly.
|
||||
|
||||
#### Files
|
||||
|
||||
The final section of the audit report provides a manifest of all of the files that are written to disk during the audit. These files include:
|
||||
|
||||
```md
|
||||
### Successful
|
||||
|
||||
#### actions-importer/python
|
||||
|
||||
- [actions-importer/python/.github/workflows/default.yml](actions-importer/python/.github/workflows/default.yml)
|
||||
- [actions-importer/python/config.json](actions-importer/python/config.json)
|
||||
- [actions-importer/python/source.yml](actions-importer/python/source.yml)
|
||||
|
||||
#### actions-importer/ruby
|
||||
|
||||
- [actions-importer/ruby/.github/workflows/default.yml](actions-importer/ruby/.github/workflows/default.yml)
|
||||
- [actions-importer/ruby/config.json](actions-importer/ruby/config.json)
|
||||
- [actions-importer/ruby/source.yml](actions-importer/ruby/source.yml)
|
||||
|
||||
#### actions-importer/docker
|
||||
|
||||
- [actions-importer/docker/.github/workflows/default.yml](actions-importer/docker/.github/workflows/default.yml)
|
||||
- [actions-importer/docker/.github/workflows/branches-master.yml](actions-importer/docker/.github/workflows/branches-master.yml)
|
||||
- [actions-importer/docker/config.json](actions-importer/docker/config.json)
|
||||
- [actions-importer/docker/source.yml](actions-importer/docker/source.yml)
|
||||
|
||||
#### actions-importer/react-deploy
|
||||
|
||||
- [actions-importer/react-deploy/.github/workflows/default.yml](actions-importer/react-deploy/.github/workflows/default.yml)
|
||||
- [actions-importer/react-deploy/.github/workflows/branches-master.yml](actions-importer/react-deploy/.github/workflows/branches-master.yml)
|
||||
- [actions-importer/react-deploy/config.json](actions-importer/react-deploy/config.json)
|
||||
- [actions-importer/react-deploy/source.yml](actions-importer/react-deploy/source.yml)
|
||||
```
|
||||
|
||||
Each pipeline will have a variety of files written that include:
|
||||
|
||||
- The original pipeline as it was defined in Bitbucket.
|
||||
- Any network responses used to convert a pipeline.
|
||||
- The converted workflow.
|
||||
- Stack traces that can be used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
```csv
|
||||
Pipeline,Action,File path
|
||||
actions-importer/python,actions/checkout@v3.6.0,tmp/audit/actions-importer/python/.github/workflows/default.yml
|
||||
actions-importer/python,actions/cache@v3.3.1,tmp/audit/actions-importer/python/.github/workflows/default.yml
|
||||
actions-importer/ruby,actions/checkout@v3.6.0,tmp/audit/actions-importer/ruby/.github/workflows/default.yml
|
||||
actions-importer/docker,actions/checkout@v3.6.0,tmp/audit/actions-importer/docker/.github/workflows/default.yml
|
||||
actions-importer/docker,actions/cache@v3.3.1,tmp/audit/actions-importer/docker/.github/workflows/default.yml
|
||||
actions-importer/docker,actions/upload-artifact@v3.1.1,tmp/audit/actions-importer/docker/.github/workflows/default.yml
|
||||
actions-importer/docker,actions/download-artifact@v3.0.1,tmp/audit/actions-importer/docker/.github/workflows/default.yml
|
||||
actions-importer/react-deploy,actions/checkout@v3.6.0,tmp/audit/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
actions-importer/react-deploy,actions/cache@v3.3.1,tmp/audit/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
actions-importer/react-deploy,actions/upload-artifact@v3.1.1,tmp/audit/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
actions-importer/react-deploy,aws-actions/configure-aws-credentials@v3.0.1,tmp/audit/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
actions-importer/react-deploy,actions/download-artifact@v3.0.1,tmp/audit/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
|
||||
Pipeline,Secret,File path
|
||||
|
||||
|
||||
Pipeline,Runner,File path
|
||||
actions-importer/python,my.custom.label,tmp/audit/actions-importer/python/.github/workflows/default.yml
|
||||
```
|
||||
|
||||
The contents of this file can be useful in answering questions similar to the following:
|
||||
|
||||
- What workflows will depend on which actions?
|
||||
- What workflows use an action that must go through a security review?
|
||||
- What workflows use specific secrets?
|
||||
- What workflows use specific runners?
|
||||
|
||||
### Next lab
|
||||
|
||||
[Forecast potential build runner usage](3-forecast.md)
|
||||
@@ -0,0 +1,108 @@
|
||||
# Forecast potential build runner usage
|
||||
|
||||
In this lab you will use the `forecast` command to forecast potential GitHub Actions usage by computing metrics from completed pipeline runs in Bitbucket.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
|
||||
## Perform a forecast
|
||||
|
||||
Answer the following questions before running the `forecast` command:
|
||||
|
||||
1. What workspace do you want to run the forecast for?
|
||||
- **actions-importer**
|
||||
2. What is the date you want to start forecasting from?
|
||||
- **2023-08-03**. By default, the value is set to one week ago, but it's recommended that you choose a start date that provides a representative view of typical usage.
|
||||
3. Where do you want to store the results?
|
||||
- **tmp/forecast**
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to your codespace terminal
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer forecast bitbucket --workspace actions-importer --start-date 2023-08-03 --output-dir tmp/forecast --source-file-path bitbucket/**/source_files/*.json
|
||||
```
|
||||
> Note: The `--source-file-path` option is not required and is used throughout this lab to convert files that are stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch historical pipeline runs using the Bitbucket REST APIs.
|
||||
|
||||
3. The command will list all the files written to disk when the command succeeds.
|
||||
```console
|
||||
[2023-09-07 18:26:22] Logs: 'tmp/audit/log/valet-20230907-182622.log'
|
||||
[2023-09-07 18:26:22] Forecasting 'https://bitbucket.org/actions-importer'
|
||||
[2023-09-07 18:26:22] Output file(s):
|
||||
[2023-09-07 18:26:22] tmp/forecast/forecast_report.md
|
||||
```
|
||||
## Review the forecast report
|
||||
|
||||
The forecast report, logs, and completed job data will be located within the `tmp/forecast` folder.
|
||||
|
||||
1. Find the `forecast_report.md` file in the file explorer.
|
||||
2. Right-click the `forecast_report.md` file and select `Open Preview`.
|
||||
3. This file contains metrics used to forecast potential GitHub Actions usage.
|
||||
|
||||
### Total
|
||||
|
||||
The "Total" section of the forecast report contains high level statistics related to all the jobs completed after the `--start-date` CLI option:
|
||||
|
||||
```md
|
||||
- Job count: **8**
|
||||
- Pipeline count: **8**
|
||||
|
||||
- Execution time
|
||||
|
||||
- Total: **11 minutes**
|
||||
- Median: **1 minutes**
|
||||
- P90: **4 minutes**
|
||||
- Min: **1 minutes**
|
||||
- Max: **4 minutes**
|
||||
|
||||
- Concurrent jobs
|
||||
|
||||
- Median: **0**
|
||||
- P90: **0**
|
||||
- Min: **0**
|
||||
- Max: **1**
|
||||
```
|
||||
|
||||
Here are some key terms of items defined in the forecast report:
|
||||
|
||||
- The `job count` is the total number of completed jobs.
|
||||
- The `pipeline count` is the number of unique pipelines used.
|
||||
- `Execution time` describes the amount of time a runner spent on a job. This metric can be used to help plan for the cost of GitHub-hosted runners.
|
||||
- This metric is correlated to how much you should expect to spend in GitHub Actions. This will vary depending on the hardware used for these minutes. You can use the [Actions pricing calculator](https://github.com/pricing/calculator) to estimate a dollar amount.
|
||||
- `Concurrent jobs` metrics describe the amount of jobs running at any given time. This metric can be used to define the number of runners a customer should configure.
|
||||
|
||||
Additionally, these metrics are defined by hosted and self-hosted runners.
|
||||
|
||||
## Forecasting multiple providers
|
||||
|
||||
You can examine the available options for the `forecast` command by running `gh actions-importer forecast --help`. When you do this you will see the `--source-file-path` option:
|
||||
|
||||
```console
|
||||
$ gh actions-importer forecast -h
|
||||
Options:
|
||||
--source-file-path <source-file-path> (REQUIRED) The file path(s) to existing jobs data.
|
||||
-o, --output-dir <output-dir> (REQUIRED) The location for any output files.
|
||||
--start-date <start-date> The start date of the forecast analysis in YYYY-MM-DD format. [default: 9/12/2022 12:42:39 PM]
|
||||
--time-slice <time-slice> The time slice in seconds to use for computing concurrency metrics. [default: 60]
|
||||
--credentials-file <credentials-file> The file containing the credentials to use.
|
||||
--no-telemetry Boolean value to disallow telemetry.
|
||||
--no-ssl-verify Disable ssl certificate verification.
|
||||
--no-http-cache Disable caching of http responses.
|
||||
-?, -h, --help Show help and usage information
|
||||
```
|
||||
|
||||
You can use the `--source-file-path` CLI option to combine data from multiple reports into a single report. This becomes useful if you use multiple CI/CD providers and want to get a holistic view of the runner usage. This works by using the `.json` files generated by `forecast` commands as space-delimited values for the `--source-file-path` CLI option. Optionally, this value could be a glob pattern to dynamically specify the list of files (e.g. `**/*.json`).
|
||||
|
||||
Below is a example command that would generate a report for all files matching `tmp/**/jobs/*.json`:
|
||||
|
||||
```bash
|
||||
gh actions-importer forecast --source-file-path tmp/**/jobs/*.json --output-dir tmp/forecast-combined
|
||||
```
|
||||
|
||||
## Next steps
|
||||
|
||||
[Perform a dry-run migration of a Bitbucket pipeline](4-dry-run.md)
|
||||
@@ -0,0 +1,265 @@
|
||||
# Perform a dry-run migration of a Bitbucket pipeline
|
||||
|
||||
In this lab you will use the `dry-run` command to convert a Bitbucket pipeline to its equivalent GitHub Actions workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your Codespace environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [audit lab](./2-audit.md).
|
||||
|
||||
## Perform a dry run
|
||||
|
||||
Before executing the dry-run command we will need to answer the following questions.
|
||||
|
||||
1. What repository is that pipeline in?
|
||||
- __react-deploy__
|
||||
|
||||
2. What is the workspace for that repository?
|
||||
- __actions-importer__
|
||||
|
||||
3. Where do you want to store the result?
|
||||
- __tmp/dry-run__. This can be any path within the working directory from which GitHub Actions Importer commands are executed.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to your codespace terminal
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bitbucket --output-dir tmp/dry-run --workspace actions-importer --repository react-deploy --source-file-path ./bitbucket/bootstrap/source_files/react_deploy.yml
|
||||
```
|
||||
> Note: The `--source-file-path` option is not required and is used throughout this lab to convert a pipeline that is stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch pipelines using the Bitbucket REST APIs
|
||||
|
||||
3. The command will list all the files written to disk when the command succeeds.
|
||||
|
||||
```console
|
||||
❯ gh actions-importer dry-run bitbucket --output-dir tmp/dry-run --workspace actions-importer --repository react-deploy --source-file-path ./bitbucket/bootstrap/source_files/react_deploy.yml
|
||||
[2023-09-07 19:00:29] Logs: 'tmp/dry-run/log/valet-20230907-190029.log'
|
||||
[2023-09-07 19:00:29] Output file(s):
|
||||
[2023-09-07 19:00:29] tmp/dry-run/actions-importer/react-deploy/.github/workflows/default.yml
|
||||
[2023-09-07 19:00:29] tmp/dry-run/actions-importer/react-deploy/.github/workflows/branches-master.yml
|
||||
```
|
||||
|
||||
4. View the converted workflows:
|
||||
- Find `tmp/dry-run/actions-importer/react-deploy/.github/workflows` in the file explorer pane in your codespace.
|
||||
- Click `default.yml` to open the workflow that was generated for the __default__ start condition.
|
||||
- Click `branches-master.yml` to open workflow that was generated for the __master branch__ start condition.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
The files generated from the `dry-run` command represent the equivalent Actions workflows for the given Bitbucket pipeline. The Bitbucket pipeline and converted workflows can be seen below:
|
||||
|
||||
<details>
|
||||
<summary><em>Bitbucket pipelines 👇</em></summary>
|
||||
|
||||
```yaml
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Build and Test
|
||||
caches:
|
||||
- node
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- step:
|
||||
name: Lint the node package
|
||||
script:
|
||||
- npm install eslint
|
||||
- npx eslint src
|
||||
caches:
|
||||
- node
|
||||
branches:
|
||||
master:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Build and Test
|
||||
caches:
|
||||
- node
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- npm run build
|
||||
artifacts:
|
||||
- build/**
|
||||
- step:
|
||||
name: Security Scan
|
||||
script:
|
||||
- pipe: atlassian/git-secrets-scan:0.5.1
|
||||
- step:
|
||||
name: Deploy to Production
|
||||
deployment: Production
|
||||
trigger: manual
|
||||
clone:
|
||||
enabled: false
|
||||
script:
|
||||
- pipe: atlassian/aws-s3-deploy:1.1.0
|
||||
variables:
|
||||
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
|
||||
S3_BUCKET: 'my-bucket-name'
|
||||
LOCAL_PATH: 'build'
|
||||
- pipe: atlassian/aws-cloudfront-invalidate:0.6.0
|
||||
variables:
|
||||
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
|
||||
DISTRIBUTION_ID: '123xyz'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><em>Converted default workflow 👇</em></summary>
|
||||
|
||||
default.yml
|
||||
```yaml
|
||||
name: default
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "!master"
|
||||
jobs:
|
||||
parallel_job_1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Cache node
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
key: "${{ runner.os }}-node-${{ hashFiles('node_modules') }}"
|
||||
path: node_modules
|
||||
- name: Build and Test
|
||||
run: |-
|
||||
npm install
|
||||
npm test
|
||||
parallel_job_2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Cache node
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
key: "${{ runner.os }}-node-${{ hashFiles('node_modules') }}"
|
||||
path: node_modules
|
||||
- name: Lint the node package
|
||||
run: |-
|
||||
npm install eslint
|
||||
npx eslint src
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><em>Converted master branch workflow 👇</em></summary>
|
||||
|
||||
default.yml
|
||||
```yaml
|
||||
name: branches-master
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
jobs:
|
||||
parallel_job_1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Cache node
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
key: "${{ runner.os }}-node-${{ hashFiles('node_modules') }}"
|
||||
path: node_modules
|
||||
- name: Build and Test
|
||||
run: |-
|
||||
npm install
|
||||
npm test
|
||||
npm run build
|
||||
- uses: actions/upload-artifact@v3.1.1
|
||||
with:
|
||||
name: parallel_job_1
|
||||
path: build/**
|
||||
parallel_job_2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
path: git-secrets
|
||||
repository: awslabs/git-secrets
|
||||
- run: |
|
||||
cd git-secrets
|
||||
sudo make install
|
||||
git secrets --register-aws --global
|
||||
cd ..
|
||||
# This transformed result does custom secret scanning using AWS, however the recommended way
|
||||
# to do this is to use the GitHub secret scanning feature.
|
||||
# See https://docs.github.com/en/code-security/secret-scanning/protecting-pushes-with-secret-scanning for more information.
|
||||
- run: git secrets --scan --recursive .
|
||||
step_job_3:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: Production
|
||||
needs:
|
||||
- parallel_job_2
|
||||
- parallel_job_1
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- uses: aws-actions/configure-aws-credentials@v3.0.1
|
||||
with:
|
||||
aws-access-key-id: "$AWS_ACCESS_KEY_ID"
|
||||
aws-secret-access-key: "$AWS_SECRET_ACCESS_KEY"
|
||||
aws-region: "$AWS_DEFAULT_REGION"
|
||||
- uses: actions/download-artifact@v3.0.1
|
||||
with:
|
||||
name: parallel_job_1
|
||||
- run: aws s3 sync build s3://my-bucket-name
|
||||
- name: Invalidate Cloudfront Distribution
|
||||
run: aws cloudfront create-invalidation --distribution-id 123xyz
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Let's compare the Bitbucket pipeline with the generated workflows and identify some key differences:
|
||||
|
||||
- Two workflows were created for a single Bitbucket pipeline. This is because GitHub Actions defines triggers at the workflow level, and the Bitbucket pipeline had two triggers (or start conditions).
|
||||
|
||||
- The default start condition's parallel steps have been split into two jobs, `parallel_job_1` and `parallel_job_2`. This modification was made to align more closely with GitHub Actions, where steps cannot run in parallel but jobs can.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
parallel_job_1:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Cache node
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
key: "${{ runner.os }}-node-${{ hashFiles('node_modules') }}"
|
||||
path: node_modules
|
||||
- name: Build and Test
|
||||
run: |-
|
||||
npm install
|
||||
npm test
|
||||
parallel_job_2:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Cache node
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
key: "${{ runner.os }}-node-${{ hashFiles('node_modules') }}"
|
||||
path: node_modules
|
||||
- name: Lint the node package
|
||||
run: |-
|
||||
npm install eslint
|
||||
npx eslint src
|
||||
```
|
||||
|
||||
Despite these differences they will function equivalently.
|
||||
## Next lab
|
||||
|
||||
[Use custom transformers to customize GitHub Actions Importer's behavior](./5-custom-transformers.md)
|
||||
@@ -0,0 +1,215 @@
|
||||
# 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:
|
||||
|
||||
1. Convert items that are not automatically converted.
|
||||
2. Convert items that were automatically converted using different actions.
|
||||
3. Convert environment variable values differently.
|
||||
4. Convert references to runners to use a different runner name in GitHub Actions.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
|
||||
## 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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bitbucket --output-dir tmp/dry-run --workspace actions-importer --repository node-deploy --source-file-path ./bitbucket/bootstrap/source_files/node_deploy.yml
|
||||
```
|
||||
|
||||
The converted workflow that is generated by the above command can be seen below:
|
||||
|
||||
<details>
|
||||
<summary><em>Converted workflow 👇</em></summary>
|
||||
|
||||
```yaml
|
||||
name: default
|
||||
on:
|
||||
push:
|
||||
jobs:
|
||||
step_job_1:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:16
|
||||
steps:
|
||||
- uses: actions/checkout@v3.6.0
|
||||
- name: Build and Test
|
||||
run: |-
|
||||
npm install
|
||||
npm test
|
||||
apt update && apt install zip
|
||||
zip -r app-${{ github.run_number }}.zip . -x *.git* bitbucket-pipelines.yml
|
||||
- name: Code linting
|
||||
run: |-
|
||||
npm install eslint
|
||||
npx eslint .
|
||||
# # This item has no matching transformer
|
||||
# - identifier: atlassian/unknown-azure-deploy:1.1.0
|
||||
# name: Deploy to Production
|
||||
# variables:
|
||||
# AZURE_APP_ID: "$AZURE_APP_ID"
|
||||
# AZURE_PASSWORD: "$AZURE_PASSWORD"
|
||||
# AZURE_TENANT_ID: "$AZURE_TENANT_ID"
|
||||
# AZURE_RESOURCE_GROUP: "$AZURE_RESOURCE_GROUP"
|
||||
# AZURE_APP_NAME: my-site
|
||||
# ZIP_FILE: my-package.zip
|
||||
- uses: actions/upload-artifact@v3.1.1
|
||||
with:
|
||||
name: step_job_1
|
||||
path: "*.zip"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
_Note_: You can refer to the previous [lab](./4-dry-run.md) to learn about the fundamentals of the `dry-run` command.
|
||||
|
||||
## Custom transformers for an unknown step
|
||||
|
||||
The converted workflow above contains a `atlassian/unknown-azure-deploy` step that was not automatically converted. Let's write a custom transformer to handle this unknown pipe!
|
||||
|
||||
Let's answer the following questions before proceeding to write a custom transformer.
|
||||
|
||||
1) What is the "identifier" of the step to customize? This should be the identifier from the comment in the workflow without the version, or in other words the name of the pipe.
|
||||
- __atlassian/unknown-azure-deploy__
|
||||
|
||||
2) What is the desired Actions syntax to use instead?
|
||||
- Upon conducting some research, you've discovered that the [Azure Web App](https://github.com/marketplace/actions/azure-webapp) and [Azure Login](https://github.com/marketplace/actions/azure-login) actions available in the marketplace offer comparable functionality.
|
||||
|
||||
```yaml
|
||||
- uses: azure/login@v1.4.6
|
||||
with:
|
||||
creds: "${{ secrets.AZURE_CREDENTIALS }}"
|
||||
- uses: azure/webapps-deploy@v2.2.5
|
||||
with:
|
||||
app-name: my-site
|
||||
package: my-package.zip
|
||||
resource-group-name: "$AZURE_RESOURCE_GROUP"
|
||||
```
|
||||
|
||||
Now you can begin to write the custom transformer. Custom transformers use a DSL built on top of Ruby and should be defined in a file with the `.rb` file extension. You can create this file by running the following command in your codespace terminal:
|
||||
|
||||
```bash
|
||||
touch transformers.rb && code transformers.rb
|
||||
```
|
||||
|
||||
Next, you will define a `transform` method for the `atlassian/unknown-azure-deploy` identifier by adding the following code to `transformers.rb`:
|
||||
|
||||
```ruby
|
||||
transform "atlassian/unknown-azure-deploy" do |item|
|
||||
[
|
||||
{
|
||||
"uses" => "azure/login@v1.4.6",
|
||||
"with" => {
|
||||
"creds" => "${{ secrets.AZURE_CREDENTIALS }}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" => "Upload coverage to Codecov",
|
||||
"uses" => "azure/webapps-deploy@v2.2.5",
|
||||
"with" => {
|
||||
"app-name" => "my-site",
|
||||
"package" => item["variables"]["ZIP_FILE"],
|
||||
"resource-group-name" => item["variables"]["AZURE_RESOURCE_GROUP"]
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
This method can use any valid Ruby syntax and should return a `Hash` or `Array` 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 Bitbucket. The Bitbucket variables can be accessed in the `item` parameter via `item["variables"]["<BITBUCKET_VARIABLE_NAME>"]`.
|
||||
|
||||
```yaml
|
||||
identifier: atlassian/unknown-azure-deploy:1.1.0
|
||||
name: Deploy to Production
|
||||
variables:
|
||||
AZURE_APP_ID: "$AZURE_APP_ID"
|
||||
AZURE_PASSWORD: "$AZURE_PASSWORD"
|
||||
AZURE_TENANT_ID: "$AZURE_TENANT_ID"
|
||||
AZURE_RESOURCE_GROUP: "$AZURE_RESOURCE_GROUP"
|
||||
AZURE_APP_NAME: my-site
|
||||
ZIP_FILE: my-package.zip
|
||||
```
|
||||
|
||||
To access the values of the zip file and resource group information in the transformer, we are using `item["variables"]["ZIP_FILE"]` and `item["variables"]["AZURE_RESOURCE_GROUP"]`.
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bitbucket --output-dir tmp/dry-run --workspace actions-importer --repository node-deploy --source-file-path ./bitbucket/bootstrap/source_files/node_deploy.yml --custom-transformers transformers.rb
|
||||
```
|
||||
|
||||
The converted workflow that is generated by the above command will now use the custom logic for the `atlassian/unknown-azure-deploy` step.
|
||||
|
||||
## Custom transformers for runners
|
||||
Next, we will use a custom transformers to dictate which runners the converted workflows should use. To do this, answer the following questions:
|
||||
|
||||
1. What is the label of the runner in Bitbucket to change?
|
||||
- __my.custom.label__
|
||||
|
||||
2. What is the label of the runner in GitHub Actions to use instead?
|
||||
- __some-other-runner__
|
||||
|
||||
With these questions answered, you can add the following code to the `transformers.rb` file:
|
||||
|
||||
```ruby
|
||||
runner "my.custom.label", "some.other.label"
|
||||
```
|
||||
|
||||
In this example, the first parameter to the `runner` method is the runner label in Bitbucket and the second is the new runner label to use in GitHub Actions.
|
||||
|
||||
Now you 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:
|
||||
|
||||
```bash
|
||||
gh actions-importer dry-run bitbucket --output-dir tmp/dry-run --workspace actions-importer --repository python --source-file-path ./bitbucket/bootstrap/source_files/python.yml --custom-transformers transformers.rb
|
||||
```
|
||||
> Note: we are using a different pipeline than before that defines a `runs-on` tag with the target label.
|
||||
|
||||
```diff
|
||||
runs-on:
|
||||
- - my.custom.label
|
||||
+ - some.other.label
|
||||
```
|
||||
|
||||
At this point the file contents of `transformers.rb` should match this:
|
||||
|
||||
<details>
|
||||
<summary><em>Custom transformers 👇</em></summary>
|
||||
|
||||
```ruby
|
||||
runner "my.custom.label", "some-other-runner"
|
||||
|
||||
transform "atlassian/unknown-azure-deploy" do |item|
|
||||
variables = item["variables"]
|
||||
[
|
||||
{
|
||||
"uses" => "azure/login@v1.4.6",
|
||||
"with" => {
|
||||
"creds" => "${{ secrets.AZURE_CREDENTIALS }}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" => "Upload coverage to Codecov",
|
||||
"uses" => "azure/webapps-deploy@v2.2.5",
|
||||
"with" => {
|
||||
"app-name" => "my-site",
|
||||
"package" => variables["ZIP_FILE"],
|
||||
"resource-group-name" => variables["AZURE_RESOURCE_GROUP"]
|
||||
}
|
||||
}
|
||||
]
|
||||
end
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
That's it. Congratulations, you have overridden GitHub Actions Importer's default behavior by customizing the conversion of:
|
||||
|
||||
- Unknown steps
|
||||
- Runners
|
||||
## Next lab
|
||||
|
||||
[Perform a production migration of a Bitbucket pipeline](6-migrate.md)
|
||||
@@ -0,0 +1,54 @@
|
||||
# Perform a production migration of a Bitbucket pipeline
|
||||
|
||||
In this lab, you will use the `migrate` command to convert a Bitbucket pipeline and open a pull request with the equivalent Actions workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
|
||||
## Performing a migration
|
||||
|
||||
Answer the following questions before running a `migrate` command:
|
||||
|
||||
1. What repository do you want to migrate?
|
||||
- __basic-pipeline__
|
||||
2. What is the workspace for that repository?
|
||||
- __actions-importer__
|
||||
3. Where do you want to store the logs?
|
||||
- __tmp/migrate__
|
||||
4. What is the URL for the GitHub repository to add the workflow to?
|
||||
- __this repository__. The URL should should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Run the below `migrate` command in the codespace terminal, remember to update the `--target-url` before executing:
|
||||
|
||||
```bash
|
||||
gh actions-importer migrate bitbucket --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --workspace actions-importer --repository basic-pipeline --source-file-path ./bitbucket/bootstrap/source_files/basic_pipeline.yml
|
||||
```
|
||||
Note: The `--source-file-path` option is not required and is used throughout this lab to convert files that are stored locally. This can be omitted and GitHub Actions Importer will programmatically fetch pipeline definitions using the Bitbucket REST APIs.
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
|
||||
```console
|
||||
$ gh actions-importer migrate bitbucket --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --workspace actions-importer --repository basic-pipeline --source-file-path ./bitbucket/bootstrap/source_files/basic_pipeline.yml
|
||||
[2022-08-20 22:08:20] Logs: 'tmp/migrate/log/actions-importer-20220916-014033.log'
|
||||
[2022-08-20 22:08:20] Pull request: 'https://github.com/:owner/:repo/pull/1'
|
||||
```
|
||||
|
||||
3. Open the generated pull request in a new browser tab.
|
||||
|
||||
### Inspect the pull request
|
||||
|
||||
The first thing to notice about the pull request is that there is a list of manual steps to complete.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
At this point, the migration has completed and you have successfully migrated a Bitbucket pipeline to Actions!
|
||||
|
||||
### Next Lab
|
||||
|
||||
This concludes all labs for migrating Bitbucket pipelines to Actions with GitHub Actions Importer!
|
||||
@@ -0,0 +1,9 @@
|
||||
source_files:
|
||||
- repository_slug: python
|
||||
path: bitbucket/bootstrap/source_files/python.yml
|
||||
- repository_slug: ruby
|
||||
path: bitbucket/bootstrap/source_files/ruby.yml
|
||||
- repository_slug: docker
|
||||
path: bitbucket/bootstrap/source_files/docker.yml
|
||||
- repository_slug: react-deploy
|
||||
path: bitbucket/bootstrap/source_files/react_deploy.yml
|
||||
@@ -0,0 +1,26 @@
|
||||
image: atlassian/default-image:3
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: 'Build and Test'
|
||||
script:
|
||||
- echo "Your build and test goes here..."
|
||||
- step:
|
||||
name: 'Lint'
|
||||
script:
|
||||
- echo "Your linting goes here..."
|
||||
- step:
|
||||
name: 'Security scan'
|
||||
script:
|
||||
- echo "Your security scan goes here..."
|
||||
- step:
|
||||
name: 'Deployment to Staging'
|
||||
script:
|
||||
- echo "Your deployment to staging script goes here..."
|
||||
- step:
|
||||
name: 'Deployment to Production'
|
||||
trigger: 'manual'
|
||||
script:
|
||||
- echo "Your deployment to production script goes here..."
|
||||
@@ -0,0 +1,46 @@
|
||||
image: atlassian/default-image:3
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Build and Test
|
||||
script:
|
||||
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
||||
- docker build . --file Dockerfile --tag ${IMAGE_NAME}
|
||||
services:
|
||||
- docker
|
||||
caches:
|
||||
- docker
|
||||
- step:
|
||||
name: Lint the Dockerfile
|
||||
image: hadolint/hadolint:latest-debian
|
||||
script:
|
||||
- hadolint Dockerfile
|
||||
branches:
|
||||
master:
|
||||
- step:
|
||||
name: Build and Test
|
||||
script:
|
||||
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
||||
- docker build . --file Dockerfile --tag ${IMAGE_NAME}
|
||||
- docker save ${IMAGE_NAME} --output "${IMAGE_NAME}.tar"
|
||||
services:
|
||||
- docker
|
||||
caches:
|
||||
- docker
|
||||
artifacts:
|
||||
- "*.tar"
|
||||
- step:
|
||||
name: Deploy to Production
|
||||
deployment: Production
|
||||
script:
|
||||
- echo ${DOCKERHUB_PASSWORD} | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
|
||||
- IMAGE_NAME=$BITBUCKET_REPO_SLUG
|
||||
- docker load --input "${IMAGE_NAME}.tar"
|
||||
- VERSION="prod-0.1.${BITBUCKET_BUILD_NUMBER}"
|
||||
- IMAGE=${DOCKERHUB_NAMESPACE}/${IMAGE_NAME}
|
||||
- docker tag "${IMAGE_NAME}" "${IMAGE}:${VERSION}"
|
||||
- docker push "${IMAGE}:${VERSION}"
|
||||
services:
|
||||
- docker
|
||||
@@ -0,0 +1,90 @@
|
||||
[
|
||||
{
|
||||
"id": "{d47f79cd-9cb6-4ac8-8e85-ba448edab7df}",
|
||||
"build_number": "{d47f79cd-9cb6-4ac8-8e85-ba448edab7df}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-07T08:00:46+00:00",
|
||||
"finish_time": "2023-09-07T08:00:49+00:00",
|
||||
"definition_id": "{a990d84b-2229-4fb5-addf-9d85a20568bb}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
},
|
||||
{
|
||||
"id": "{91fa4c59-31e6-48e8-9db2-24133dd820c6}",
|
||||
"build_number": "{91fa4c59-31e6-48e8-9db2-24133dd820c6}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-06T08:00:37+00:00",
|
||||
"finish_time": "2023-09-06T08:00:43+00:00",
|
||||
"definition_id": "{fa347742-00ea-4a28-9866-c5257b15d719}",
|
||||
"runner_name": null,
|
||||
"runner_group": "self-hosted"
|
||||
},
|
||||
{
|
||||
"id": "{dd548f45-405b-4efe-9413-15a2cd585f53}",
|
||||
"build_number": "{dd548f45-405b-4efe-9413-15a2cd585f53}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-05T08:00:56+00:00",
|
||||
"finish_time": "2023-09-05T08:03:59+00:00",
|
||||
"definition_id": "{6112d63f-6e28-4464-b9aa-7f24eb34e00f}",
|
||||
"runner_name": null,
|
||||
"runner_group": "self-hosted"
|
||||
},
|
||||
{
|
||||
"id": "{4eb4521a-9159-4ff6-b328-c62cac52131f}",
|
||||
"build_number": "{4eb4521a-9159-4ff6-b328-c62cac52131f}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-04T08:00:19+00:00",
|
||||
"finish_time": "2023-09-04T08:00:23+00:00",
|
||||
"definition_id": "{c7e80d72-f205-4603-8569-f074191187e4}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
},
|
||||
{
|
||||
"id": "{12c99c31-d12d-49e5-9d38-83c5e226b0a5}",
|
||||
"build_number": "{12c99c31-d12d-49e5-9d38-83c5e226b0a5}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-03T08:00:10+00:00",
|
||||
"finish_time": "2023-09-03T08:00:13+00:00",
|
||||
"definition_id": "{fc61a473-8718-4ddd-a89b-3343db294726}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
},
|
||||
{
|
||||
"id": "{190e777d-3ff3-4f3c-9f77-cbf03e69415b}",
|
||||
"build_number": "{190e777d-3ff3-4f3c-9f77-cbf03e69415b}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-02T08:00:35+00:00",
|
||||
"finish_time": "2023-09-02T08:00:38+00:00",
|
||||
"definition_id": "{fc5bae20-556d-43db-9be4-80bbe1eb1995}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
},
|
||||
{
|
||||
"id": "{a597affa-c2a2-441b-b91b-e80751ba3ecc}",
|
||||
"build_number": "{a597affa-c2a2-441b-b91b-e80751ba3ecc}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-09-01T08:00:48+00:00",
|
||||
"finish_time": "2023-09-01T08:00:52+00:00",
|
||||
"definition_id": "{0117b0f0-dcd3-4680-812f-6162cb919d90}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
},
|
||||
{
|
||||
"id": "{ea0e658d-86d8-40cc-90e5-b69ceff1bf4e}",
|
||||
"build_number": "{ea0e658d-86d8-40cc-90e5-b69ceff1bf4e}",
|
||||
"result": "pipeline_step_state_completed_successful",
|
||||
"queue_time": null,
|
||||
"start_time": "2023-08-31T08:00:16+00:00",
|
||||
"finish_time": "2023-08-31T08:00:20+00:00",
|
||||
"definition_id": "{32a1db46-05b4-405f-aeac-6a34eb04f587}",
|
||||
"runner_name": null,
|
||||
"runner_group": "hosted"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
image: node:16
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
name: Build and Test
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- apt update && apt install zip
|
||||
- zip -r app-$BITBUCKET_BUILD_NUMBER.zip . -x *.git* bitbucket-pipelines.yml
|
||||
artifacts:
|
||||
- "*.zip"
|
||||
- step:
|
||||
name: Code linting
|
||||
script:
|
||||
- npm install eslint
|
||||
- npx eslint .
|
||||
- step:
|
||||
name: Deploy to Production
|
||||
script:
|
||||
- pipe: atlassian/unknown-azure-deploy:1.1.0
|
||||
variables:
|
||||
AZURE_APP_ID: $AZURE_APP_ID
|
||||
AZURE_PASSWORD: $AZURE_PASSWORD
|
||||
AZURE_TENANT_ID: $AZURE_TENANT_ID
|
||||
AZURE_RESOURCE_GROUP: $AZURE_RESOURCE_GROUP
|
||||
AZURE_APP_NAME: "my-site"
|
||||
ZIP_FILE: "my-package.zip"
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Test
|
||||
runs-on:
|
||||
- 'self.hosted'
|
||||
- 'my.custom.label'
|
||||
caches:
|
||||
- pip
|
||||
script:
|
||||
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- pip install pytest
|
||||
- pytest -v tests/* --junitxml=test-reports/report.xml
|
||||
- step:
|
||||
name: Lint code
|
||||
runs-on:
|
||||
- 'self.hosted'
|
||||
- 'my.custom.label'
|
||||
script:
|
||||
- pip install flake8
|
||||
- flake8 . --extend-exclude=dist,build --show-source --statistics
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Build and Test
|
||||
caches:
|
||||
- node
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- step:
|
||||
name: Lint the node package
|
||||
script:
|
||||
- npm install eslint
|
||||
- npx eslint src
|
||||
caches:
|
||||
- node
|
||||
branches:
|
||||
master:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Build and Test
|
||||
caches:
|
||||
- node
|
||||
script:
|
||||
- npm install
|
||||
- npm test
|
||||
- npm run build
|
||||
artifacts:
|
||||
- build/**
|
||||
- step:
|
||||
name: Security Scan
|
||||
script:
|
||||
- pipe: atlassian/git-secrets-scan:0.5.1
|
||||
- step:
|
||||
name: Deploy to Production
|
||||
deployment: Production
|
||||
trigger: manual
|
||||
clone:
|
||||
enabled: false
|
||||
script:
|
||||
- pipe: atlassian/aws-s3-deploy:1.1.0
|
||||
variables:
|
||||
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
|
||||
S3_BUCKET: 'my-bucket-name'
|
||||
LOCAL_PATH: 'build'
|
||||
- pipe: atlassian/aws-cloudfront-invalidate:0.6.0
|
||||
variables:
|
||||
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
||||
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
|
||||
DISTRIBUTION_ID: '123xyz'
|
||||
@@ -0,0 +1,14 @@
|
||||
image: ruby:2.7
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- parallel:
|
||||
- step:
|
||||
name: Test
|
||||
script:
|
||||
- bundle install
|
||||
- bundle exec rake
|
||||
- step:
|
||||
name: Lint code
|
||||
script:
|
||||
- ruby -wc **/*.rb
|
||||
@@ -0,0 +1,72 @@
|
||||
# Bitbucket Pipelines migrations powered by GitHub Actions Importer
|
||||
|
||||
These instructions will guide you through configuring the GitHub Codespaces environment that you will use in these labs to learn how to use GitHub Actions Importer to migrate from Bitbucket Pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
## Create your own repository for these labs
|
||||
|
||||
- Ensure that you have created a repository using [actions/importer-labs](https://github.com/actions/importer-labs) as a template.
|
||||
|
||||
## Configure your codespace
|
||||
|
||||
1. Start a new codespace
|
||||
|
||||
- Click the `Code` button on your repository's landing page.
|
||||
- Click the `Codespaces` tab.
|
||||
- Click `Create codespaces on main` to create the codespace.
|
||||
- After the codespace has initialized there will be a terminal present.
|
||||
|
||||
2. Verify the GitHub Actions Importer CLI is installed and working. More information on the GitHub Actions Importer extension for the official GitHub CLI can be found [here](https://github.com/github/gh-actions-importer).
|
||||
|
||||
- Run the following command in the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
```
|
||||
|
||||
- Verify the output is similar to below.
|
||||
|
||||
```console
|
||||
$ gh actions-importer version
|
||||
gh version 2.31.0 (2023-06-20)
|
||||
gh actions-importer github/gh-actions-importer v1.3.3
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Labs for Bitbucket
|
||||
|
||||
Perform the following labs to learn more about Actions migrations with GitHub Actions Importer:
|
||||
|
||||
1. [Configure credentials for GitHub Actions Importer](1-configure.md)
|
||||
2. [Perform an audit on Bitbucket](2-audit.md)
|
||||
3. [Forecast potential build runner usage](3-forecast.md)
|
||||
4. [Perform a dry-run migration of a Bitbucket pipeline](4-dry-run.md)
|
||||
5. [Use custom transformers to customize GitHub Actions Importer's behavior](5-custom-transformers.md)
|
||||
6. [Perform a production migration of a Bitbucket pipeline](6-migrate.md)
|
||||
|
||||
## Troubleshoot the GitHub Actions Importer CLI
|
||||
|
||||
The CLI extension for GitHub Actions Importer can be manually installed by following these steps:
|
||||
|
||||
- Verify you are in the codespace terminal
|
||||
- Run this command from within the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh extension install github/gh-actions-importer
|
||||
```
|
||||
|
||||
- Verify the result of the install contains:
|
||||
|
||||
```console
|
||||
$ gh extension install github/gh-actions-importer
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
```
|
||||
+18
-22
@@ -6,36 +6,32 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
|
||||
## Configuring credentials
|
||||
|
||||
1. Create a GitHub Personal Access Token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- Click your profile photo in the top right of the UI and click `Settings`.
|
||||
- Click on `Developer Settings` in the left hand panel.
|
||||
- Click `Personal Access Tokens` and then `Legacy tokens` (if present).
|
||||
- Click `Generate new token` and then `Legacy tokens`. You may be required to authenticate with GitHub during this step.
|
||||
- Select the following scopes: `read:packages` and `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save in a safe location.
|
||||
1. Create a GitHub personal access token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save in a safe location.
|
||||
|
||||
3. Create a CircleCI personal API token using CircleCI's [documentation](https://circleci.com/docs/managing-api-tokens#creating-a-personal-api-token) and store the token in a safe location.
|
||||
|
||||
2. Run the `configure` CLI command:
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Using the down arrow key to highlight `CircleCI`, press the spacebar to select, and then hit enter to continue.
|
||||
- At the GitHub handle prompt, enter the GitHub username used to generate the GitHub PAT in step 2 and press enter.
|
||||
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 1 and press enter.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 1 and press enter.
|
||||
- At the GitHub url prompt, enter the GitHub instance url or hit enter to accept the default value (`https://github.com`).
|
||||
- At the CircleCI token prompt, enter the CircleCI access token from step 2 and press enter.
|
||||
- At the CircleCI base url prompt, hit enter to accept the default value (`https://circleci.com`).
|
||||
- At the CircleCI organization name prompt, enter `actions-importer-labs`. This is the organization we'll be using throughout these labs.
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Using the down arrow key to highlight `CircleCI`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 1 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the CircleCI token prompt, enter the CircleCI access token from step 2 and press enter.
|
||||
- At the CircleCI base URL prompt, press enter to accept the default value (`https://circleci.com`).
|
||||
- At the CircleCI organization name prompt, enter `actions-importer-labs`. This is the organization you'll be using throughout these labs.
|
||||
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: CircleCI
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ GitHub handle used to authenticate with the GitHub Container Registry: mona
|
||||
✔ Personal access token to authenticate with the GitHub Container Registry: ***************
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for CircleCI: ***************
|
||||
@@ -46,7 +42,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify our environment is configured correctly, we are going to run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
To verify your environment is configured correctly, you are going to run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal run the following command:
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ In this lab, you will use the `audit` command to get a high-level view of all pr
|
||||
|
||||
The `audit` command will perform the following steps:
|
||||
|
||||
1. Fetch all of the projects defined in an CircleCI organization.
|
||||
2. Convert each pipeline to their equivalent GitHub Actions workflow.
|
||||
1. Fetch all of the projects defined in a CircleCI organization.
|
||||
2. Convert each pipeline to its equivalent GitHub Actions workflow.
|
||||
3. Generate a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
@@ -17,7 +17,7 @@ The `audit` command will perform the following steps:
|
||||
|
||||
You will be performing an `audit` for the __actions-importer-labs__ CircleCI organization that was created for the purposes of these labs. Your environment was configured to use this organization during the [configure lab](./1-configure.md). The remaining information needed to perform an `audit` is:
|
||||
|
||||
1. Where do we want to store the result?
|
||||
1. Where do you want to store the result?
|
||||
- __tmp/audit__. This can be any path within the working directory that GitHub Actions Importer commands are executed from.
|
||||
|
||||
### Steps
|
||||
@@ -31,6 +31,8 @@ You will be performing an `audit` for the __actions-importer-labs__ CircleCI org
|
||||
|
||||
3. The command will list all the files written to disk in green when the command succeeds.
|
||||
|
||||
**Note**: It is expected that you will see "Resource not found" warnings in the output. These warnings are present because you are not a member of the CircleCI organization actions-importer-labs.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
1. Find the `audit_summary.md` file in the file explorer.
|
||||
@@ -194,7 +196,7 @@ Each pipeline will have a variety of files written that include:
|
||||
- The converted workflow.
|
||||
- Stack traces that can used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage csv file
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
@@ -13,7 +13,7 @@ In this lab you will use the `dry-run` command to convert a CircleCI pipeline to
|
||||
You will be performing a dry run migration against a CircleCI project. Answer the following questions before running this command:
|
||||
|
||||
1. What project do you want to convert?
|
||||
- __circleci-demo-ruby-rails__. This is one of the sample projects avaiable in the CircleCI actions-importer-labs organization.
|
||||
- __circleci-demo-ruby-rails__. This is one of the sample projects available in the CircleCI actions-importer-labs organization.
|
||||
|
||||
2. Where do you want to store the result?
|
||||
- __tmp/dry-run__. This can be any path within the working directory that GitHub Actions Importer commands are executed from.
|
||||
@@ -36,6 +36,8 @@ You will be performing a dry run migration against a CircleCI project. Answer th
|
||||
[2022-09-19 19:46:05] tmp/dry-run/actions-importer-labs/circleci-demo-ruby-rails/.github/workflows/build_and_test.yml
|
||||
```
|
||||
|
||||
**Note**: It is expected that you will see "Resource not found" warnings in the output. These warnings are present because you are not a member of the CircleCI organization actions-importer-labs.
|
||||
|
||||
4. View the converted workflow:
|
||||
- Find `tmp/dry-run/actions-importer-labs/circleci-demo-ruby-rails/.github/workflows` in the file explorer pane in your codespace.
|
||||
- Click `build_and_test.yml` to open.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Using custom transformers to customize GitHub Actions Importer's behavior
|
||||
# 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:
|
||||
|
||||
@@ -98,7 +98,7 @@ transform "codecov_codecov_upload" 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 CircleCI.
|
||||
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 CircleCI.
|
||||
|
||||
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:
|
||||
|
||||
@@ -125,6 +125,12 @@ transform "codecov_codecov_upload" do |item|
|
||||
end
|
||||
```
|
||||
|
||||
In this example, `puts` will output an empty hash (i.e. `{}`) to the console since there are no properties configured for the CircleCI step. The step from the CircleCI pipeline is:
|
||||
|
||||
```yml
|
||||
- codecov/upload
|
||||
```
|
||||
|
||||
## Custom transformers for environment variables
|
||||
|
||||
You can use custom transformers to edit the values of environment variables in converted workflows. In this example, you will update the `COVERAGE_DIR` environment variable to be `$RUNNER_TEMP/cov` instead of `./tmp/cov`.
|
||||
@@ -187,7 +193,7 @@ end
|
||||
|
||||
</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
|
||||
- Environment variables
|
||||
|
||||
@@ -27,7 +27,7 @@ Answer the following questions before running a `migrate` command:
|
||||
gh actions-importer migrate circle-ci --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --circle-ci-project circleci-hello-world
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
2. The command will write the URL to the pull request that is created when the command succeeds.
|
||||
|
||||
```console
|
||||
$ gh actions-importer migrate circle-ci --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --circle-ci-project circleci-hello-world
|
||||
@@ -35,6 +35,8 @@ Answer the following questions before running a `migrate` command:
|
||||
[2022-08-20 22:08:20] Pull request: 'https://github.com/:owner/:repo/pull/1'
|
||||
```
|
||||
|
||||
**Note**: It is expected that you will see "Resource not found" warnings in the output. These warnings are present because you are not a member of the CircleCI organization actions-importer-labs.
|
||||
|
||||
3. Open the generated pull request in a new browser tab.
|
||||
|
||||
### Inspect the pull request
|
||||
@@ -45,10 +47,10 @@ Next, you can inspect the "Files changed" in this pull request and see the conve
|
||||
|
||||

|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
At this point, the migration has completed and you have successfully migrated a CircleCI pipeline to Actions!
|
||||
At this point, the migration has completed and you have successfully migrated a CircleCI pipeline to Actions.
|
||||
|
||||
### Next Lab
|
||||
### Next lab
|
||||
|
||||
This concludes all labs for migrating CircleCI pipelines to Actions with GitHub Actions Importer!
|
||||
This concludes all labs for migrating CircleCI pipelines to Actions with GitHub Actions Importer.
|
||||
|
||||
+5
-8
@@ -1,6 +1,6 @@
|
||||
# CircleCI to Actions migrations powered by GitHub Actions Importer
|
||||
# CircleCI migrations powered by GitHub Actions Importer
|
||||
|
||||
The instructions below will guide you through configuring a GitHub Codespace environment that will be used in subsequent labs that demonstrate how to use GitHub Actions Importer to migrate CircleCI pipelines to GitHub Actions.
|
||||
The instructions below will guide you through configuring a GitHub Codespace environment that you will use in subsequent labs to learn how to use GitHub Actions Importer to migrate CircleCI pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
@@ -12,8 +12,8 @@ These steps **must** be completed prior to starting other labs.
|
||||
|
||||
1. Start a new Codespace.
|
||||
|
||||
- Click the `Code` with button down arrow above repository on the repository's landing page.
|
||||
- Click the `Codespaces` tab
|
||||
- Click the `Code` button on your repository's landing page.
|
||||
- Click the `Codespaces` tab.
|
||||
- Click `Create codespaces on main` to create the codespace.
|
||||
- After the Codespace has initialized there will be a terminal present.
|
||||
|
||||
@@ -34,7 +34,7 @@ These steps **must** be completed prior to starting other labs.
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, refer to the troubleshooting [guide](#troubleshoot-the-actions-importer/cli).
|
||||
- If `gh actions-importer version` did not produce similar output, refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Labs for CircleCI
|
||||
|
||||
@@ -65,9 +65,6 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- If you get an error similar to the image below, then click the link in the terminal output to authorize the token.
|
||||
- Restart the codespace after clicking the link.
|
||||

|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace's terminal:
|
||||
|
||||
```bash
|
||||
|
||||
+2
-2
@@ -8,6 +8,6 @@ Please note that this project is released with a [Contributor Code of Conduct](c
|
||||
|
||||
Here's some helpful notes on how to contribute to this project, including details on how to get started working with the codebase.
|
||||
|
||||
## How to submit a bug or request a feature
|
||||
## How to offer feedback or make a feature request
|
||||
|
||||
If you think you've found a bug or have a great idea for new functionality please create an issue in the [repo](https://github.com/actions/importer-labs/issues/new).
|
||||
If you would like to offer feedback or have a great idea for new functionality, please create a new discussion [here](https://github.com/actions/importer-labs/discussions/new/choose).
|
||||
|
||||
+36
-40
@@ -13,58 +13,54 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
```
|
||||
|
||||
2. Open the GitLab server in a new browser tab:
|
||||
- Click the `PORTS` tab in the codespace terminal window.
|
||||
- In the `PORTS` tab find the row for port 80.
|
||||
- Hover over the address under the `Local Address` column and click the globe to "open in browser".
|
||||
- Click the `PORTS` tab in the codespace terminal window.
|
||||
- In the `PORTS` tab find the row for port 80.
|
||||
- Hover over the address under the `Local Address` column and click the globe to "open in browser".
|
||||
|
||||
3. Create a GitLab personal access token (PAT):
|
||||
- Authenticate with the GitLab server using the following credentials:
|
||||
- Username: `root`
|
||||
- Password: `actions-importer-labs!`
|
||||
- Follow the GitLab [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a PAT.
|
||||
- Ensure the token has the `read_api` scope.
|
||||
- Copy the generated token and save it in a safe location.
|
||||
- Authenticate with the GitLab server using the following credentials:
|
||||
- Username: `root`
|
||||
- Password: `actions-importer-labs!`
|
||||
- Follow the GitLab [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a PAT.
|
||||
- Ensure the token has the `read_api` scope.
|
||||
- Copy the generated token and save it in a safe location.
|
||||
|
||||
4. Create a GitHub personal access token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Legacy tokens` (if present).
|
||||
- Click `Generate new token` and then `Generate new legacy token`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scopes: `workflow` and `read:packages`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
|
||||
5. Run the `configure` CLI command:
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `GitLab`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub handle prompt, enter the GitHub handle used to generate the GitHub PAT in step 2 and press enter.
|
||||
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 4 and press enter.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 4 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the GitLab token prompt, enter the GitLab access token from step 3 and press enter.
|
||||
- At the GitLab URL prompt, enter `http://localhost` and press enter.
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `GitLab`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 4 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the GitLab token prompt, enter the GitLab access token from step 3 and press enter.
|
||||
- At the GitLab URL prompt, enter `http://localhost` and press enter.
|
||||
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: GitLab
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ GitHub handle used to authenticate with the GitHub Container Registry: mona
|
||||
✔ Personal access token to authenticate with the GitHub Container Registry: ***************
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Private token for GitLab: ***************
|
||||
✔ Base url of the GitLab instance: http://localhost
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: GitLab
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Private token for GitLab: ***************
|
||||
✔ Base url of the GitLab instance: http://localhost
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify your environment is configured correctly, run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal run the following command:
|
||||
1. In the codespace terminal, run the following command:
|
||||
|
||||
```bash
|
||||
gh actions-importer update
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ In this lab, you will use the `audit` command to get a high-level view of all pi
|
||||
The `audit` command will perform the following steps:
|
||||
|
||||
1. Fetch all of the projects defined in a GitLab group.
|
||||
2. Convert each pipeline to their equivalent GitHub Actions workflow.
|
||||
2. Convert each pipeline to its equivalent GitHub Actions workflow.
|
||||
3. Generate a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
@@ -67,7 +67,7 @@ Unsupported: **1 (9%)**
|
||||
- Auto DevOps: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Pipelines” section in the above example:
|
||||
Here are some key terms in the “Pipelines” section:
|
||||
|
||||
- __Successful__ pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- __Partially successful__ pipelines had all of the pipeline constructs converted, however, there were some individual items (e.g. build tasks or build triggers) that were not converted automatically to their GitHub Actions equivalent.
|
||||
@@ -115,7 +115,7 @@ Actions: **135**
|
||||
- JamesIves/github-pages-deploy-action@4.1.5: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Build steps" section in the above example:
|
||||
Here are some key terms in the "Build steps" section:
|
||||
|
||||
- A __known__ build step is a step that was automatically converted to an equivalent action.
|
||||
- An __unknown__ build step is a step that was not automatically converted to an equivalent action.
|
||||
@@ -142,7 +142,7 @@ Secrets: **1**
|
||||
- `${{ secrets.PASSWORD }}`: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Manual tasks” section in the above example:
|
||||
Here are some key terms in the “Manual tasks” section:
|
||||
|
||||
- A __secret__ refers to a repository or organization level secret that is used by the converted pipelines. These secrets will need to be created manually in Actions in order for these pipelines to function properly.
|
||||
- A __self-hosted runner__ refers to a label of a runner that is referenced by a converted pipeline that is not a GitHub-hosted runner. You will need to manually define these runners in order for these pipelines to function properly.
|
||||
@@ -182,7 +182,7 @@ Each pipeline will have a variety of files written that include:
|
||||
- The converted workflow.
|
||||
- Stack traces that can be used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage csv file
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
+2
-2
@@ -206,7 +206,7 @@ jobs:
|
||||
|
||||
Despite these two pipelines using different syntax they will function equivalently.
|
||||
|
||||
## Perform a dry-run migration of a pipeline using `include`'d files
|
||||
## Perform a dry-run migration of a pipeline using included files
|
||||
|
||||
The previous example demonstrated a basic pipeline that mapped exactly to concepts in GitHub Actions. In this section, you will perform a dry run of the `included-files-example` pipeline that uses the `include` statement in GitLab:
|
||||
|
||||
@@ -257,7 +257,7 @@ jobs:
|
||||
- run: echo "this is from a local file"
|
||||
```
|
||||
|
||||
It's important to note that GitHub Actions Importer converted this into a single workflow without templates. This is because of fundamental differences in how GitLab templates and GitHub Actions templates (i.e. Reusable Workflows and Composite Actions) function in regards to job ordering. Unfortunately, elements of reusability will be sacrificed in order for the converted pipelines to function the same. It is likely that the output of GitHub Actions Importer could be refactored to use [reusable workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date.
|
||||
It's important to note that GitHub Actions Importer converted this into a single workflow without templates. This is because of fundamental differences in how GitLab templates and GitHub Actions templates (that is, reusable workflows and composite actions) function in regards to job ordering. Unfortunately, elements of reusability will be sacrificed in order for the converted pipelines to function the same. It is likely that the output of GitHub Actions Importer could be refactored to use [reusable workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date.
|
||||
|
||||
As an added challenge, try constructing and running the `dry-run` command yourself. Hint, you should only have to change the project name.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Using 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:
|
||||
|
||||
@@ -87,7 +87,7 @@ transform "artifacts.terraform" do |item|
|
||||
end
|
||||
```
|
||||
|
||||
The `transform` 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 GitLab.
|
||||
The `transform` 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 GitLab.
|
||||
|
||||
Now, we can perform a `dry-run` command with the `--custom-transformers` CLI option. The output of the `dry-run` command should look similar to this:
|
||||
|
||||
@@ -153,7 +153,7 @@ Now you can perform another `dry-run` command with the `--custom-transformers` C
|
||||
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 GitLab to update?
|
||||
- __:default__. This is a special keyword to define the default runner to use. You can optional target specific `tags` in a job.
|
||||
- __:default__. This is a special keyword to define the default runner to use. You can optionally target specific `tags` in a job.
|
||||
|
||||
2. What is the label of the runner in Actions to use instead?
|
||||
- __custom-runner__
|
||||
@@ -196,7 +196,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
|
||||
- Environment variables
|
||||
|
||||
+5
-1
@@ -31,7 +31,11 @@ Answer the following questions before running a `migrate` command:
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
|
||||

|
||||
```console
|
||||
$ gh actions-importer migrate gitlab --target-url https://github.com/:owner/:repo --output-dir tmp/migrate
|
||||
[2022-08-20 22:08:20] Logs: 'tmp/migrate/log/actions-importer-20220916-014033.log'
|
||||
[2022-08-20 22:08:20] Pull request: 'https://github.com/:owner/:repo/pull/1'
|
||||
```
|
||||
|
||||
3. Open the generated pull request in a new browser tab.
|
||||
|
||||
|
||||
Binary file not shown.
@@ -27,7 +27,7 @@ else
|
||||
--volume /srv/gitlab/logs:/var/log/gitlab \
|
||||
--volume /srv/gitlab/data:/var/opt/gitlab \
|
||||
--shm-size 256m \
|
||||
gitlab/gitlab-ee:latest
|
||||
gitlab/gitlab-ee:15.5.6-ee.0
|
||||
|
||||
# updates file permissions to avoid git and server errors
|
||||
docker exec -it gitlab update-permissions &> /dev/null
|
||||
@@ -39,4 +39,4 @@ until $(curl --output /dev/null --silent --head --fail http://localhost); do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo -e '\nGitLab is up and running! \U1F680'
|
||||
echo -e '\nGitLab is up and running! \U1F680'
|
||||
|
||||
+3
-6
@@ -1,6 +1,6 @@
|
||||
# GitLab to Actions migrations powered by GitHub Actions Importer
|
||||
# GitLab migrations powered by GitHub Actions Importer
|
||||
|
||||
These instructions will guide you through configuring the GitHub Codespaces environment that will be used in these labs that demonstrate how to use GitHub Actions Importer to migrate GitLab pipelines to GitHub Actions.
|
||||
These instructions will guide you through configuring the GitHub Codespaces environment that you will use in these labs to learn how to use GitHub Actions Importer to migrate GitLab pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
@@ -34,7 +34,7 @@ These steps **must** be completed prior to starting other labs.
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the troubleshooting [guide](#troubleshoot-the-actions-importer/cli).
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Bootstrap a GitLab server
|
||||
|
||||
@@ -86,9 +86,6 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- If you get an error similar to the image below, click the link in the terminal output to authorize the token.
|
||||
- Restart the codespace after clicking the link.
|
||||

|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
|
||||
+15
-19
@@ -9,7 +9,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
1. Open the Jenkins server in a new browser tab:
|
||||
- Click the `PORTS` tab in the codespace terminal window.
|
||||
- In the `PORTS` tab, find the row for port 8080.
|
||||
- Hover over the address under the `Local Address` column and click the globe to "open in browser".
|
||||
- Hover over the address under the `Local Address` column and click the globe to **open in browser**.
|
||||
|
||||
2. Create a Jenkins API token:
|
||||
- In the top right menu bar, click the `admin` button.
|
||||
@@ -23,10 +23,10 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Legacy tokens` (if present).
|
||||
- Click `Generate new token` and then `Generate new legacy token`. You may be required to authenticate with GitHub during this step.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scopes: `workflow` and `read:packages`.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
|
||||
@@ -34,27 +34,23 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- Select the `TERMINAL` tab from within the codespace terminal window.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `Jenkins`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub handle prompt, enter the GitHub username used to generate the GitHub PAT in step 3 and press enter.
|
||||
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 3 and press enter.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 3 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Jenkins token prompt, enter the Jenkins access token from step 2 and press enter.
|
||||
- At the Jenkins username prompt, enter `admin` and press enter.
|
||||
- At the Jenkins URL prompt, enter `http://localhost:8080/` and press enter.
|
||||
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Jenkins
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ GitHub handle used to authenticate with the GitHub Container Registry: mona
|
||||
✔ Personal access token to authenticate with the GitHub Container Registry: ***************
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Jenkins: ***************
|
||||
✔ Username of Jenkins user: admin
|
||||
✔ Base url of the Jenkins instance: https://localhost
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Jenkins
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Jenkins: ***************
|
||||
✔ Username of Jenkins user: admin
|
||||
✔ Base url of the Jenkins instance: https://localhost
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
|
||||
## Verify your environment
|
||||
|
||||
|
||||
+7
-7
@@ -5,7 +5,7 @@ In this lab, you will use the `audit` command to get a high-level view of all pi
|
||||
The `audit` command will perform the following steps:
|
||||
|
||||
1. Fetch all of the projects defined in a Jenkins server.
|
||||
2. Convert each pipeline to their equivalent GitHub Actions workflow.
|
||||
2. Convert each pipeline to its equivalent GitHub Actions workflow.
|
||||
3. Generate a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
@@ -65,7 +65,7 @@ The audit summary, logs, config files, jenkinsfiles, and transformed workflows w
|
||||
|
||||
1. Find the `audit_summary.md` file in the file explorer.
|
||||
2. Right-click the `audit_summary.md` file and select `Open Preview`.
|
||||
3. This file contains details that summarizes what percentage of your pipelines were converted automatically.
|
||||
3. This file contains details that summarize what percentage of your pipelines were converted automatically.
|
||||
|
||||
### Review the audit summary
|
||||
|
||||
@@ -96,7 +96,7 @@ Unsupported: **1 (14%)**
|
||||
- scripted: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Pipelines” section in the above example:
|
||||
Here are some key terms in the “Pipelines” section:
|
||||
|
||||
- __Successful__ pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- __Partially successful__ pipelines had all of the pipeline constructs converted, however, there were some individual items (e.g. build tasks or build triggers) that were not converted automatically to their GitHub Actions equivalent.
|
||||
@@ -145,7 +145,7 @@ Actions: **22**
|
||||
- actions/upload-artifact@v2: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the "Build steps" section in the above example:
|
||||
Here are some key terms in the "Build steps" section:
|
||||
|
||||
- A __known__ build step is a step that was automatically converted to an equivalent action.
|
||||
- An __unknown__ build step is a step that was not automatically converted to an equivalent action.
|
||||
@@ -158,7 +158,7 @@ Here are some key terms in the "Build steps" section in the above example:
|
||||
|
||||
There is an equivalent breakdown of build triggers, environment variables, and other uncategorized items displayed in the audit summary file.
|
||||
|
||||
#### Manual Tasks
|
||||
#### Manual tasks
|
||||
|
||||
The manual tasks summary section presents an overview of the manual tasks that you will need to perform that GitHub Actions Importer is not able to complete automatically.
|
||||
|
||||
@@ -178,7 +178,7 @@ Self hosted runners: **7**
|
||||
- `DemoRunner`: **1**
|
||||
```
|
||||
|
||||
Here are some key terms in the “Manual tasks” section in the above example:
|
||||
Here are some key terms in the “Manual tasks” section:
|
||||
|
||||
- A __secret__ refers to a repository or organization level secret that is used by the converted pipelines. These secrets will need to be created manually in Actions in order for these pipelines to function properly.
|
||||
- A __self-hosted runner__ refers to a label of a runner that is referenced by a converted pipeline that is not a GitHub-hosted runner. You will need to manually define these runners in order for these pipelines to function properly.
|
||||
@@ -239,7 +239,7 @@ Each pipeline will have a variety of files written that include:
|
||||
- The converted workflow.
|
||||
- Stack traces that can used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage csv file
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
@@ -23,7 +23,7 @@ You will be performing a dry run against a pipeline in your preconfigured Jenkin
|
||||
|
||||
### Steps
|
||||
|
||||
1. Navigate to your codespace terminal
|
||||
1. Navigate to your codespace terminal.
|
||||
2. Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
@@ -41,7 +41,7 @@ You will be performing a dry run against a pipeline in your preconfigured Jenkin
|
||||
|
||||
4. View the converted workflow:
|
||||
- Find `tmp/dry-run/test_pipeline/.github/workflows` in the file explorer pane in your codespace.
|
||||
- Click `test_pipeline.yml` to open
|
||||
- Click `test_pipeline.yml` to open.
|
||||
|
||||
## Inspect the output files
|
||||
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
|
||||
</details>
|
||||
|
||||
These two 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:
|
||||
These two pipelines function equivalently despite using different syntax. In this case, the pipeline conversion was “partially successful” (that is, some item[s] were not automatically converted) and the unconverted item was placed as comment in the location the Jenkins pipeline used it. For example:
|
||||
|
||||
```diff
|
||||
- sleep 80
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,7 @@ Answer the following questions before running a `migrate` command:
|
||||
gh actions-importer 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
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
2. The command will write the URL to the pull request that is created when the command succeeds.
|
||||
|
||||
```console
|
||||
$ gh actions-importer 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
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
FROM jenkins/jenkins:2.332.3-lts
|
||||
FROM jenkins/jenkins:2.401.3
|
||||
|
||||
ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false
|
||||
ENV CASC_JENKINS_CONFIG /var/jenkins_home/casc.yaml
|
||||
|
||||
# add plugins
|
||||
COPY $CODESPACE_VSCODE_FOLDER/jenkins/bootstrap/plugins.txt /usr/share/jenkins/ref/plugins.txt
|
||||
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
|
||||
RUN /bin/jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt
|
||||
|
||||
# add security perms
|
||||
COPY $CODESPACE_VSCODE_FOLDER/jenkins/bootstrap/casc.yaml /var/jenkins_home/casc.yaml
|
||||
|
||||
# seed with jobs
|
||||
COPY $CODESPACE_VSCODE_FOLDER/jenkins/bootstrap/pipelines /usr/share/jenkins/ref/jobs
|
||||
COPY $CODESPACE_VSCODE_FOLDER/jenkins/bootstrap/pipelines /usr/share/jenkins/ref/jobs
|
||||
|
||||
@@ -1,22 +1,85 @@
|
||||
ant:latest
|
||||
authorize-project:latest
|
||||
antisamy-markup-formatter:latest
|
||||
build-timeout:latest
|
||||
cloudbees-folder:latest
|
||||
configuration-as-code:latest
|
||||
credentials-binding:latest
|
||||
email-ext:latest
|
||||
git:latest
|
||||
github-branch-source:latest
|
||||
gradle:latest
|
||||
ldap:latest
|
||||
mailer:latest
|
||||
matrix-auth:latest
|
||||
pam-auth:latest
|
||||
pipeline-github-lib:latest
|
||||
pipeline-stage-view:latest
|
||||
ssh-slaves:latest
|
||||
timestamper:latest
|
||||
workflow-aggregator:latest
|
||||
ws-cleanup:latest
|
||||
paginated-builds:latest
|
||||
workflow-scm-step:415.v434365564324
|
||||
script-security:1275.v23895f409fb_d
|
||||
ldap:694.vc02a_69c9787f
|
||||
github-branch-source:1732.v3f1889a_c475b_
|
||||
pipeline-rest-api:2.33
|
||||
commons-lang3-api:3.13.0-62.v7d18e55f51e2
|
||||
ssh-credentials:308.ve4497b_ccd8f4
|
||||
pipeline-model-definition:2.2144.v077a_d1928a_40
|
||||
ws-cleanup:0.45
|
||||
echarts-api:5.4.0-6
|
||||
jakarta-mail-api:2.0.1-3
|
||||
token-macro:384.vf35b_f26814ec
|
||||
trilead-api:2.84.v72119de229b_7
|
||||
branch-api:2.1128.v717130d4f816
|
||||
javax-mail-api:1.6.2-8
|
||||
gradle:2.8.2
|
||||
matrix-auth:3.1.10
|
||||
instance-identity:173.va_37c494ec4e5
|
||||
caffeine-api:3.1.8-133.v17b_1ff2e0599
|
||||
workflow-api:1281.vca_5fddb_3fceb_
|
||||
jaxb:2.3.8-1
|
||||
workflow-step-api:639.v6eca_cd8c04a_a_
|
||||
matrix-project:808.v5a_b_5f56d6966
|
||||
sshd:3.249.v2dc2ea_416e33
|
||||
paginated-builds:1.083.v5f614a_e66715
|
||||
timestamper:1.26
|
||||
ssh-slaves:2.916.vd17b_43357ce4
|
||||
pipeline-stage-view:2.33
|
||||
jjwt-api:0.11.5-77.v646c772fddb_0
|
||||
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
|
||||
configuration-as-code:1670.v564dc8b_982d0
|
||||
junit:1240.vf9529b_881428
|
||||
email-ext:2.100
|
||||
github:1.37.3
|
||||
commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1
|
||||
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
|
||||
jquery3-api:3.7.1-1
|
||||
resource-disposer:0.23
|
||||
credentials:1271.v54b_1c2c6388a_
|
||||
credentials-binding:631.v861c06d062b_4
|
||||
checks-api:2.0.2
|
||||
mailer:463.vedf8358e006b_
|
||||
github-api:1.314-431.v78d72a_3fe4c3
|
||||
workflow-multibranch:756.v891d88f2cd46
|
||||
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
|
||||
cloudbees-folder:6.848.ve3b_fd7839a_81
|
||||
snakeyaml-api:2.2-111.vc6598e30cc65
|
||||
pipeline-input-step:477.v339683a_8d55e
|
||||
git:5.2.0
|
||||
jakarta-activation-api:2.0.1-3
|
||||
pipeline-milestone-step:111.v449306f708b_7
|
||||
pam-auth:1.10
|
||||
jackson2-api:2.15.2-350.v0c2f3f8fc595
|
||||
workflow-job:1326.ve643e00e9220
|
||||
bouncycastle-api:2.29
|
||||
pipeline-graph-analysis:202.va_d268e64deb_3
|
||||
pipeline-groovy-lib:689.veec561a_dee13
|
||||
workflow-basic-steps:1042.ve7b_140c4a_e0c
|
||||
ionicons-api:56.v1b_1c8c49374e
|
||||
pipeline-model-api:2.2144.v077a_d1928a_40
|
||||
pipeline-stage-step:305.ve96d0205c1c6
|
||||
git-client:4.4.0
|
||||
font-awesome-api:6.4.2-1
|
||||
durable-task:523.va_a_22cf15d5e0
|
||||
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
|
||||
ant:497.v94e7d9fffa_b_9
|
||||
javax-activation-api:1.2.0-6
|
||||
authorize-project:1.7.1
|
||||
bootstrap5-api:5.3.2-1
|
||||
pipeline-github-lib:42.v0739460cda_c4
|
||||
antisamy-markup-formatter:162.v0e6ec0fcfcf6
|
||||
plugin-util-api:3.3.0
|
||||
workflow-cps:3791.va_c0338ea_b_59c
|
||||
structs:325.vcb_307d2a_2782
|
||||
workflow-support:865.v43e78cc44e0d
|
||||
pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40
|
||||
workflow-durable-task-step:1289.v4d3e7b_01546b_
|
||||
display-url-api:2.3.9
|
||||
workflow-aggregator:596.v8c21c963d92d
|
||||
scm-api:676.v886669a_199a_a_
|
||||
build-timeout:1.31
|
||||
plain-credentials:143.v1b_df8b_d3b_e48
|
||||
variant:59.vf075fe829ccb
|
||||
pipeline-model-extensions:2.2144.v077a_d1928a_40
|
||||
pipeline-build-step:505.v5f0844d8d126
|
||||
|
||||
+8
-13
@@ -1,12 +1,12 @@
|
||||
# Jenkins to Actions migrations powered by GitHub Actions Importer
|
||||
# Jenkins migrations powered by GitHub Actions Importer
|
||||
|
||||
These instructions will guide you through configuring a GitHub Codespaces environment that will be used in subsequent labs that demonstrate how to use GitHub Actions Importer to migrate Jenkins pipelines to GitHub Actions.
|
||||
These instructions will guide you through configuring a GitHub Codespaces environment that you will use in subsequent labs to learn how to use GitHub Actions Importer to migrate Jenkins pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
## Create your own repository for these labs
|
||||
|
||||
1. Ensure that you have created a repository using the [actions/importer-labs](https://github.com/actions/importer-labs) as a template.
|
||||
- Ensure that you have created a repository using the [actions/importer-labs](https://github.com/actions/importer-labs) as a template.
|
||||
|
||||
## Configure your codespace
|
||||
|
||||
@@ -34,7 +34,7 @@ These steps **must** be completed prior to starting other labs.
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output, refer to the troubleshooting [guide](#troubleshoot-the-actions-importer/cli).
|
||||
- If `gh actions-importer version` did not produce similar output, refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Bootstrap a Jenkins server
|
||||
|
||||
@@ -86,10 +86,7 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- If you get an error similar to the image below, then click the link in the terminal output to authorize the token.
|
||||
- Restart the codespace after clicking the link.
|
||||

|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
- Verify the GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
@@ -100,9 +97,7 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
Follow these steps if the Jenkins server does not start correctly after running the setup script:
|
||||
|
||||
1. On the left side of the codespace, navigate to the `Docker` tab.
|
||||
2. Under the `Containers` tab you should see a docker container named `jenkins:actions-importer` listed with a green play button ▶
|
||||
2. Under the `Containers` tab you should see a docker container named `jenkins:actions-importer` listed with a green play button.
|
||||
|
||||
- If you see the `jenkins:actions-importer` container, but it has a red stopped symbol next to it ▢, right-click the container and click `start`. The container should begin running again.
|
||||
- If the container does not start even after trying to start it manually, right-click the `jenkins:actions-importer` container and click the `remove` button. Then, attempt to start the Jenkins server again by following the steps [here](#bootstrap-a-jenkins-server).
|
||||
|
||||

|
||||
- If you see the `jenkins:actions-importer` container, but it has a red stopped symbol next to it, right-click the container and click `start`. The container should begin running again.
|
||||
- If the container does not start even after trying to start it manually, right-click the `jenkins:actions-importer` container and click `remove`. Then, attempt to start the Jenkins server again by following the steps [here](#bootstrap-a-jenkins-server).
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
# GitHub Actions Importer learning labs
|
||||
# GitHub Actions Importer labs
|
||||
|
||||
[GitHub Actions Importer](https://docs.github.com/en/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer) helps plan, forecast, and automate the migration of Azure DevOps, CircleCI, GitLab, Jenkins, and Travis CI pipelines to GitHub Actions. This repository contains learning paths that teach you how to use GitHub Actions Importer and how to approach migrations to Actions.
|
||||
[GitHub Actions Importer](https://docs.github.com/en/actions/migrating-to-github-actions/automating-migration-with-github-actions-importer) helps plan, test, and automate the migration of Azure DevOps, CircleCI, GitLab, Jenkins, and Travis CI pipelines to GitHub Actions. This repository contains learning paths that teach you how to use GitHub Actions Importer and how to approach migrations to Actions.
|
||||
|
||||
> **Note**: GitHub Actions Importer is currently available as a public preview. Visit the [sign up page](https://github.com/features/actions-importer/signup) to request access to the preview.
|
||||
## Choose your learning path
|
||||
|
||||
To get started:
|
||||
|
||||
1. Use the `actions/importer-labs` repository as a template to [generate](https://github.com/actions/importer-labs/generate) a new GitHub repository.
|
||||
2. Select which learning path to begin with. There are currently learning paths for:
|
||||
- [Migrations from Azure DevOps to GitHub Actions](/azure_devops/readme.md)
|
||||
- [Migrations from CircleCI to GitHub Actions](/circle_ci/readme.md)
|
||||
- [Migrations from GitLab to GitHub Actions](/gitlab/readme.md)
|
||||
- [Migrations from Jenkins to GitHub Actions](/jenkins/readme.md)
|
||||
- [Migrations from Travis CI to GitHub Actions](/travis/readme.md)
|
||||
2. Choose where to start. There are currently learning paths for:
|
||||
- [Migrating from Azure DevOps to GitHub Actions](/azure_devops/readme.md)
|
||||
- [Migrating from Bamboo to GitHub Actions](/bamboo/readme.md)
|
||||
- [Migrating from Bitbucket to GitHub Actions](/bitbucket/readme.md)
|
||||
- [Migrating from CircleCI to GitHub Actions](/circle_ci/readme.md)
|
||||
- [Migrating from GitLab to GitHub Actions](/gitlab/readme.md)
|
||||
- [Migrating from Jenkins to GitHub Actions](/jenkins/readme.md)
|
||||
- [Migrating from Travis CI to GitHub Actions](/travis/readme.md)
|
||||
3. Each learning path describes how to configure your codespace, bootstrap a CI/CD environment, and troubleshoot GitHub Actions Importer.
|
||||
|
||||
+35
-39
@@ -7,54 +7,50 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
## Configuring credentials
|
||||
|
||||
1. Create a GitHub personal access token (PAT):
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Legacy tokens` (if present).
|
||||
- Click `Generate new token` and then `Generate new legacy token`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scopes: `workflow` and `read:packages`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
- Open github.com in a new browser tab.
|
||||
- In the top right corner of the UI, click your profile photo and then click `Settings`.
|
||||
- In the left panel, click `Developer Settings`.
|
||||
- Click `Personal access tokens` and then `Tokens (classic)` (if present).
|
||||
- Click `Generate new token` and then `Generate new token (classic)`. You may be required to authenticate with GitHub during this step.
|
||||
- Name your token in the `Note` field.
|
||||
- Select the following scope: `workflow`.
|
||||
- Click `Generate token`.
|
||||
- Copy the generated PAT and save it in a safe location.
|
||||
|
||||
3. Create a Travis CI personal access token (PAT):
|
||||
- Open app.travis-ci.com in a new browser tab.
|
||||
- Click on your profile icon in the top right hand corner to reveal a dropdown menu.
|
||||
- Click `Settings`.
|
||||
- Click on the `Settings` tab.
|
||||
- Click on the `COPY TOKEN` button under the "API authentication" header and save it in a safe location.
|
||||
- Open app.travis-ci.com in a new browser tab.
|
||||
- Click on your profile icon in the top right corner to reveal a drop-down menu.
|
||||
- Click `Settings`.
|
||||
- Click the `Settings` tab.
|
||||
- Under the "API authentication header, click the `COPY TOKEN` button and save it in a safe location.
|
||||
|
||||
2. Run the `configure` CLI command:
|
||||
- Select the `TERMINAL` tab from within the codespace terminal.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `Travis CI`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub handle prompt, enter the GitHub username used to generate the GitHub PAT in step 3 and press enter.
|
||||
- At the GitHub Container Registry prompt, enter the GitHub PAT generated in step 2 and press enter.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 2 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Travis CI token prompt, enter the Travis CI access token from step 2 and press enter.
|
||||
- At the Travis CI base url prompt, hit enter to accept the default value (`https://travis-ci.com`).
|
||||
- At the Travis CI organization name, enter `actions-importer-labs`.
|
||||
- Select the `TERMINAL` tab from within the codespace terminal.
|
||||
- Run the following command: `gh actions-importer configure`.
|
||||
- Use the down arrow key to highlight `Travis CI`, press the spacebar to select, and then press enter to continue.
|
||||
- At the GitHub PAT prompt, enter the GitHub PAT generated in step 2 and press enter.
|
||||
- At the GitHub URL prompt, enter the GitHub instance URL or press enter to accept the default value (`https://github.com`).
|
||||
- At the Travis CI token prompt, enter the Travis CI access token from step 2 and press enter.
|
||||
- At the Travis CI base URL prompt, hit enter to accept the default value (`https://travis-ci.com`).
|
||||
- At the Travis CI organization name, enter `actions-importer-labs`.
|
||||
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Travis CI
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ GitHub handle used to authenticate with the GitHub Container Registry: mona
|
||||
✔ Personal access token to authenticate with the GitHub Container Registry: ***************
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Travis CI: ***************
|
||||
✔ Base url of the Travis CI instance: https://travis-ci.com
|
||||
✔ Travis CI organization name: actions-importer-labs
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
```console
|
||||
$ gh actions-importer configure
|
||||
✔ Which CI providers are you configuring?: Travis CI
|
||||
Enter the following values (leave empty to omit):
|
||||
✔ Personal access token for GitHub: ***************
|
||||
✔ Base url of the GitHub instance: https://github.com
|
||||
✔ Personal access token for Travis CI: ***************
|
||||
✔ Base url of the Travis CI instance: https://travis-ci.com
|
||||
✔ Travis CI organization name: actions-importer-labs
|
||||
Environment variables successfully updated.
|
||||
```
|
||||
|
||||
## Verify your environment
|
||||
|
||||
To verify our environment is configured correctly, we are going to run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
To verify your environment is configured correctly, you are going to run the `update` CLI command. The `update` CLI command will download the latest version of GitHub Actions Importer to your codespace.
|
||||
|
||||
1. In the codespace terminal run the following command:
|
||||
1. In the codespace terminal, run the following command:
|
||||
|
||||
```bash
|
||||
gh actions-importer update
|
||||
|
||||
+8
-8
@@ -1,23 +1,23 @@
|
||||
# Perform an audit of CircleCI
|
||||
# Perform an audit of Travis CI
|
||||
|
||||
In this lab, you will use the `audit` command to get a high-level view of all projects in a Travis CI organization.
|
||||
|
||||
The `audit` command operates by performing the following:
|
||||
|
||||
- Fetching all of the projects defined in a Travis CI organization.
|
||||
- Converting each to their equivalent GitHub Actions workflow.
|
||||
- Converting each to its equivalent GitHub Actions workflow.
|
||||
- Generating a report that summarizes how complete and complex of a migration is possible with GitHub Actions Importer.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your Codespace environment.
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your codespace environment.
|
||||
2. Completed the [configure lab](./1-configure.md).
|
||||
|
||||
## Perform an audit
|
||||
|
||||
You will be performing an audit against the **actions-importer-labs** Travis CI organization that was created for the purposes of this lab. Your environment was configured to use this organization during the [configure lab](./1-configure.md). The remaining information needed to perform an `audit` is:
|
||||
|
||||
1. Where do we want to store the result?
|
||||
1. Where do you want to store the result?
|
||||
- **tmp/audit**. This can be any path within the working directory that GitHub Actions Importer commands are executed from.
|
||||
|
||||
### Steps
|
||||
@@ -193,7 +193,7 @@ Secrets: **1**
|
||||
|
||||
Here are some key terms that can appear in the “Pipelines” section:
|
||||
|
||||
- **Successful** pipelines had 0% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- **Successful** pipelines had 100% of the pipeline constructs and individual items converted automatically to their GitHub Actions equivalent.
|
||||
- **Partially successful** pipelines had 100% of all of the pipeline constructs converted, however, there were some individual items that were not converted automatically to their GitHub Actions equivalent.
|
||||
- **Failed pipelines** encountered a fatal error when being converted. This can occur for one of three reasons:
|
||||
- The pipeline was misconfigured and not valid in Travis CI.
|
||||
@@ -246,13 +246,13 @@ Here are some key terms that can appear in "Build steps" section:
|
||||
- An **unsupported** build step is a step that is either:
|
||||
- A step that is fundamentally not supported by GitHub Actions.
|
||||
- A step that is configured in a way that is incompatible with GitHub Actions.
|
||||
- An **action** is a list of the actions that were used in the converted workflows. This is important for the following scenarios:
|
||||
- **Actions** provides a list of the actions that were used in the converted workflows. This is important for the following scenarios:
|
||||
- Gathering the list of actions to sync to your appliance if you use GitHub Enterprise Server.
|
||||
- Defining an organization-level allowlist of actions that can be used. This list of actions is a comprehensive list of which actions their security and/or compliance teams will need to review.
|
||||
|
||||
There is an equivalent breakdown of build triggers, environment variables, and other uncategorized items displayed in the audit summary file.
|
||||
|
||||
#### Manual Tasks
|
||||
#### Manual tasks
|
||||
|
||||
The manual tasks summary section presents an overview of the manual tasks that you will need to perform that GitHub Actions Importer is not able to complete automatically.
|
||||
|
||||
@@ -316,7 +316,7 @@ Each pipeline will have a variety of files written that include:
|
||||
- The converted workflow.
|
||||
- Stack traces that can used to troubleshoot a failed pipeline conversion
|
||||
|
||||
## Inspect the workflow usage csv file
|
||||
## Inspect the workflow usage .csv file
|
||||
|
||||
1. Open the `tmp/audit/workflow_usage.csv` file in the file explorer.
|
||||
2. This file contains a comma-separated list of all actions, secrets, and runners that are used by each successfully converted pipeline:
|
||||
|
||||
+18
-1
@@ -90,7 +90,24 @@ Additionally, these metrics are defined for each queue of runners defined in Tra
|
||||
|
||||
You can examine the available options for the `forecast` command by running `gh actions-importer forecast --help`. When you do this you will see the `--source-file-path` option:
|
||||
|
||||

|
||||
```console
|
||||
$ gh actions-importer forecast travis-ci -h
|
||||
Options:
|
||||
-g, --travis-ci-organization <travis-ci-organization> The Travis CI organization name.
|
||||
-u, --travis-ci-instance-url <travis-ci-instance-url> The URL of the Travis CI instance.
|
||||
-t, --travis-ci-access-token <travis-ci-access-token> Access token for the Travis CI instance.
|
||||
--source-file-path <source-file-path> The file path(s) to existing jobs data.
|
||||
-o, --output-dir <output-dir> (REQUIRED) The location for any output files.
|
||||
--start-date <start-date> The start date of the forecast analysis in YYYY-MM-DD format. [default:
|
||||
10/31/2022 11:13:24 AM]
|
||||
--time-slice <time-slice> The time slice in seconds to use for computing concurrency metrics. [default:
|
||||
60]
|
||||
--credentials-file <credentials-file> The file containing the credentials to use.
|
||||
--no-telemetry Boolean value to disallow telemetry.
|
||||
--no-ssl-verify Disable ssl certificate verification.
|
||||
--no-http-cache Disable caching of http responses.
|
||||
-?, -h, --help Show help and usage information
|
||||
```
|
||||
|
||||
You can use the `--source-file-path` CLI option to combine data from multiple reports into a single report. This becomes useful if you use multiple CI/CD providers and want to get a holistic view of the runner usage. This works by using the `.json` files generated by `forecast` commands as space-delimited values for the `--source-file-path` CLI option. Optionally, this value could be a glob pattern to dynamically specify the list of files (e.g. `**/*.json`).
|
||||
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
# Perform a dry-run of a Travis CI pipeline
|
||||
# Perform a dry run of a Travis CI pipeline
|
||||
|
||||
In this lab you will use the `dry-run` command to convert a Travis CI pipeline to its equivalent GitHub Actions workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your Codespace environment.
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your codespace environment.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [audit lab](./2-audit.md).
|
||||
|
||||
## Perform a dry run
|
||||
|
||||
You will be performing a dry-run against a Travis CI project. Answer the following questions before running this command:
|
||||
You will be performing a dry run against a Travis CI project. Answer the following questions before running this command:
|
||||
|
||||
1. What pipeline do you want to convert?
|
||||
- __travisci-ruby-example__. This is one of the sample projects available in the `actions-importer-labs` organization.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Using 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.
|
||||
@@ -81,7 +81,7 @@ The converted workflow above contains an `codedeploy` step that was not automati
|
||||
- __codedeploy__
|
||||
|
||||
2. What is the desired Actions syntax to use instead?
|
||||
- After some research, you have determined that we can login to AWS with the `aws-actions/configure-aws-credentials@v1` action, and deploy the app to AWS using a run step to replace the functionality of `codedeploy`:
|
||||
- After some research, you have determined that you can log in to AWS with the `aws-actions/configure-aws-credentials@v1` action, and deploy the app to AWS using a run step to replace the functionality of `codedeploy`:
|
||||
|
||||
```yaml
|
||||
- uses: aws-actions/configure-aws-credentials@v1
|
||||
@@ -121,7 +121,7 @@ transform "codedeploy" do |_item|
|
||||
end
|
||||
```
|
||||
|
||||
This method can use any valid ruby syntax and should return a `Hash`, or an array of `Hashes` that represent 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 Travis CI.
|
||||
This method can use any valid Ruby syntax and should return a `Hash`, or an array of `Hashes` that represent 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 Travis CI.
|
||||
|
||||
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:
|
||||
|
||||
@@ -153,7 +153,7 @@ The converted workflow that is generated by the above command will now use the c
|
||||
+ aws deploy create-deployment --application-name MyApp --deployment-group-name MyDeploymentGroup --github-location repository=$GITHUB_REPOSITORY,commitId=$commit_hash --ignore-application-stop-failures
|
||||
```
|
||||
|
||||
_Note_: We hard coded certain values such as the `application-name`, but we can apply these properties programmatically as well by using the item passed into the transform method. If you were unsure what the data structure of `item` was, you could use the following code in the custom transformer to print `item` to the console:
|
||||
_Note_: Certain values such as the `application-name` are hard-coded, but you can apply these properties programmatically as well by using the item passed into the transform method. If you were unsure what the data structure of `item` was, you could use the following code in the custom transformer to print `item` to the console:
|
||||
|
||||
```ruby
|
||||
transform "codecov_codecov_upload" do |item|
|
||||
@@ -197,7 +197,7 @@ With these questions answered, you can add the following code to the `transforme
|
||||
runner "linux", ["new-runner", "self-hosted"]
|
||||
```
|
||||
|
||||
In this example, the first parameter to the `runner` method is the Azure DevOps label and the second is the Actions runner labels.
|
||||
In this example, the first parameter to the `runner` method is the Travis CI label and the second is the GitHub Actions runner labels.
|
||||
|
||||
Now you 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 labels:
|
||||
|
||||
@@ -237,7 +237,7 @@ runner "linux", ["new-runner", "self-hosted"]
|
||||
|
||||
</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
|
||||
- Environment variables
|
||||
|
||||
+3
-5
@@ -27,7 +27,7 @@ Answer the following questions before running a `migrate` command:
|
||||
gh actions-importer migrate travis-ci --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --travis-ci-repository "travisci-deploy-example"
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
2. The command will write the URL to the pull request that is created when the command succeeds.
|
||||
|
||||
```console
|
||||
$ gh actions-importer migrate travis-ci --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --travis-ci-repository "travisci-deploy-example"
|
||||
@@ -43,12 +43,10 @@ The first thing to notice about the pull request is that there is a list of manu
|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
At this point, the migration has completed and you have successfully migrated a Travis CI pipeline to Actions!
|
||||
At this point, the migration has completed and you have successfully migrated a Travis CI pipeline to Actions.
|
||||
|
||||
## Next steps
|
||||
|
||||
This concludes all labs for migrating Travis CI pipelines to Actions with GitHub Actions Importer!
|
||||
This concludes all labs for migrating Travis CI pipelines to Actions with GitHub Actions Importer.
|
||||
|
||||
+9
-12
@@ -1,6 +1,6 @@
|
||||
# Travis CI to Actions migrations powered by GitHub Actions Importer
|
||||
# Travis CI migrations powered by GitHub Actions Importer
|
||||
|
||||
The instructions below will guide you through configuring a GitHub Codespace environment that will be used in subsequent labs that demonstrate how to use GitHub Actions Importer to migrate Travis CI pipelines to GitHub Actions.
|
||||
The instructions below will guide you through configuring a GitHub Codespaces environment that your will use in subsequent labs to learn how to use GitHub Actions Importer to migrate Travis CI pipelines to GitHub Actions.
|
||||
|
||||
These steps **must** be completed prior to starting other labs.
|
||||
|
||||
@@ -8,18 +8,18 @@ These steps **must** be completed prior to starting other labs.
|
||||
|
||||
1. Ensure that you have created a repository using the [actions/importer-labs](https://github.com/actions/importer-labs) as a template.
|
||||
|
||||
## Configure your Codespace
|
||||
## Configure your codespace
|
||||
|
||||
1. Start a new Codespace.
|
||||
1. Start a new codespace.
|
||||
|
||||
- Click the `Code` with button down arrow above repository on the repository's landing page.
|
||||
- Click the `Code` button on your repository's landing page.
|
||||
- Click the `Codespaces` tab.
|
||||
- Click `Create codespaces on main` to create the codespace.
|
||||
- After the Codespace has initialized there will be a terminal present.
|
||||
|
||||
2. Verify the GitHub Actions Importer CLI is installed and working. More information on the GitHub Actions Importer extension for the official GitHub CLI can be found [here](https://github.com/github/gh-actions-importer).
|
||||
|
||||
- Run the following command in the codespace's terminal:
|
||||
- Run the following command in the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
@@ -34,11 +34,11 @@ These steps **must** be completed prior to starting other labs.
|
||||
actions-importer/cli unknown
|
||||
```
|
||||
|
||||
- If `gh actions-importer version` did not produce similar output then please follow the troubleshooting [guide](#troubleshoot-the-actions-importer/cli).
|
||||
- If `gh actions-importer version` did not produce similar output, please refer to the [troubleshooting section](#troubleshoot-the-github-actions-importer-cli).
|
||||
|
||||
## Labs for Travis CI
|
||||
|
||||
Perform the following labs to learn more about GitHub Actions migrations with GitHub Actions Importer:
|
||||
Perform the following labs to learn more about how to migrate Travis CI pipelines to GitHub Actions using GitHub Actions Importer:
|
||||
|
||||
1. [Configure credentials for GitHub Actions Importer](1-configure.md)
|
||||
2. [Perform an audit of Travis CI](2-audit.md)
|
||||
@@ -65,10 +65,7 @@ The CLI extension for GitHub Actions Importer can be manually installed by follo
|
||||
✓ Installed extension github/gh-actions-importer
|
||||
```
|
||||
|
||||
- If you get an error similar to the image below, then click the link in the terminal output to authorize the token.
|
||||
- Restart the codespace after clicking the link.
|
||||

|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace's terminal:
|
||||
- Verify GitHub Actions Importer CLI extension is installed and working by running the following command from the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh actions-importer version
|
||||
|
||||
Reference in New Issue
Block a user