From 0d2e57d1f4ddae92af8c6ead0b563bc381e8d416 Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:17:12 +0100 Subject: [PATCH 1/9] Save missed --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 1563a4bf5..96b115fa0 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -126,7 +126,7 @@ In this task, you will disable execution of the existing pipeline. 1. On the **Pipelines** pane, select the **PartsUnlimited** entry. 1. In the upper right corner of the **PartsUnlimited** blade, click the vertical ellipsis symbol and, in the drop-down menu, select **Settings**. -1. On the **Pipeline settings** pane, select the **Paused** option. +1. On the **Pipeline settings** pane, select the **Paused** option. Click **Save**. #### Task 2: Add a YAML build definition From 203be8ce851a3d5c8565017829370661366bf80a Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:22:46 +0100 Subject: [PATCH 2/9] i still get "master" branch from demo generator, template uses "main" for trigger --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 96b115fa0..584373b0b 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -143,6 +143,10 @@ In this task, you will add a YAML build definition to the existing project. > **Note**: The pipeline definition will be saved as a file named **azure-pipelines.yml** in the root of the repository. The file will contain the steps required to build and test a typical ASP.NET solution. You can also customize the build as needed. In this scenario, you will update the **pool** to enforce the use of a VM running Visual Studio 2017. +1. Change trigger to **master**. + + > **Note**: Review in Repos if your repository has **master** or **main** branch, new repos will be having **main** by default. + 1. On the **Review your pipeline YAML** pane, in line **10**, replace `vmImage: 'windows-latest'` with `vmImage: 'vs2017-win2016'`. 1. On the **Review your pipeline YAML** pane, click **Save and run**. 1. On the **Save and run** pane, accept the default settings and click **Save and run**. From 457ee9601266aa886e45b73b1f113c62c585a4d2 Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:28:46 +0100 Subject: [PATCH 3/9] `trigger` --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 584373b0b..74c766439 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -143,7 +143,7 @@ In this task, you will add a YAML build definition to the existing project. > **Note**: The pipeline definition will be saved as a file named **azure-pipelines.yml** in the root of the repository. The file will contain the steps required to build and test a typical ASP.NET solution. You can also customize the build as needed. In this scenario, you will update the **pool** to enforce the use of a VM running Visual Studio 2017. -1. Change trigger to **master**. +1. Change `trigger` to **master**. > **Note**: Review in Repos if your repository has **master** or **main** branch, new repos will be having **main** by default. From 2aaf0455ed2f9e70504d927d05fa56ed59e2c5ee Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:35:14 +0100 Subject: [PATCH 4/9] clarify, lot of students do mistakes --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 74c766439..f6c289478 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -208,7 +208,7 @@ In this task, you will add continuous delivery to the YAML-based definition of t > **Note**: By default, these two stages run independently. As a result, the build output from the first stage might not be available to the second stage without additional changes. To implement these changes, we will use one task to publish the build output at the end of the build stage and another to download it in the beginning of the deploy stage. -1. Place the cursor on a blank line at the end of the build stage. +1. Place the cursor on a blank line at the end of the build stage to add another task. (right below `task: VSTest@2` ) 1. On the **Tasks** pane, search for and select the **Publish build artifacts** task. 1. On the **Publish build artifacts** pane, accept the default settings and click **Add**. From 48910d73c210544f8d913279781c91c486ee425a Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:38:23 +0100 Subject: [PATCH 5/9] clarify indentation --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index f6c289478..a9f5e338b 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -214,7 +214,7 @@ In this task, you will add continuous delivery to the YAML-based definition of t > **Note**: This will publish the build artifacts to a location that will be downloadable under the alias **drop**. -1. With the added task still selected in the editor, press the **Tab** key twice to indent it four spaces. +1. With the added task still selected in the editor, press the **Tab** key twice to indent it four spaces (or press the **Tab** until task is indented as the ones above). > **Note**: You may also want to add an empty line before and after to make it easier to read. From 37276e51a8506175ce47e99740897f83f957b786 Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:39:07 +0100 Subject: [PATCH 6/9] deploy stage --- .../Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index a9f5e338b..a9575f89f 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -218,7 +218,7 @@ In this task, you will add continuous delivery to the YAML-based definition of t > **Note**: You may also want to add an empty line before and after to make it easier to read. -1. Place the cursor on the first line under the **steps** node of the deployment stage. +1. Place the cursor on the first line under the **steps** node of the **deploy** stage. 1. On the **Tasks** pane, search for and select the **Download build artifacts** task. 1. Click **Add**. 1. With the added task still selected in the editor, press the **Tab** key twice to indent it four spaces. From fab7b798811c84e5f8e56b9b73b6833195215f61 Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:48:17 +0100 Subject: [PATCH 7/9] delete existing, is is really confusing! --- .../AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index a9575f89f..89e8c2732 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -116,17 +116,17 @@ In this task, you will create an Azure web app and an Azure SQL database by usin In this exercise, you will configure CI/CD Pipelines as code with YAML in Azure DevOps. -#### Task 1: Disable execution of the existing pipeline +#### Task 1: Delete the existing pipeline -In this task, you will disable execution of the existing pipeline. +In this task, you will delete the existing pipeline. 1. On the lab computer, switch to the browser window displaying the **Configuring Pipelines as Code with YAML** project in the Azure DevOps portal and, in the vertical navigational pane, select the **Pipelines**. > **Note**: Before configuring YAML pipelines, you will disable the existing build pipeline. 1. On the **Pipelines** pane, select the **PartsUnlimited** entry. -1. In the upper right corner of the **PartsUnlimited** blade, click the vertical ellipsis symbol and, in the drop-down menu, select **Settings**. -1. On the **Pipeline settings** pane, select the **Paused** option. Click **Save**. +1. In the upper right corner of the **PartsUnlimited** blade, click the vertical ellipsis symbol and, in the drop-down menu, select **Delete**. +1. Write **PartsUnlimited** and click **Delete**. #### Task 2: Add a YAML build definition From 99aa7c0a25d3d1a9b8dac52a8359c027279dcc8e Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:51:48 +0100 Subject: [PATCH 8/9] All these steps I deleted made no sense, we do not need the pipeline given by the demo. This process makes it much simpler and clear. --- .../AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 89e8c2732..72240b810 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -236,11 +236,8 @@ In this task, you will add continuous delivery to the YAML-based definition of t > **Note**: This will automatically trigger a new build. 1. In the web browser window displaying the Azure DevOps portal, in the vertical navigational pane, select the **Pipelines**. -1. On the **Pipelines** pane, click the entry representing the newly configured pipeline. -1. In the in the upper right corner of the **PartsUnlimited** pipeline pane listing its runs, click the vertical ellipsis symbol and, in the drop-down menu, select **Settings**. -1. On the **Pipeline settings** pane, in the **YAML file path** dropdown list, select the **./azure-pipelines-1.yml** entry, right above it, select the **Enabled** option, and click **Save**. -1. Back on the **PartsUnlimited** pipeline pane listing its runs, in the vertical navigational pane, select the **Pipelines**. -1. On the **Pipelines** pane, hover with the mouse pointer over the entry representing the newly configured pipeline so it reveals the ellipsis symbol on the right side, click the ellipsis symbol, and, in the drop-down menu, select **Run pipeline**. +1. On the **Pipelines** pane, click the entry representing the newly configured pipeline. +1. Click on the most recent run (automatically started). 1. On the **Summary** pane, monitor the progress of the pipeline run. 1. If you notice a message stating that *This pipeline needs permissions to access a resource before this run can continue to Deploy*, click **View**, in the **Waiting for review** dialog box, click **Permit**, and, in the **Permit access?** pane, click **Permit** again. 1. At the bottom of the **Summary** pane, click the **Deploy** stage to view details of the deployment. From d1a850d8ee9c2fe7e374f109ec7de42acfdc9996 Mon Sep 17 00:00:00 2001 From: Unai Huete Beloki Date: Wed, 27 Jan 2021 22:55:33 +0100 Subject: [PATCH 9/9] include a yaml pipeline example so students can compare --- ...Configuring_Pipelines_as_Code_with_YAML.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md index 72240b810..e6f67dd99 100644 --- a/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md +++ b/Instructions/Labs/AZ400_M11_Configuring_Pipelines_as_Code_with_YAML.md @@ -235,6 +235,70 @@ In this task, you will add continuous delivery to the YAML-based definition of t > **Note**: This will automatically trigger a new build. +1. The pipeline will look similar to this example (poiting to your own subscription and webapp): + + ``` + trigger: + - master + + stages: + - stage: Build + jobs: + - job: Build + pool: + vmImage: 'vs2017-win2016' + + variables: + solution: '**/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + + steps: + - task: NuGetToolInstaller@1 + + - task: NuGetCommand@2 + inputs: + restoreSolution: '$(solution)' + + - task: VSBuild@1 + inputs: + solution: '$(solution)' + msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"' + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + + - task: VSTest@2 + inputs: + platform: '$(buildPlatform)' + configuration: '$(buildConfiguration)' + + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'drop' + publishLocation: 'Container' + + - stage: Deploy + jobs: + - job: Deploy + pool: + vmImage: 'vs2017-win2016' + steps: + - task: DownloadBuildArtifacts@0 + inputs: + buildType: 'current' + downloadType: 'single' + downloadPath: '$(System.ArtifactsDirectory)' + artifactName: 'drop' + - task: AzureRmWebAppDeployment@4 + inputs: + ConnectionType: 'AzureRM' + azureSubscription: 'YOUR-AZURE-SUBSCRIPTION' + appType: 'webApp' + WebAppName: 'YOUR-WEBAPP-NAME' + packageForLinux: '$(System.ArtifactsDirectory)/drop/*.zip' + ``` + 1. In the web browser window displaying the Azure DevOps portal, in the vertical navigational pane, select the **Pipelines**. 1. On the **Pipelines** pane, click the entry representing the newly configured pipeline. 1. Click on the most recent run (automatically started).