Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ Let's start by importing the build pipeline named [eshoponweb-ci-pr.yml](https:/

In this task, you will add policies to the main branch and only allow changes using Pull Requests that comply with the defined policies. You want to ensure that changes in a branch are reviewed before they are merged.

1. Go to **Repo>Branches** section.
1. Go to **Repos>Branches** section.
1. On the **Mine** tab of the **Branches** pane, hover the mouse pointer over the **main** branch entry to reveal the ellipsis symbol on the right side.
1. Click the ellipsis and, in the pop-up menu, select **Branch Policies**.
1. On the **main** tab of the repository settings, enable the option for **Require minimum number of reviewers**. Add **1** reviewer and check the box **Allow requestors to approve their own changes**(as you are the only user in your project for the lab)
1. On the **main** tab of the repository settings, click on **Add Build Validation** and in the Build pipeline list, select **eshoponweb-ci-pr** then click **Save**.
1. On the **main** tab of the repository settings, in the **Build Validation** section, click **+** (Add a new build policy) and in the **Build pipeline** list, select **eshoponweb-ci-pr** then click **Save**.

#### Task 3: Working with Pull Requests

In this task, you will use the Azure DevOps portal to create a Pull Request, using a new branch to merge a change into the protected **main** branch.

1. Navigate to the **Repos** section
1. Create a new branch named **Feature01** based on the **main** branch
1. Navigate to the **/eShopOnWeb/src/Web/Program.cs** file as part of the **Feature01** branch and make the following change on the first line:
1. Navigate to the **Repos** section in the eShopOnWeb navigation and click **Branches**.
1. Create a new branch named **Feature01** based on the **main** branch.
2. Click **Feature01* and navigate to the **/eShopOnWeb/src/Web/Program.cs** file as part of the **Feature01** branch and make the following change on the first line:

```csharp
// Testing my PR
Expand All @@ -117,8 +117,8 @@ In this task, you will use the Azure DevOps portal to create a Pull Request, usi
- At least 1 user should review and approve the changes.
- Build validation, you will see that the build **eshoponweb-ci-pr** was triggered automatically

1. After all validations are successful, on the top-right click on **Approve**. Now you can click on **Complete**.
1. On the **Complete Pull Request** tab, Click on **Complete Merge**
1. After all validations are successful, on the top-right click on **Approve**. Now from the **Set auto-complete** dropdown you can click on **Complete**.
1. On the **Complete Pull Request** tab, click on **Complete Merge**

### Exercise 2: Configure CI Pipeline as Code with YAML

Expand All @@ -132,7 +132,7 @@ Let's start by importing the CI pipeline named [eshoponweb-ci.yml](https://githu

1. Go to **Pipelines>Pipelines**

1. Click on **Create Pipeline** button
1. Click on **New Pipeline** button

1. Select **Azure Repos Git (YAML)**

Expand All @@ -154,7 +154,7 @@ Let's start by importing the CI pipeline named [eshoponweb-ci.yml](https://githu

The default build pipeline definition doesn't enable Continuous Integration.

1. Now, you need to replace the **Trigger** and **Resources** sections with the following code:
1. Now, you need to replace the **trigger: none** code with the following code:

```YAML
trigger:
Expand All @@ -170,7 +170,7 @@ The default build pipeline definition doesn't enable Continuous Integration.

Since you enabled Branch Policies, you need to pass by a Pull Request in order to update your code.

1. Click the **Save** button to save the pipeline definition.
1. Click the **Save** button (not **Save and run**) to save the pipeline definition.
1. Select **Create a new branch for this commit**
1. Keep the default branch name and **Start a pull request** checked.
1. Click on **Save**
Expand All @@ -188,21 +188,23 @@ In this task, you will create a Pull Request, using a new branch to merge a chan

1. Navigate to the **Repos** section
1. Create a new branch named **Feature02** based on the **main** branch
1. Navigate to the **/eShopOnWeb/src/Web/Program.cs** file as part of the **Feature02** branch and remove the first line:
2. Click the new **Feature02** branch
3. Navigate to the **/eShopOnWeb/src/Web/Program.cs** file and remove the first line:

```csharp
// Testing my PR
```

1. Click on **Commit > Commit** (leave default commit message).
1. A message will pop-up, proposing to create a Pull Request (as your **Feature02** branch is now ahead in changes, compared to **main**). Click on **Create a Pull Request**.
1. In the **New pull request** tab, leave defaults and click on **Create**.
1. The Pull Request will show some pending requirements, based on the policies applied to the target **main** branch.
1. After all validations are successful, on the top-right click on **Approve**. Now you can click on **Complete**.
1. On the **Complete Pull Request** tab, Click on **Complete Merge**
1. Go back to **Pipelines>Pipelines**, you will notice that the build **eshoponweb-ci** was triggered automatically after the code was merged.
1. Click on the **eshoponweb-ci** build then select the last run.
1. After its successful execution, click on **Related > Published** to check the published artifacts:
1. A message will pop-up, proposing to create a Pull Request (as your **Feature02** branch is now ahead in changes, compared to **main**).
3. Click on **Create a Pull Request**.
4. In the **New pull request** tab, leave defaults and click on **Create**.
5. The Pull Request will show some pending requirements, based on the policies applied to the target **main** branch.
6. After all validations are successful, on the top-right click on **Approve**. Now from the **Set auto-complete** dropdown you can click on **Complete**.
7. On the **Complete Pull Request** tab, Click on **Complete Merge**
8. Go back to **Pipelines>Pipelines**, you will notice that the build **eshoponweb-ci** was triggered automatically after the code was merged.
9. Click on the **eshoponweb-ci** build then select the last run.
10. After its successful execution, click on **Related > Published** to check the published artifacts:
- Bicep: the infrastructure artifact
- Website: the app artifact

Expand Down