From 63c17d26ed198ac474ba0cb2ec7930963b92b802 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 09:18:33 -0400 Subject: [PATCH 01/20] Create valet-configure-lab.md --- gitlab/valet-configure-lab.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 gitlab/valet-configure-lab.md diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md new file mode 100644 index 0000000..aabae75 --- /dev/null +++ b/gitlab/valet-configure-lab.md @@ -0,0 +1,34 @@ +# Configure GitLab using Valet `configure` command +In this lab, you will use Valet's `configure` command to set up the required secrets to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, but in this lab we will be focusing on GitLab. + +- [Prerequisites](#prerequisites) +- [Configuring Valet](#configure-valet) +- [Test Valet](#test-valet) +- [Next Lab](#next-lab) + +## Prerequisites + +1. Followed [steps](../gitlab#readme) to set up your codespace environment. + +## Configuring Valet +1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` and record the username and password for the next step. +2. Login to the GitLab instance to generate a personal access token: + 1. Click the `PORTS` tab in the codespace terminal window. + 2. In the `PORTS` tab find the row for port 80. + 3. Hover over the address under the `Local Address` column, and click the globe to open in browser + 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. + 5. Record token for use in later steps. +3. In the codespace terminal run `gh valet configure`. +4. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. +5. Enter the previously generated GitHub access token. +6. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com +7. Enter the GitLab access token from step 2 and press enter. +8. Enter `http://localhost` for the GitLab instance url +9. If all went well you should see a similar output in your terminal + ADD_IMAGE_HERE + +## Verify Valet Works +To verify Valet works we are going to run a `dry-run` command. We will go further into details about the `dry-run` command in a later lab, but for now we just want to confirm that Valet runs with no errors. + +### Next Lab +Dry run the migration of an GitLab pipeline to GitHub Actions ADD_LINK_HERE From 274d07e96870193629d557eb518f34d48b54ab72 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 09:22:39 -0400 Subject: [PATCH 02/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index aabae75..5b2f4f2 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -1,4 +1,4 @@ -# Configure GitLab using Valet `configure` command +# Configure Valet To Work With GitLab Using The `configure` Command In this lab, you will use Valet's `configure` command to set up the required secrets to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, but in this lab we will be focusing on GitLab. - [Prerequisites](#prerequisites) @@ -18,13 +18,21 @@ In this lab, you will use Valet's `configure` command to set up the required sec 3. Hover over the address under the `Local Address` column, and click the globe to open in browser 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. 5. Record token for use in later steps. -3. In the codespace terminal run `gh valet configure`. -4. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. -5. Enter the previously generated GitHub access token. -6. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com -7. Enter the GitLab access token from step 2 and press enter. -8. Enter `http://localhost` for the GitLab instance url -9. If all went well you should see a similar output in your terminal +3. Create a GitHub personal access token. + - Navigate to your GitHub `Settings` - click your profile photo and then click `Settings`. + - Go to `Developer Settings` + - Go to `Personal Access Tokens` -> `Legacy tokens (if present)` + - Click `Generate new token` -> `Legacy tokens (if present)`. If required, provide your password. + - Select at least these scopes: `read packages` and `workflow`. Optionally, provide a text in the **Note** field and change the expiration. + - Click `Generate token` + - Copy the token somewhere safe and temporary. +4. In the codespace terminal run `gh valet configure`. +5. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. +6. Enter the previously generated GitHub access token from step 3. +7. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com +8. Enter the GitLab access token from step 2 and press enter. +9. Enter `http://localhost` for the GitLab instance url +10. If all went well you should see a similar output in your terminal ADD_IMAGE_HERE ## Verify Valet Works From 96ab8b58534b1de0879661914153d32c1c4da38b Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 10:03:14 -0400 Subject: [PATCH 03/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index 5b2f4f2..07b247a 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -17,7 +17,7 @@ In this lab, you will use Valet's `configure` command to set up the required sec 2. In the `PORTS` tab find the row for port 80. 3. Hover over the address under the `Local Address` column, and click the globe to open in browser 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. - 5. Record token for use in later steps. + 5. Record token for a later step. 3. Create a GitHub personal access token. - Navigate to your GitHub `Settings` - click your profile photo and then click `Settings`. - Go to `Developer Settings` @@ -26,10 +26,10 @@ In this lab, you will use Valet's `configure` command to set up the required sec - Select at least these scopes: `read packages` and `workflow`. Optionally, provide a text in the **Note** field and change the expiration. - Click `Generate token` - Copy the token somewhere safe and temporary. -4. In the codespace terminal run `gh valet configure`. +4. In the codespace terminal window click back to the `TERMINAL` tab and run `gh valet configure`. 5. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. 6. Enter the previously generated GitHub access token from step 3. -7. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com +7. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. 8. Enter the GitLab access token from step 2 and press enter. 9. Enter `http://localhost` for the GitLab instance url 10. If all went well you should see a similar output in your terminal From 4da2131c5ac456497bb928a6504d972e25a5a25d Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 13:25:04 -0400 Subject: [PATCH 04/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index 07b247a..bec4920 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -1,4 +1,4 @@ -# Configure Valet To Work With GitLab Using The `configure` Command +# Configure Valet to work with GitLab using The `configure` command In this lab, you will use Valet's `configure` command to set up the required secrets to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, but in this lab we will be focusing on GitLab. - [Prerequisites](#prerequisites) @@ -18,7 +18,7 @@ In this lab, you will use Valet's `configure` command to set up the required sec 3. Hover over the address under the `Local Address` column, and click the globe to open in browser 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. 5. Record token for a later step. -3. Create a GitHub personal access token. +3. Create a GitHub personal access token (PAT). - Navigate to your GitHub `Settings` - click your profile photo and then click `Settings`. - Go to `Developer Settings` - Go to `Personal Access Tokens` -> `Legacy tokens (if present)` @@ -28,11 +28,13 @@ In this lab, you will use Valet's `configure` command to set up the required sec - Copy the token somewhere safe and temporary. 4. In the codespace terminal window click back to the `TERMINAL` tab and run `gh valet configure`. 5. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. -6. Enter the previously generated GitHub access token from step 3. -7. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. -8. Enter the GitLab access token from step 2 and press enter. -9. Enter `http://localhost` for the GitLab instance url -10. If all went well you should see a similar output in your terminal +6. Enter your GitHub Username and press enter. +7. Enter the GitHub PAT generated in step 3 and press enter +8. Enter the GitHub PAT generated in step 3 and press enter. +9. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. +10. Enter the GitLab access token from step 2 and press enter. +11. Enter `http://localhost` for the GitLab instance url +12. If all went well you should see a similar output in your terminal ADD_IMAGE_HERE ## Verify Valet Works From 0ad5f12309d8fb78bb29918a004c5c474880de1e Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 14:32:01 -0400 Subject: [PATCH 05/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index bec4920..ed153ff 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -29,16 +29,33 @@ In this lab, you will use Valet's `configure` command to set up the required sec 4. In the codespace terminal window click back to the `TERMINAL` tab and run `gh valet configure`. 5. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. 6. Enter your GitHub Username and press enter. -7. Enter the GitHub PAT generated in step 3 and press enter -8. Enter the GitHub PAT generated in step 3 and press enter. -9. Enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. -10. Enter the GitLab access token from step 2 and press enter. -11. Enter `http://localhost` for the GitLab instance url +7. At the GitHub Container Registry prompty enter the GitHub PAT generated in step 3 and press enter +8. At the GitHub PAT prompt enter the GitHub PAT generated in step 3 and press enter. +9. At the GitHub url prompt enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. +10. At the GitLab token prompt enter the GitLab access token from step 2 and press enter. +11. At the GitLab url prompt enter `http://localhost` and press enter. 12. If all went well you should see a similar output in your terminal - ADD_IMAGE_HERE +![configure-result](https://user-images.githubusercontent.com/18723510/183984633-cc893ec2-bb60-4c88-812b-55f03adaef1c.png) + ## Verify Valet Works -To verify Valet works we are going to run a `dry-run` command. We will go further into details about the `dry-run` command in a later lab, but for now we just want to confirm that Valet runs with no errors. +To verify Valet works we are going to run a `update` and `dry-run` command. We will go further into details about the `dry-run` command in a later lab, but for now we want to get the latest version of Valet and confirm that Valet can perform a dry-run with no errors. + +1. In the codespace terminal update Valet by running `gh valet update` +2. In the terminal you should see a confirmation that it logged into the GitHab Container Registry and pulled the latest version. + ``` + Login Succeeded + latest: Pulling from valet-customers/valet-cli + Digest: sha256:a7d00dee8a37e25da59daeed44b1543f476b00fa2c41c47f48deeaf34a215bbb + Status: Image is up to date for ghcr.io/valet-customers/valet-cli:latest + ghcr.io/valet-customers/valet-cli:latest + ``` + 3. Next, lets run the dry-run commmand in the codespaces terminal, to verify we can talk to GitLab + ``` + gh valet dry-run gitlab --output-dir ./tmp/dry-run-lab --namespace valet --project basic-pipeline-example + ``` + 4. In the terminal you should see the command was successful, if not it is a good time to practice the configure command again and make sure the access tokens were generated with the correct premissions + ![configure-dry-run](https://user-images.githubusercontent.com/18723510/183989794-d51fa29d-b4c0-4074-8402-a55ffcea3a6b.png) ### Next Lab Dry run the migration of an GitLab pipeline to GitHub Actions ADD_LINK_HERE From a1e80aed0d852d1df15d9e9b4a5d0f97a7ac10b2 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 14:44:58 -0400 Subject: [PATCH 06/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index ed153ff..6bd30a2 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -1,9 +1,9 @@ -# Configure Valet to work with GitLab using The `configure` command -In this lab, you will use Valet's `configure` command to set up the required secrets to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, but in this lab we will be focusing on GitLab. +# Configure Valet to work with GitLab +In this lab, you will use the Valet `configure` command to set up the required information to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, in this lab we will be focusing on GitLab. - [Prerequisites](#prerequisites) -- [Configuring Valet](#configure-valet) -- [Test Valet](#test-valet) +- [Configuring Valet](#configuring-valet) +- [Verify Valet Works](#verify-valet-works) - [Next Lab](#next-lab) ## Prerequisites @@ -11,11 +11,11 @@ In this lab, you will use Valet's `configure` command to set up the required sec 1. Followed [steps](../gitlab#readme) to set up your codespace environment. ## Configuring Valet -1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` and record the username and password for the next step. +1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` and record the GitLab username and password for the next step. 2. Login to the GitLab instance to generate a personal access token: 1. Click the `PORTS` tab in the codespace terminal window. 2. In the `PORTS` tab find the row for port 80. - 3. Hover over the address under the `Local Address` column, and click the globe to open in browser + 3. Hover over the address under the `Local Address` column, and click the globe to "open in browser". 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. 5. Record token for a later step. 3. Create a GitHub personal access token (PAT). @@ -27,22 +27,21 @@ In this lab, you will use Valet's `configure` command to set up the required sec - Click `Generate token` - Copy the token somewhere safe and temporary. 4. In the codespace terminal window click back to the `TERMINAL` tab and run `gh valet configure`. -5. Using the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. -6. Enter your GitHub Username and press enter. -7. At the GitHub Container Registry prompty enter the GitHub PAT generated in step 3 and press enter +5. Use the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. +6. At the prompt enter your GitHub Username and press enter. +7. At the GitHub Container Registry prompt enter the GitHub PAT generated in step 3 and press enter 8. At the GitHub PAT prompt enter the GitHub PAT generated in step 3 and press enter. 9. At the GitHub url prompt enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. 10. At the GitLab token prompt enter the GitLab access token from step 2 and press enter. 11. At the GitLab url prompt enter `http://localhost` and press enter. 12. If all went well you should see a similar output in your terminal -![configure-result](https://user-images.githubusercontent.com/18723510/183984633-cc893ec2-bb60-4c88-812b-55f03adaef1c.png) - +![configure-result](https://user-images.githubusercontent.com/18723510/183990474-d0b2559c-d2bf-40d9-ac43-19af53e45329.png) ## Verify Valet Works To verify Valet works we are going to run a `update` and `dry-run` command. We will go further into details about the `dry-run` command in a later lab, but for now we want to get the latest version of Valet and confirm that Valet can perform a dry-run with no errors. 1. In the codespace terminal update Valet by running `gh valet update` -2. In the terminal you should see a confirmation that it logged into the GitHab Container Registry and pulled the latest version. +2. In the terminal you should see a confirmation that it logged into the GitHub Container Registry and pulled the latest version. ``` Login Succeeded latest: Pulling from valet-customers/valet-cli @@ -50,12 +49,13 @@ To verify Valet works we are going to run a `update` and `dry-run` command. We Status: Image is up to date for ghcr.io/valet-customers/valet-cli:latest ghcr.io/valet-customers/valet-cli:latest ``` - 3. Next, lets run the dry-run commmand in the codespaces terminal, to verify we can talk to GitLab + 3. Next, lets run the dry-run command in the codespaces terminal, to verify we can talk to GitLab ``` gh valet dry-run gitlab --output-dir ./tmp/dry-run-lab --namespace valet --project basic-pipeline-example ``` - 4. In the terminal you should see the command was successful, if not it is a good time to practice the configure command again and make sure the access tokens were generated with the correct premissions + 4. In the terminal you should see the command was successful, if not it is a good time to practice the configure command again and make sure the access tokens values are correct and were generated with the correct permissions. ![configure-dry-run](https://user-images.githubusercontent.com/18723510/183989794-d51fa29d-b4c0-4074-8402-a55ffcea3a6b.png) ### Next Lab -Dry run the migration of an GitLab pipeline to GitHub Actions ADD_LINK_HERE +[Dry run the migration of an GitLab pipeline to GitHub Actions](../gitlab/valet-dry-run-lab.md) + From 3a1d8fcea9dca481ca65280859a2cfc3a54306d1 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Wed, 10 Aug 2022 15:44:44 -0400 Subject: [PATCH 07/20] Create valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 gitlab/valet-dry-run-lab.md diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md new file mode 100644 index 0000000..a451323 --- /dev/null +++ b/gitlab/valet-dry-run-lab.md @@ -0,0 +1,42 @@ +# Dry run the migration of an GitLab pipeline to GitHub Actions +In this lab, you will use the Valet `dry-run` command to convert a GitLab pipeline to it's equivalent GitHub Actions workflow. +The end result of this command will the actions workflow writen to your local filesystem. + +- [Prerequisites](#prerequisites) +- [Perform a dry run](#perform-a-dry-run) +- [View dry-run output](#view-dry-run-output) +- [Next Lab](#next-lab) + +## Prerequisites + +1. Followed [steps](../gitlab#readme) to set up your codespace environment. +2. Completed the configure [lab](../gitlab/valet-configure-lab.md) + + +## Perform a dry run +We will be performing a dry-run against a preconfigured project in the GitLab instance. Before running the command we need to collect some information: + 1. What is the project we want to convert? basic-pipeline-example + 2. What is the namespace for that project? Valet. In this case the namespace is the same as the group the project is in. + 3. Where do we want to store the result? ./tmp/dry-run-lab. This can be any valid path on the system. In the case of codespaces it is generally best to use `./tmp/SOME_DIRECTORY_HERE` so they files show in explorer + +#### Steps +1. Navigate to the codespace terminal +2. Run the dry-run command + ``` + gh valet dry-run gitlab --output-dir ./tmp/dry-run-lab --namespace valet --project basic-pipeline-example` + ``` +3. Valet should have printed the output files in the terminal. +4. Navigate to `./tmp/dry-run-lab` in the Explorer pane in codespaces and open `basic-pipeline-example.yml`. This is the converted GitHub Actions YAML file. +### Example +ADD_IMAGE + +## View dry-run output +The dry-run output will show you the GitHub Actions yaml that will be migrated to GitHub. + +### Example +ADD_IMAGE + +### Next Lab +TBD + + From 9bb91b9edda3b6977ce78e1deb85002d07713b90 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 08:21:19 -0400 Subject: [PATCH 08/20] Update gitlab/valet-configure-lab.md Co-authored-by: Begona Guereca --- gitlab/valet-configure-lab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index 6bd30a2..770eb60 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -1,5 +1,5 @@ # Configure Valet to work with GitLab -In this lab, you will use the Valet `configure` command to set up the required information to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, in this lab we will be focusing on GitLab. +In this lab, you will use the Valet `configure` command to set up the required information to communicate with the GitLab and GitHub instances. The `configure` command can be used for all of the supported providers, in this lab we will be focusing on GitLab. - [Prerequisites](#prerequisites) - [Configuring Valet](#configuring-valet) From 3b65086fe33d967a1a04846034202c84cc4feaef Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 08:30:34 -0400 Subject: [PATCH 09/20] Update gitlab/valet-configure-lab.md Co-authored-by: Begona Guereca --- gitlab/valet-configure-lab.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index 770eb60..d595bde 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -26,15 +26,19 @@ In this lab, you will use the Valet `configure` command to set up the required i - Select at least these scopes: `read packages` and `workflow`. Optionally, provide a text in the **Note** field and change the expiration. - Click `Generate token` - Copy the token somewhere safe and temporary. -4. In the codespace terminal window click back to the `TERMINAL` tab and run `gh valet configure`. -5. Use the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. -6. At the prompt enter your GitHub Username and press enter. -7. At the GitHub Container Registry prompt enter the GitHub PAT generated in step 3 and press enter -8. At the GitHub PAT prompt enter the GitHub PAT generated in step 3 and press enter. -9. At the GitHub url prompt enter the GitHub instance url or hit enter to accept the default, if you are using github.com then the default is the right choice. -10. At the GitLab token prompt enter the GitLab access token from step 2 and press enter. -11. At the GitLab url prompt enter `http://localhost` and press enter. -12. If all went well you should see a similar output in your terminal +3. Run Valet configure commands + - In the codespace terminal window click back to the `TERMINAL` tab. + - Within the terminal, navigate into the GitLab CI directory `cd valet` + - Run `gh valet configure` + - Use the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. + - At the prompt enter your GitHub Username 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 hit enter to accept the default, if you are using github.com then the default is the right choice. + - At the GitLab CI token prompt enter the GitLab CI access token from step 2 and press enter. + - At the GitLab CI url prompt enter `http://localhost` and press enter. + - At the Personal access token to fetch source code in GitHub prompt, if any of your Jenkins pipelines have source code in a GitHub repository enter the GitHub PAT that would have acess to these files. +4. If all went well you should see a similar output in your terminal ![configure-result](https://user-images.githubusercontent.com/18723510/183990474-d0b2559c-d2bf-40d9-ac43-19af53e45329.png) ## Verify Valet Works From 7df548eb46ea85f7f47b5345c54ad67c94354a98 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 08:39:55 -0400 Subject: [PATCH 10/20] reformatted configure lab --- gitlab/valet-configure-lab.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index d595bde..50f2ceb 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -13,11 +13,11 @@ In this lab, you will use the Valet `configure` command to set up the required i ## Configuring Valet 1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` and record the GitLab username and password for the next step. 2. Login to the GitLab instance to generate a personal access token: - 1. Click the `PORTS` tab in the codespace terminal window. - 2. In the `PORTS` tab find the row for port 80. - 3. Hover over the address under the `Local Address` column, and click the globe to "open in browser". - 4. Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. - 5. Record token for a later step. + - 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". + - Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. + - Record token for a later step. 3. Create a GitHub personal access token (PAT). - Navigate to your GitHub `Settings` - click your profile photo and then click `Settings`. - Go to `Developer Settings` @@ -28,7 +28,6 @@ In this lab, you will use the Valet `configure` command to set up the required i - Copy the token somewhere safe and temporary. 3. Run Valet configure commands - In the codespace terminal window click back to the `TERMINAL` tab. - - Within the terminal, navigate into the GitLab CI directory `cd valet` - Run `gh valet configure` - Use the down arrow key to highlight `GitLab CI`, press the spacebar to select, then hit enter to accept. - At the prompt enter your GitHub Username and press enter. @@ -38,8 +37,9 @@ In this lab, you will use the Valet `configure` command to set up the required i - At the GitLab CI token prompt enter the GitLab CI access token from step 2 and press enter. - At the GitLab CI url prompt enter `http://localhost` and press enter. - At the Personal access token to fetch source code in GitHub prompt, if any of your Jenkins pipelines have source code in a GitHub repository enter the GitHub PAT that would have acess to these files. -4. If all went well you should see a similar output in your terminal -![configure-result](https://user-images.githubusercontent.com/18723510/183990474-d0b2559c-d2bf-40d9-ac43-19af53e45329.png) +4. If all went well you should see a similar output in your terminal and a new file (.env.local) should have been created in the root of the project. + + ![configure-result](https://user-images.githubusercontent.com/18723510/183990474-d0b2559c-d2bf-40d9-ac43-19af53e45329.png) ## Verify Valet Works To verify Valet works we are going to run a `update` and `dry-run` command. We will go further into details about the `dry-run` command in a later lab, but for now we want to get the latest version of Valet and confirm that Valet can perform a dry-run with no errors. From 5b44a3f6770fcb6e08fb8d9d60404035c9136c08 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 11:01:51 -0400 Subject: [PATCH 11/20] Update valet-configure-lab.md --- gitlab/valet-configure-lab.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitlab/valet-configure-lab.md b/gitlab/valet-configure-lab.md index 50f2ceb..073d387 100644 --- a/gitlab/valet-configure-lab.md +++ b/gitlab/valet-configure-lab.md @@ -11,12 +11,13 @@ In this lab, you will use the Valet `configure` command to set up the required i 1. Followed [steps](../gitlab#readme) to set up your codespace environment. ## Configuring Valet -1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` and record the GitLab username and password for the next step. +1. Run the setup script in the codespace terminal `source ./gitlab/bootstrap/setup.sh` to ensure the GitLab instance is ready. 2. Login to the GitLab instance to generate a personal access token: - 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". - - Login to the GitLab server and following [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. + - Login to the GitLab server with username: `root` and password: `valet-labs!` + - follow the GitLab [instructions](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) to generate a token that has `read_api` scope. - Record token for a later step. 3. Create a GitHub personal access token (PAT). - Navigate to your GitHub `Settings` - click your profile photo and then click `Settings`. From fc38662ee23aa0caef697faff33462df2ff07b87 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 11:59:44 -0400 Subject: [PATCH 12/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index a451323..271de84 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -1,6 +1,6 @@ # Dry run the migration of an GitLab pipeline to GitHub Actions In this lab, you will use the Valet `dry-run` command to convert a GitLab pipeline to it's equivalent GitHub Actions workflow. -The end result of this command will the actions workflow writen to your local filesystem. +The end result of this command will be the actions workflow writen to your local filesystem. - [Prerequisites](#prerequisites) - [Perform a dry run](#perform-a-dry-run) @@ -10,25 +10,28 @@ The end result of this command will the actions workflow writen to your local fi ## Prerequisites 1. Followed [steps](../gitlab#readme) to set up your codespace environment. -2. Completed the configure [lab](../gitlab/valet-configure-lab.md) +2. Completed the [configure lab](../gitlab/valet-configure-lab.md) ## Perform a dry run We will be performing a dry-run against a preconfigured project in the GitLab instance. Before running the command we need to collect some information: - 1. What is the project we want to convert? basic-pipeline-example - 2. What is the namespace for that project? Valet. In this case the namespace is the same as the group the project is in. - 3. Where do we want to store the result? ./tmp/dry-run-lab. This can be any valid path on the system. In the case of codespaces it is generally best to use `./tmp/SOME_DIRECTORY_HERE` so they files show in explorer + 1. What is the project we want to convert? __basic-pipeline-example__ + 2. What is the namespace for that project? __Valet. In this case the namespace is the same as the group the project is in__ + 3. Where do we want to store the result? __./tmp/dry-run-lab. This can be any valid path on the system. In the case of codespaces it is generally best to use `./tmp/SOME_DIRECTORY_HERE` so the files show in explorer__ #### Steps 1. Navigate to the codespace terminal -2. Run the dry-run command +2. Run the dry-run command using the values determined above ``` - gh valet dry-run gitlab --output-dir ./tmp/dry-run-lab --namespace valet --project basic-pipeline-example` + gh valet dry-run gitlab --output-dir ./tmp/dry-run-lab --namespace valet --project basic-pipeline-example ``` -3. Valet should have printed the output files in the terminal. -4. Navigate to `./tmp/dry-run-lab` in the Explorer pane in codespaces and open `basic-pipeline-example.yml`. This is the converted GitHub Actions YAML file. -### Example -ADD_IMAGE +3. When the command finishes the output files should be printed to the terminal. + dry-run-terminal +4. Open generated actions workflow + - Find `./tmp/dry-run-lab/valet` in the file explorer pane in codespaces. + - Click `basic-pipeline-example.yml` to opendr + dry-run-explorer + ## View dry-run output The dry-run output will show you the GitHub Actions yaml that will be migrated to GitHub. From 8d3401a6614aff8bb19868a74d1ac9cf367c2a5c Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 12:59:14 -0400 Subject: [PATCH 13/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 115 +++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index 271de84..a8176a5 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -33,8 +33,119 @@ We will be performing a dry-run against a preconfigured project in the GitLab in dry-run-explorer -## View dry-run output -The dry-run output will show you the GitHub Actions yaml that will be migrated to GitHub. +## Review dry-run output +The dry-run output will show you the GitHub Actions yaml that would be migrated to GitHub with the `migrate` command. We will now take a quick look at what was generated + +In the GitLab pipeline we had 3 stages and 6 jobs. +
+ GitLab Pipeline +```yaml + # Testing +``` +
+ +In the resulting yaml we have the same +
+Actions Workflow + +```yaml +name: valet/basic-pipeline-example +on: + push: + workflow_dispatch: +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true +jobs: + build_a: + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job builds something." + - run: sleep 100 + build_b: + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job builds something else." + - run: sleep 70 + test_a: + needs: + - build_a + - build_b + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job tests something. It will only run when all jobs in the" + - run: echo "build stage are complete." + test_b: + needs: + - build_a + - build_b + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job tests something else. It will only run when all jobs in the" + - run: echo "build stage are complete too. It will start at about the same time as test_a." + - run: sleep 300 + deploy_a: + needs: + - test_a + - test_b + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job deploys something. It will only run when all jobs in the" + - run: echo "test stage complete." + - run: sleep 600 + deploy_b: + needs: + - test_a + - test_b + runs-on: ubuntu-latest + container: + image: alpine + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + lfs: true + - run: echo "This job deploys something else. It will only run when all jobs in the" + - run: echo "test stage complete. It will start at about the same time as deploy_a." + - run: sleep 400 +``` +
### Example ADD_IMAGE From 12f26b27e27993b6da0c15db9c1f50520697bb89 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 15:23:15 -0400 Subject: [PATCH 14/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 87 ++++++++++++++++++++++++++++++++----- 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index a8176a5..ae9670b 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -4,7 +4,7 @@ The end result of this command will be the actions workflow writen to your local - [Prerequisites](#prerequisites) - [Perform a dry run](#perform-a-dry-run) -- [View dry-run output](#view-dry-run-output) +- [Review dry-run output](#review-dry-run-output) - [Next Lab](#next-lab) ## Prerequisites @@ -34,19 +34,86 @@ We will be performing a dry-run against a preconfigured project in the GitLab in ## Review dry-run output -The dry-run output will show you the GitHub Actions yaml that would be migrated to GitHub with the `migrate` command. We will now take a quick look at what was generated +The dry-run output will show you the GitHub Actions yaml that would be migrated to GitHub with the `migrate` command. We will now take a quick look at what was generated. -In the GitLab pipeline we had 3 stages and 6 jobs. +In the GitLab pipeline we had 3 stages and 6 jobs that run on a alpine image
- GitLab Pipeline + Click to expand GitLab Pipeline + ```yaml - # Testing +stages: + - build + - test + - deploy + +image: alpine + +build_a: + stage: build + script: + - echo "This job builds something." + - sleep 100 + +build_b: + stage: build + script: + - echo "This job builds something else." + - sleep 70 + +test_a: + stage: test + script: + - echo "This job tests something. It will only run when all jobs in the" + - echo "build stage are complete." + +test_b: + stage: test + script: + - echo "This job tests something else. It will only run when all jobs in the" + - echo "build stage are complete too. It will start at about the same time as test_a." + - sleep 300 + +deploy_a: + stage: deploy + script: + - echo "This job deploys something. It will only run when all jobs in the" + - echo "test stage complete." + - sleep 600 + +deploy_b: + stage: deploy + script: + - echo "This job deploys something else. It will only run when all jobs in the" + - echo "test stage complete. It will start at about the same time as deploy_a." + - sleep 400 + ``` +
-In the resulting yaml we have the same +In the resulting yaml we have the same jobs (`build_a`, `build_b`, `test_a`, `test_b`, `deploy_a`, `deploy_b`) and the stages are now being enforced using Actions's keyword `needs`. We can see this if we examine the `needs` for test_a and test_b, which make the test jobs depend on the build jobs. +```diff +- stages: test ++ needs: ++ - build_a ++ - build_b +``` + +The `image` in the GitLab pipeline has be transformed to `container` on each of the jobs. +```diff +- image: alpine ++ container: ++ image: alpine +``` +And `script` has been transformed to `run` +```diff +- script: +- - echo "This job builds something." ++ run: echo "This job builds something." +``` +
-Actions Workflow + Click to expand Actions Workflow ```yaml name: valet/basic-pipeline-example @@ -147,10 +214,10 @@ jobs: ```
-### Example -ADD_IMAGE +## Includes Dry-Run +In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will dry-run a pipeline that does not map directly to Actions. The `include-file-example` pipeline -### Next Lab +## Next Lab TBD From 422b4550e89a63830cee61d87e8f0f71db308cc6 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 15:30:06 -0400 Subject: [PATCH 15/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 50 +++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index ae9670b..cc9e99a 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -36,9 +36,9 @@ We will be performing a dry-run against a preconfigured project in the GitLab in ## Review dry-run output The dry-run output will show you the GitHub Actions yaml that would be migrated to GitHub with the `migrate` command. We will now take a quick look at what was generated. -In the GitLab pipeline we had 3 stages and 6 jobs that run on a alpine image +__Click to Expand__
- Click to expand GitLab Pipeline + GitLab Pipeline ```yaml stages: @@ -91,29 +91,8 @@ deploy_b:
-In the resulting yaml we have the same jobs (`build_a`, `build_b`, `test_a`, `test_b`, `deploy_a`, `deploy_b`) and the stages are now being enforced using Actions's keyword `needs`. We can see this if we examine the `needs` for test_a and test_b, which make the test jobs depend on the build jobs. -```diff -- stages: test -+ needs: -+ - build_a -+ - build_b -``` - -The `image` in the GitLab pipeline has be transformed to `container` on each of the jobs. -```diff -- image: alpine -+ container: -+ image: alpine -``` -And `script` has been transformed to `run` -```diff -- script: -- - echo "This job builds something." -+ run: echo "This job builds something." -``` -
- Click to expand Actions Workflow + Actions Workflow ```yaml name: valet/basic-pipeline-example @@ -214,6 +193,29 @@ jobs: ```
+In the GitLab pipeline we had 3 stages and 6 jobs that run on a alpine image + +In the Actions workflow we have the same jobs (`build_a`, `build_b`, `test_a`, `test_b`, `deploy_a`, `deploy_b`) and the stages are now being enforced using the `needs` keyword. We can see this if we examine the `needs` for `test_a` and `test_b`, which make the test jobs depend on the build jobs. +```diff +- stages: test ++ needs: ++ - build_a ++ - build_b +``` + +The `image` in the GitLab pipeline has be transformed to `container` on each of the jobs. +```diff +- image: alpine ++ container: ++ image: alpine +``` +And `script` has been transformed to `run` +```diff +- script: +- - echo "This job builds something." ++ run: echo "This job builds something." +``` + ## Includes Dry-Run In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will dry-run a pipeline that does not map directly to Actions. The `include-file-example` pipeline From 4d309eea57ac3f3059e7e9a50bda942433a0ed59 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 15:58:29 -0400 Subject: [PATCH 16/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 48 +++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index cc9e99a..dd8fdf1 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -1,6 +1,6 @@ # Dry run the migration of an GitLab pipeline to GitHub Actions -In this lab, you will use the Valet `dry-run` command to convert a GitLab pipeline to it's equivalent GitHub Actions workflow. -The end result of this command will be the actions workflow writen to your local filesystem. +In this lab, you will use the Valet `dry-run` command to convert a GitLab pipeline to its equivalent GitHub Actions workflow. +The end result of this command will be the actions workflow written to your local filesystem. - [Prerequisites](#prerequisites) - [Perform a dry run](#perform-a-dry-run) @@ -29,7 +29,7 @@ We will be performing a dry-run against a preconfigured project in the GitLab in dry-run-terminal 4. Open generated actions workflow - Find `./tmp/dry-run-lab/valet` in the file explorer pane in codespaces. - - Click `basic-pipeline-example.yml` to opendr + - Click `basic-pipeline-example.yml` to open dry-run-explorer @@ -217,9 +217,47 @@ And `script` has been transformed to `run` ``` ## Includes Dry-Run -In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will dry-run a pipeline that does not map directly to Actions. The `include-file-example` pipeline +In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will dry-run a pipeline that does not map directly to Actions. The `included-files-example` pipeline which looks like +```yaml +include: + - local: /config/build.gitlab-ci.yml + - local: /config/test.gitlab-ci.yml +``` +which results in the below yaml. The difference to note here is that Valet transformed the pipeline into a single workflow, it did not create reusable workflows for the `include` files `/config/build.gitlab-ci.yml` and `/config/test.gitlab-ci.yml`. The reason for this is that the dependance graph of how the jobs run could not be guaranteed using reusable workflows. This is an example of how concepts in GitLab don't always map directly to Actions and Valet has to make a decision on the safest path to transform a pipeline. It is likely this could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date. +```yaml +name: valet/included-files-example +on: + push: + pull_request: + workflow_dispatch: +concurrency: + group: "${{ github.ref }}" + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 50 + lfs: true + - run: echo "[BEFORE_SCRIPT] this is from test.gitlab-ci.yml" + - run: echo "this is from a local file" + test: + needs: build + runs-on: ubuntu-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 50 + lfs: true + - run: echo "[BEFORE_SCRIPT] this is from test.gitlab-ci.yml" + - run: echo "this is from a local file" +``` ## Next Lab -TBD +[Audit GitLab Pipelines to GitHub Actions](../gitlab/valet-audit-lab.md) From d8ea3d1902355fd3d73aa515fa836afef01887c8 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 16:08:25 -0400 Subject: [PATCH 17/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index dd8fdf1..7bf5a05 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -5,6 +5,7 @@ The end result of this command will be the actions workflow written to your loca - [Prerequisites](#prerequisites) - [Perform a dry run](#perform-a-dry-run) - [Review dry-run output](#review-dry-run-output) +- [Includes Dry-Run](#includes-dry-run) - [Next Lab](#next-lab) ## Prerequisites @@ -217,13 +218,13 @@ And `script` has been transformed to `run` ``` ## Includes Dry-Run -In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will dry-run a pipeline that does not map directly to Actions. The `included-files-example` pipeline which looks like +In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will examine the results of a dry-run that does not map directly to Actions using the `included-files-example` pipeline, which looks like ```yaml include: - local: /config/build.gitlab-ci.yml - local: /config/test.gitlab-ci.yml ``` -which results in the below yaml. The difference to note here is that Valet transformed the pipeline into a single workflow, it did not create reusable workflows for the `include` files `/config/build.gitlab-ci.yml` and `/config/test.gitlab-ci.yml`. The reason for this is that the dependance graph of how the jobs run could not be guaranteed using reusable workflows. This is an example of how concepts in GitLab don't always map directly to Actions and Valet has to make a decision on the safest path to transform a pipeline. It is likely this could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date. +and results in the below yaml. The difference to note here is that Valet transformed the pipeline into a single workflow, it did not create reusable workflows for the `include` files `/config/build.gitlab-ci.yml` and `/config/test.gitlab-ci.yml`. The reason for this is that the dependency graph of how the jobs run could not be guaranteed using reusable workflows. This is an example of how concepts in GitLab don't always map directly to Actions and Valet has to make a decision on the safest path forward. It is likely this could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date with a deeper understanding of pipeline. ```yaml name: valet/included-files-example on: @@ -257,6 +258,8 @@ jobs: - run: echo "this is from a local file" ``` +Try constructing and running the `dry-run` command yourself. Hint, you should just have to change the project name. + ## Next Lab [Audit GitLab Pipelines to GitHub Actions](../gitlab/valet-audit-lab.md) From dbff6a68c2a37064008ea05eb29d59702d0eeaf8 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 16:09:46 -0400 Subject: [PATCH 18/20] Update valet-dry-run-lab.md --- gitlab/valet-dry-run-lab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index 7bf5a05..7b6e223 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -224,7 +224,7 @@ include: - local: /config/build.gitlab-ci.yml - local: /config/test.gitlab-ci.yml ``` -and results in the below yaml. The difference to note here is that Valet transformed the pipeline into a single workflow, it did not create reusable workflows for the `include` files `/config/build.gitlab-ci.yml` and `/config/test.gitlab-ci.yml`. The reason for this is that the dependency graph of how the jobs run could not be guaranteed using reusable workflows. This is an example of how concepts in GitLab don't always map directly to Actions and Valet has to make a decision on the safest path forward. It is likely this could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date with a deeper understanding of pipeline. +and results in the below yaml. The difference to note here is that Valet transformed the pipeline into a single workflow, it did not create reusable workflows for the `include` files `/config/build.gitlab-ci.yml` and `/config/test.gitlab-ci.yml`. The reason for this is that the dependency graph of how the jobs run could not be guaranteed using reusable workflows. This is an example of how concepts in GitLab don't always map directly to Actions and Valet has to make a decision on the safest path forward. It is likely this could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date with a deeper understanding of the pipeline. ```yaml name: valet/included-files-example on: From e633cd12825d0a6e751d8c868758045cc7160e0b Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 20:45:52 -0400 Subject: [PATCH 19/20] Update gitlab/valet-dry-run-lab.md Co-authored-by: Begona Guereca --- gitlab/valet-dry-run-lab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index 7b6e223..24f5058 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -218,7 +218,7 @@ And `script` has been transformed to `run` ``` ## Includes Dry-Run -In the previous dry-run we migrated a basic pipeline that map very nicely to concepts in GitHub Actions. In this section we will examine the results of a dry-run that does not map directly to Actions using the `included-files-example` pipeline, which looks like +In the previous dry-run we migrated a basic pipeline that mapped very nicely to concepts in GitHub Actions. In this section we will examine the results of a dry-run that does not map directly to Actions using the `included-files-example` pipeline, which looks like ```yaml include: - local: /config/build.gitlab-ci.yml From 9056585b78485cccc7215703a5c0416d832b3c23 Mon Sep 17 00:00:00 2001 From: j-dunham Date: Thu, 11 Aug 2022 20:46:14 -0400 Subject: [PATCH 20/20] Update gitlab/valet-dry-run-lab.md Co-authored-by: Begona Guereca --- gitlab/valet-dry-run-lab.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/valet-dry-run-lab.md b/gitlab/valet-dry-run-lab.md index 24f5058..9c743c0 100644 --- a/gitlab/valet-dry-run-lab.md +++ b/gitlab/valet-dry-run-lab.md @@ -20,7 +20,7 @@ We will be performing a dry-run against a preconfigured project in the GitLab in 2. What is the namespace for that project? __Valet. In this case the namespace is the same as the group the project is in__ 3. Where do we want to store the result? __./tmp/dry-run-lab. This can be any valid path on the system. In the case of codespaces it is generally best to use `./tmp/SOME_DIRECTORY_HERE` so the files show in explorer__ -#### Steps +### Steps 1. Navigate to the codespace terminal 2. Run the dry-run command using the values determined above ```