Azure Pipelines/GitHub Actions用self-
hostedイメージを作ってみよう!
かめがわ かずし(kkamegawa)
自己紹介
personal:
name: かめがわ かずし
alias: kkamegawa
community:
MVP: Microsoft MVP for Developer Technologies(2009-)
UsersGroup: Team Foundation Server Users Group
URL: https://dev.azure.com/tfsug/tfsuginfo
Blog: はてなブログ
URL: https://kkamegawa.hatenablog.jp
devblog radio: https://devblog.connpass.com/
This contents based on 2020/12/17
ビルド時間を
早くしたい
ビルドマシン
作るの大変
最新版の
環境ほしい
Microsoft-Hostedでできないことおさらい
多コアCPUでビルドしたい(hostedは2 vCoreまで)
ビルド時10GB以上のディスクを使いたい
メモリをもりもり使ってビルドしたい
Preview版のソフトを使いたい
GPU使って機械学習のモデルを早く作りたい
自分用のAzure Pipelines
イメージほしいですよね?
必要なもの
Azureサブスクリプションで以下のVMが使えること
Windows : Standard_DS4_v2
Linux : Standard_DS2_v2
(変更してもいいけどそんなに変わらないかも)
スポットインスタンスには非対応(Packerの制限)
https://github.com/hashicorp/packer/issues/8776
GitHubのPackage RepositoryへアクセスできるPAT
準備
GitHub Actionsのレポジトリをクローン
https://github.com/actions/virtual-environments
GitHubのfeed read権限のPATを作成
https://docs.github.com/ja/free-pro-
team@latest/github/authenticating-to-github/creating-a-personal-
access-token
実行
git clone https://github.com/actions/virtual-environments.git
import-module .¥helpers¥GenerateResourcesAndImage.ps1
※:helpersフォルダーで実行
GenerateResourcesAndImage -SubscriptionId <SubscriptionID> -
ResourceGroupName <ResourceGroup> -
ImageGenerationRepositoryRoot <clone先> -ImageType <イメージ
タイプ> -AzureLocation <region名> -Githubfeedtoken <GitHubの
PAT>
失敗することもある
いっぱい失敗しました
失敗したらリトライしないほうがいい
Windowsだとつらいけど
ファイル上書きでなぜか失敗する(PowerShellとしてはい
けるはずなのに…)
VS拡張インストールでなぜかエラーが出て失敗する
単独で実行するとうまくいくのに🤔🤔
作ってみた
Ubuntu 20.04
必要時間:3h19m
必要ディスク:86GiB
Windows Server 2019
必要時間:4h59m(カスタム済み)
必要ディスク:256GiB
WindowsはVisual StudioやDockerイメージ大きく、不利
イメージ作った後は
VHDをダウンロードしてオンプレミスで使うもよし
Shared Image Galleryへ入れて、可用性スケールセット
作ってたくさん並べるもよし
azコマンド:
az sig image-definition create -g MyResourceGroup --gallery-name MyGallery --gallery-image-
definition MyImage --publisher GreatPublisher --offer GreatOffer --sku GreatSku --os-type linux
(windows)
Windowsのイメージ生成高速化
要らないコンポーネント削る
古いRuby/Python/Golang/.NET Core SDK…
※:toolset-2016/2019.jsonというファイルから消す
場合によっては対応するテストのps1ファイルも消す
特に.NET Core SDKはマイナー含めて全バージョンの
dotnet restoreやるのでかなりつらい
2.1/3.1/5.0最新版のSDKのみfetchするように変更した
https://github.com/tfsugjp/virtual-
environments/blob/55cd096b014c5ca25967266c5c7691271dfdfe87/images/win/script
s/Installers/Install-DotnetSDK.ps1#L75
あなたにも自分のイメージが楽に作れる…かも?

More Related Content

PDF
Azure DevOps's security
PDF
Azure Boards and Azure Test Plans inside out.
PDF
Azure DevOps Online Vol.3 - Inside Azure Pipelines
PDF
Azure DevOps入門~TechLab編
PDF
Azure boards for beginners
PDF
Introduce TFSUG and Azure DevOps Server 2020
PDF
DevOps and Compliance and Security
PDF
Azure DevOps Management in Organization
Azure DevOps's security
Azure Boards and Azure Test Plans inside out.
Azure DevOps Online Vol.3 - Inside Azure Pipelines
Azure DevOps入門~TechLab編
Azure boards for beginners
Introduce TFSUG and Azure DevOps Server 2020
DevOps and Compliance and Security
Azure DevOps Management in Organization

