From 3c526322203a1cc29b5863c5181599b6bd520792 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Fri, 8 Sep 2023 16:10:02 -0400 Subject: [PATCH] Lab edits --- bitbucket/1-configure.md | 3 +-- bitbucket/2-audit.md | 2 +- bitbucket/3-forecast.md | 8 ++++---- bitbucket/4-dry-run.md | 8 ++++---- bitbucket/5-custom-transformers.md | 10 ++++++---- bitbucket/6-migrate.md | 2 +- bitbucket/readme.md | 4 ++-- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bitbucket/1-configure.md b/bitbucket/1-configure.md index 057a96b..012e9bd 100644 --- a/bitbucket/1-configure.md +++ b/bitbucket/1-configure.md @@ -15,8 +15,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi - Select the following scope: `workflow`. - Click `Generate token`. - Copy the generated PAT and save in a safe location. - -2. Create a Bitbucket workspace access token with read scopes for pipeline, project, and repository, using Bitbucket's [documentation](https://support.atlassian.com/bitbucket-cloud/docs/create-a-workspace-access-token/) and store the token 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. 3. Run the `configure` CLI command: - Select the `TERMINAL` tab from within the codespace terminal window. diff --git a/bitbucket/2-audit.md b/bitbucket/2-audit.md index 9d354b6..177f222 100644 --- a/bitbucket/2-audit.md +++ b/bitbucket/2-audit.md @@ -31,7 +31,7 @@ Answer the following questions before running this command: ```bash gh actions-importer audit bitbucket --output-dir tmp/audit --workspace actions-importer --config-file-path bitbucket/bootstrap/config.yml ``` - > Note: we are using `--config-file-path` for the purposes of this lab and this would not be required unless you wanted to audit only local files. + > Note: The use of --config-file-path is specific to this lab exercise, and it's not necessary unless you intend to perform an audit solely on local files. 3. The command will list all the files written to disk in green when the command succeeds. ## Inspect the output files diff --git a/bitbucket/3-forecast.md b/bitbucket/3-forecast.md index f8efe2c..06b6427 100644 --- a/bitbucket/3-forecast.md +++ b/bitbucket/3-forecast.md @@ -14,7 +14,7 @@ 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**. This value defaults to the date one week ago, however, you should use a start date that will show a representative view of typical usage. + - **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** @@ -24,16 +24,16 @@ Answer the following questions before running the `forecast` command: 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/audit --source-file-path bitbucket/**/source_files/*.json + 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: This uses `--source-file-path` to specify the source of the usage date, which would typically be left out of the command during normal usage. This option is explained in more depth in a later section. + > Note: The --source-file-path flag is used in this command to indicate the location of the usage data source. In regular usage, this flag may not be necessary. For more information on this option, please refer to a later section. 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/audit/forecast_report.md + [2023-09-07 18:26:22] tmp/forecast/forecast_report.md ``` ## Review the forecast report diff --git a/bitbucket/4-dry-run.md b/bitbucket/4-dry-run.md index f205884..a46a491 100644 --- a/bitbucket/4-dry-run.md +++ b/bitbucket/4-dry-run.md @@ -10,7 +10,7 @@ In this lab you will use the `dry-run` command to convert a Bitbucket pipeline t ## Perform a dry run -You will be performing a dry run against a Bitbucket pipeline. Answer the following questions before running this command: +Before executing the dry-run command we will need to answer the following questions. 1. What repository is that pipeline in? - __react-deploy__ @@ -29,7 +29,7 @@ You will be performing a dry run against a Bitbucket pipeline. Answer the follow ```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: To simplify the lab we are using `--source-file-path` to specify a local file for the source of the pipeline yaml. + >Note: For the purpose of this lab exercise, we're using the `--source-file-path` option to specify a local file as the source for the pipeline YAML, in order to simplify the process. 3. The command will list all the files written to disk when the command succeeds. @@ -43,8 +43,8 @@ You will be performing a dry run against a Bitbucket pipeline. Answer the follow 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 runs on all pushes to branches that are not master. - - Click `branches-master.yml` to open workflow that run on pushes to master. + - 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 diff --git a/bitbucket/5-custom-transformers.md b/bitbucket/5-custom-transformers.md index efc4943..4d829e3 100644 --- a/bitbucket/5-custom-transformers.md +++ b/bitbucket/5-custom-transformers.md @@ -71,11 +71,13 @@ _Note_: You can refer to the previous [lab](./4-dry-run.md) to learn about the f 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? - - After some research, you have determined that the [Azure Web App](https://github.com/marketplace/actions/azure-webapp) and [Azure Login](https://github.com/marketplace/actions/azure-login) actions in the marketplace will provide similar functionality: + - 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 @@ -118,7 +120,7 @@ The converted workflow above contains a `atlassian/unknown-azure-deploy` step th 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 structure of the item can be viewed by looking at the commented out step for the identifier in the workflow. +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 structure of the item can be viewed by looking at the commented out step for the identifier in the workflow. ```yaml identifier: atlassian/unknown-azure-deploy:1.1.0 @@ -140,7 +142,7 @@ Now you can perform another `dry-run` command and use the `--custom-transformers 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-deplo` step. +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: @@ -164,7 +166,7 @@ Now you can perform another `dry-run` command with the `--custom-transformers` C ```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 the python pipeline because that uses the `runs-on` with the target label. +> Note: we are using a different pipeline then before that has uses `runs-on` with the target label. ```diff runs-on: diff --git a/bitbucket/6-migrate.md b/bitbucket/6-migrate.md index 670891a..506a040 100644 --- a/bitbucket/6-migrate.md +++ b/bitbucket/6-migrate.md @@ -23,7 +23,7 @@ Answer the following questions before running a `migrate` command: ### Steps -1. Run the following `migrate` command in the codespace terminal: +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 diff --git a/bitbucket/readme.md b/bitbucket/readme.md index a82fa9d..ec371ff 100644 --- a/bitbucket/readme.md +++ b/bitbucket/readme.md @@ -29,8 +29,8 @@ These steps **must** be completed prior to starting other labs. ```console $ gh actions-importer version - gh version 2.14.3 (2022-07-26) - gh actions-importer github/gh-actions-importer v0.1.12 + gh version 2.31.0 (2023-06-20) + gh actions-importer github/gh-actions-importer v1.3.3 actions-importer/cli unknown ```