iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 18
0
Microsoft Azure

Azure 的自我修煉系列 第 18

Day18 Azure Pipelines服務

Azure Pipelines服務

Azure 出的 CI/CD 服務

取得裝載於雲端的 Linux、macOS 及 Windows 適用管線。建置 Web、傳統型和行動應用程式。部署到任何雲端或內部部署。使用 Pipelines 將您的組建和部署自動化,讓您花費較少時間在瑣碎的細節上,並花費較多時間在發揮創意上。

Azure Pipelines
https://ithelp.ithome.com.tw/upload/images/20200917/200726516ndiqutgEu.png

幾大特頂

  1. 任何語言、任何平台
  2. 容器和 Kubernetes
  3. 具備擴充能力
  4. 部署到任何雲端
  5. 免費提供開放原始碼
  6. 進階工作流程和功能
    https://ithelp.ithome.com.tw/upload/images/20200917/20072651kgjxiq3qzI.png

費用定價
https://ithelp.ithome.com.tw/upload/images/20200917/20072651I9htOd9QBQ.png

註冊與登入

點擊開始免費使用
https://ithelp.ithome.com.tw/upload/images/20200918/20072651TWGkgvw5S1.png

登入Azure帳號
https://ithelp.ithome.com.tw/upload/images/20200918/200726511GhhBC550V.png

選擇區域
https://ithelp.ithome.com.tw/upload/images/20200918/20072651t5fP8YDrXI.png

Azure DevOps 首頁
https://ithelp.ithome.com.tw/upload/images/20200918/20072651MDUaRCZKcU.png

官方文件 Azure Pipelines documentation

使用YAML檔案來管理

https://ithelp.ithome.com.tw/upload/images/20200917/20072651r0IzcGvfGd.png

使用介面來管理

https://ithelp.ithome.com.tw/upload/images/20200917/20072651Yyi3mg2OpL.png

安裝 Azure DevOps extension 外掛

官方文件說明
依據Create your first pipeline的文件,我們需要安裝DevOps外掛才能有指令可以使用。

安裝

az extension add --name azure-devops

顯示

az extension show --name azure-devops

https://ithelp.ithome.com.tw/upload/images/20200918/20072651XREJEJbSrb.png

Az Devops 指令

查看 devops 指令

az devops -h

https://ithelp.ithome.com.tw/upload/images/20200919/20072651E2218Pe7Te.png

查看 devops project 指令

az devops project -h

https://ithelp.ithome.com.tw/upload/images/20200918/20072651FQNob6HiD4.png

查看 devops project create 指令

az devops project create -h

https://ithelp.ithome.com.tw/upload/images/20200918/20072651fpT43OlUML.png

創建專案

專案名稱: pellok2002

az devops project create --name pellok2002

https://ithelp.ithome.com.tw/upload/images/20200918/20072651hActCEw3RR.png

設定預設專案
組織: https://dev.azure.com/pellok2020/
專案名稱: pellok2002

az devops configure --defaults organization=https://dev.azure.com/pellok2020/ project=pellok2002

創建 pipelines

查看 pipelines 指令說明

az pipelines -h

https://ithelp.ithome.com.tw/upload/images/20200918/20072651zZfQabpV5H.png

查看創建指令說明

az pipelines create -h 

https://ithelp.ithome.com.tw/upload/images/20200918/2007265137FQXSQNmT.png
https://ithelp.ithome.com.tw/upload/images/20200918/20072651WT4WcjDyAV.png
https://ithelp.ithome.com.tw/upload/images/20200918/200726513dus9N3l41.png

由上面的說明我們知道,來源程式碼可以重本地端來或是雲端主機
https://github.com/pellok/PellokITHomeAccount.git

az pipelines create --name "First-PipeLine" --description 'Pipeline for PellokITHomeAccount' --repository https://github.com/pellok/PellokITHomeAccount.git --branch master --repository-type github

https://ithelp.ithome.com.tw/upload/images/20200918/20072651Jjd4ijichc.png

以上創建的過程會採用互動式提問與回答

  1. 首先會要求你登入GitHub (Enter your GitHub username)
  2. 請你輸入Service Connection Name (Enter a service connection name to create?)
  3. 詢問你的服務是哪一個類型(Which template do you want to use for this pipeline?)
  4. 請問你是否有自己的template yaml (Do you want to view/edit the template yaml before proceeding)
  5. 延續上面如果沒有自己的yaml會幫你創建一個,可以查看GitHub是否有一個 azure-pipelines.yml 檔案

查看 azure-pipelines.yaml

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

https://ithelp.ithome.com.tw/upload/images/20200918/20072651LnDavftYtw.png

Yaml 的語法官方說明: Azure Pipelines YAML schema reference

查看介面
https://ithelp.ithome.com.tw/upload/images/20200918/20072651n2Ac1NL4P3.png

相關連結:

上一篇 Day17 實作 Identity ASP.NET Core
下一篇 Day19 Azure Pipelines服務 YAML 說明與設定


上一篇
Day17 實作 Identity ASP.NET Core
下一篇
Day19 Azure Pipelines服務 YAML 說明與設定
系列文
Azure 的自我修煉30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言