owned this note changed 6 years ago
Linked with GitHub

Azure DevOps 發行管理設計實務 - 黃保翕(Will 保哥)

Welcome to DevOps Days 2019 Collaborative Notes

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Getting started from here: https://hackmd.io/@DevOpsDay/2019
Click top left to expand Agenda on the mobile.

Start here

上手實作步驟

  • Azure

    • Resource Group: DevOpsDay2019
  • Build ASP.NET apps

    ​​git clone https://github.com/Microsoft/devops-project-samples.git
    ​​cd devops-project-samples\dotnet\aspnet\webapp\Application\
    ​​nuget restore
    ​​msbuild
    
  • Azure Repos

    1. 建立 New repository
    2. Import https://github.com/Microsoft/devops-project-samples.git
  • Azure Portal (Web App)

    1. 建立 Web App 網站
    2. Runtime stack: ASP.NET V4.7
    3. Region: West US
  • Azure Portal (VM)

    1. 建立 IIS on Windows Server 2019 虛擬機器
    2. Runtime stack: ASP.NET V4.7
    3. Region: West US
  • Azure Pipelines / Builds

    1. New build pipeline
    2. Use the classic editor
    3. Repository: devops-project-samples
    4. Select a template: ASP.NET
    5. Select App Service name
    6. 設定 Solution 參數: dotnet\aspnet\webapp\Application\SampleWebApplication.sln
    7. Save and Queue
  • Azure Pipelines / Releases

    1. New release pipeline
    2. Select a template: Azure App Service deployment
    3. Select App Service name
    4. Create release

體驗 Azure Pipelines 設定步驟

image

  1. Create a deployment group

    • New > myIIS
    • Type of target to register: Windows
    • 勾選 Use a personal access token in the script for authentication
    • 點擊 Copy script to the clipboard
    • VM1 用 PowerShell 以 系統管理員身分 執行複製下來的 Script,過程中會問兩個問題,直接按下 Enter 跳過即可。
    • 執行完後,透過 services.msc 會看到 VSTS Agent (dev.VM1) 系統服務自動啟動
    • 到 Azure DevOps 切換到 deployment group 的 Targets 看 VM 是否正常連線!(預設會從 VM 主動通知 Azure DevOps 已上線)
  2. Define your CD release pipeline

    • 先在 Azure DevOps 安裝 IIS Web App Deployment Using WinRM 擴充套件
    • Create build pipeline ( Create your first pipeline )
      • 選擇 Repository

      • 選擇 ASP.NET 範本

      • 檢視 azure-pipelines.yml 並加入發佈設定

        ​​​​​​​​​​- task: PublishBuildArtifacts@1
        

        ​​​​​​​​​​- task: PublishBuildArtifacts@1
        ​​​​​​​​​​  inputs:
        ​​​​​​​​​​    pathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ​​​​​​​​​​    artifactName: 'drop'
        
      • 儲存並執行,過程中會將 azure-pipelines.yml 自動 commit 到 Git Repo 的 master 分支下

    • Create release pipeline
      • 選擇 IIS website deployment 範本,並按下 Apply
      • 選擇 Artifacts 下的 Continuous deployment trigger 圖示 > 選擇 master 分支
      • 切換到 Tasks 頁籤,選取 IIS Deployment 項目,選擇剛剛建立的 Deployment group ( myIIS )
      • 按下 Save 儲存 Release pipeline
    • Create a release to deploy your app
tags: DevOpsDays Taipei 2019
Select a repo