Initial edits to ADO/gitlab/jenkins
This commit is contained in:
@@ -14,11 +14,11 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- 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 more scopes` to reveal all scopes):
|
||||
- Select the following scopes (you may need to `Show all scopes` to reveal all scopes):
|
||||
- Agents Pool: `Read`
|
||||
- Build: `Read & Execute`
|
||||
- Code: `Read & Write`
|
||||
- Project and Team: `Read, Write, & Manage`
|
||||
- Build: `Read & execute`
|
||||
- Code: `Read & write`
|
||||
- Project and Team: `Read, write, & manage`
|
||||
- Release: `Read`
|
||||
- Service Connections: `Read`
|
||||
- Task Groups: `Read`
|
||||
@@ -32,6 +32,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- 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.
|
||||
@@ -40,6 +41,7 @@ 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 valet 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`).
|
||||
|
||||
@@ -35,7 +35,7 @@ Answer the following questions before running the `forecast` command:
|
||||
|
||||

|
||||
|
||||
4. If you inspect the help menu using the `gh valet forecast --help` command, you will see a `--source-file-path` option. You can use this option to perform a `forecast` command 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 valet 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).
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ You can use custom transformers to override Valet's default behavior. In this sc
|
||||
- __DotnetCoreCLI@2__
|
||||
|
||||
2. What is the desired Actions syntax to use instead?
|
||||
- After some research, you have determined that the uploading test results as an artifact will be suitable:
|
||||
- After some research, you have determined that the following script will provide the desired functionality:
|
||||
|
||||
```yaml
|
||||
- run: shopt -s globstar; for f in ./**/*.csproj; do dotnet build $f --configuration ${{ env.BUILDCONFIGURATION }} ; done
|
||||
|
||||
@@ -7,7 +7,6 @@ In this lab, you will use the `migrate` command to convert an Azure DevOps pipel
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and bootstrap an Azure DevOps project.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
4. Completed the [custom transformers lab](./5-custom-transformers.md).
|
||||
|
||||
## Performing a migration
|
||||
|
||||
@@ -21,14 +20,14 @@ Answer the following questions before running a `migrate` command:
|
||||
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?
|
||||
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
|
||||
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values. The command below uses `git remote get-url` to automatically populate these values.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Run the following `migrate` command in the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh valet migrate azure-devops pipeline --pipeline-id :pipeline_id --target-url https://github.com/:owner/:repo --output-dir tmp/migrate
|
||||
gh valet migrate azure-devops pipeline --pipeline-id :pipeline_id --target-url $(git remote get-url origin) --output-dir ./tmp/migrate
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
|
||||
@@ -45,11 +45,11 @@ 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 more scopes` to reveal all scopes):
|
||||
- Select the following scopes (you may need to `Show all scopes` at the bottom of the page to reveal all scopes):
|
||||
- Agents Pool: `Read`
|
||||
- Build: `Read & Execute`
|
||||
- Code: `Read & Write`
|
||||
- Project and Team: `Read, Write, & Manage`
|
||||
- Build: `Read & execute`
|
||||
- Code: `Read & write`
|
||||
- Project and Team: `Read, write, & manage`
|
||||
- Release: `Read`
|
||||
- Service Connections: `Read`
|
||||
- Task Groups: `Read`
|
||||
|
||||
@@ -31,6 +31,7 @@ You will need to complete all of the setup instructions [here](./readme.md#confi
|
||||
- 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.
|
||||
@@ -39,7 +40,7 @@ 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 valet configure`.
|
||||
- Use the down arrow key to highlight `GitLab CI`, press the spacebar to select, and then press enter to continue.
|
||||
- At the prompt, enter your GitHub username and press enter.
|
||||
- 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`).
|
||||
|
||||
+8
-2
@@ -211,7 +211,13 @@ include:
|
||||
- local: /config/test.gitlab-ci.yml
|
||||
```
|
||||
|
||||
The output of the `dry-run` command can be seen below:
|
||||
Run the following command from the root directory:
|
||||
|
||||
```bash
|
||||
gh valet dry-run gitlab --output-dir tmp/dry-run --namespace valet --project included-files-example
|
||||
```
|
||||
|
||||
The output of the command above can be seen below:
|
||||
|
||||
```yaml
|
||||
name: valet/included-files-example
|
||||
@@ -246,7 +252,7 @@ jobs:
|
||||
- run: echo "this is from a local file"
|
||||
```
|
||||
|
||||
It's important to note that Valet 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 Valet could be refactored to use [reusable workflow](https://docs.github.com/en/actions/using-workflows/reusing-workflows) at a later date.
|
||||
It's important to note that Valet 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 Valet 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.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ In this lab you will build upon the `dry-run` command to override Valet's defaul
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and start you GitLab server.
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and start your GitLab server.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
|
||||
@@ -63,7 +63,7 @@ The converted workflow above contains an `artifacts.terraform` step that was not
|
||||
- __artifacts.terraform__
|
||||
|
||||
2. What is the desired Actions syntax to use instead?
|
||||
- After some research, you have determined that the following bash script will provide similar functionality:
|
||||
- After some research, you have determined that the following GitHub Action will provide similar functionality:
|
||||
|
||||
```yaml
|
||||
- uses: actions/upload-artifact@v3
|
||||
@@ -82,7 +82,7 @@ Next, you will define a `transform` method for the `artifacts.terraform` identif
|
||||
```ruby
|
||||
transform "artifacts.terraform" do |item|
|
||||
{
|
||||
uses: "actions/upload-artifact@v2",
|
||||
uses: "actions/upload-artifact@v3",
|
||||
with: {
|
||||
path: item
|
||||
}
|
||||
|
||||
+2
-3
@@ -7,7 +7,6 @@ In this lab, you will use the `migrate` command to convert a GitLab pipeline and
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and start a GitLab server.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
4. Completed the [custom transformers lab](./5-custom-transformers.md).
|
||||
|
||||
## Performing a migration
|
||||
|
||||
@@ -20,14 +19,14 @@ Answer the following questions before running a `migrate` command:
|
||||
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.
|
||||
- __this repository__. The URL should should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values. The command below uses `git remote get-url` to automatically populate these values.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Run the following `migrate` command in the codespace terminal:
|
||||
|
||||
```bash
|
||||
gh valet migrate gitlab --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --namespace valet --project rails-example
|
||||
gh valet migrate gitlab --target-url $(git remote get-url origin) --output-dir ./tmp/migrate --namespace valet --project rails-example
|
||||
```
|
||||
|
||||
2. The command will write the URL to the pull request that was created when the command succeeds.
|
||||
|
||||
@@ -32,11 +32,12 @@ 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 valet configure`.
|
||||
- Use the down arrow key to highlight `Jenkins`, press the spacebar to select, and then press enter to continue.
|
||||
- At the prompt, enter your GitHub username and press enter.
|
||||
- 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.
|
||||
- At the Personal access token to fetch source code in GitHub prompt, press enter to accept the default value.
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ _Note_: You can refer to the previous [lab](./4-dry-run.md) to learn about the f
|
||||
|
||||
## Custom transformers for an unknown step
|
||||
|
||||
The converted workflow above contains a `sleep` step was not automatically converted. Answer the following questions before writing a custom transformer:
|
||||
The converted workflow above contains a `sleep` step that was not automatically converted. Answer the following questions before writing a custom transformer:
|
||||
|
||||
1. What is the "identifier" of the step to customize?
|
||||
- __sleep__. The identifier will be the key of a key value pair within the step of a Jenkinsfile.
|
||||
@@ -198,7 +198,7 @@ Now you can perform another `dry-run` command with the `--custom-transformers` C
|
||||
+ - uses: actions/upload-artifact@v3
|
||||
+ with:
|
||||
+ name: junit-artifact
|
||||
+ path: path/to/artifact/world.txt
|
||||
+ path: "**/target/*.xml"
|
||||
```
|
||||
|
||||
## Custom transformers for environment variables
|
||||
|
||||
@@ -7,7 +7,6 @@ In this lab, you will use the `migrate` command to convert a Jenkins pipeline an
|
||||
1. Followed the steps [here](./readme.md#configure-your-codespace) to set up your GitHub Codespaces environment and start a Jenkins server.
|
||||
2. Completed the [configure lab](./1-configure.md#configuring-credentials).
|
||||
3. Completed the [dry-run lab](./4-dry-run.md).
|
||||
4. Completed the [custom transformers lab](./5-custom-transformers.md).
|
||||
|
||||
## Performing a migration
|
||||
|
||||
@@ -18,14 +17,14 @@ Answer the following questions before running a `migrate` command:
|
||||
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?
|
||||
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values.
|
||||
- __this repository__. The URL should follow the pattern <https://github.com/:owner/:repo> with `:owner` and `:repo` replaced with your values. The command below uses `git remote get-url` to automatically populate these values.
|
||||
|
||||
### Steps
|
||||
|
||||
1. Run the following `migrate` command in your codespace terminal:
|
||||
|
||||
```bash
|
||||
gh valet migrate jenkins --target-url https://github.com/:owner/:repo --output-dir tmp/migrate --source-url http://localhost:8080/job/monas_dev_work/job/monas_freestyle
|
||||
gh valet migrate jenkins --target-url $(git remote get-url origin) --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.
|
||||
@@ -44,8 +43,6 @@ The first thing we should notice about the pull request is that there is a list
|
||||
|
||||

|
||||
|
||||
Next, review the workflow you are adding by clicking on the `Files changed` tab. This is where you double check that everything looks good. If it didn't, you could push commits with the required changes, prior to merging.
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user