What's hot (20)

PDF
NET5 and Diagnostics
PPTX
What's new Azure DevOps in //Build 2019
PDF
Getting Start for Azure Pipelines
PDF
Deploy Strategy with Azure Pipelines
PPTX
Visual studioonlineとwebサイトで始めるci/cdの第一歩
PPTX
Deploy to Azure by ??? Azure Repos or GitHub
PDF
Azure DevOpsとセキュリティ
PDF
Ignite 2021 振り返り(DevOps)
PPTX
Static website + Piplelines
PDF
「何もしないのにCIが失敗した」を防ぐ
PDF
Azure DevOps と開発管理
PPTX
Azure DevOps ハンズオン Vo.3 ~Delivery Plans を用いたプロジェクトのスケジュール管理~
PDF
Introduction of Azure Docker Integration
PPTX
Azure DevOps で始めるスタートダッシュ
PPTX
AzureDevOpsの機能解説
PPTX
What's Azure DevOps
PDF
Visual studio online and Agile
PDF
PHPerだってサーバーレスしたい!
PDF
Azure DevOps 関西 2019 - Overview
PPTX
WebAssemblyとBlazor 、WebAssembly System Interfaceでコンテナライズの設計を解説
NET5 and Diagnostics
What's new Azure DevOps in //Build 2019
Getting Start for Azure Pipelines
Deploy Strategy with Azure Pipelines
Visual studioonlineとwebサイトで始めるci/cdの第一歩
Deploy to Azure by ??? Azure Repos or GitHub
Azure DevOpsとセキュリティ
Ignite 2021 振り返り(DevOps)
Static website + Piplelines
「何もしないのにCIが失敗した」を防ぐ
Azure DevOps と開発管理
Azure DevOps ハンズオン Vo.3 ~Delivery Plans を用いたプロジェクトのスケジュール管理~
Introduction of Azure Docker Integration
Azure DevOps で始めるスタートダッシュ
AzureDevOpsの機能解説
What's Azure DevOps
Visual studio online and Agile
PHPerだってサーバーレスしたい!
Azure DevOps 関西 2019 - Overview
WebAssemblyとBlazor 、WebAssembly System Interfaceでコンテナライズの設計を解説
Ad

Similar to How to create your own Azure Pipeline's image (7)

PDF
AzureDevOpsで作るHoloLensアプリCI環境
PDF
AKS+KEDAで実現!Container Functions Pipeline
PDF
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
PDF
Infrastructure as code for azure
PDF
GitHub Actions で CI/CD
PDF
S15 コマンドラインおよび API による Microsoft Azure の管理
PDF
ArcBox のおさらいと最新情報
AzureDevOpsで作るHoloLensアプリCI環境
AKS+KEDAで実現!Container Functions Pipeline
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
Infrastructure as code for azure
GitHub Actions で CI/CD
S15 コマンドラインおよび API による Microsoft Azure の管理
ArcBox のおさらいと最新情報
Ad

More from Kazushi Kamegawa (12)

PDF
Ignite 2021秋 recap - 開発者向け新機能紹介
PDF
DevOps and compliance and security
PDF
はじめてのコンテナーDocker & Windows & Linux
PPTX
その後のBash on windows
PDF
Windows10時代のクロスプラットフォーム開発
PDF
Cross Platform CI for Visual Studio Online
PDF
はじめてのTeam Foundation ServerとVisual Studio Online
PDF
トラブル発生、その時あなたがすることは?
PDF
PowerShell and Release Management Server
PDF
Application insights で行ってみよう
PDF
TypeScript And ALM
PDF
Planning Effective Test Plan
Ignite 2021秋 recap - 開発者向け新機能紹介
DevOps and compliance and security
はじめてのコンテナーDocker & Windows & Linux
その後のBash on windows
Windows10時代のクロスプラットフォーム開発
Cross Platform CI for Visual Studio Online
はじめてのTeam Foundation ServerとVisual Studio Online
トラブル発生、その時あなたがすることは?
PowerShell and Release Management Server
Application insights で行ってみよう
TypeScript And ALM
Planning Effective Test Plan

How to create your own Azure Pipeline's image