Upgrade to Pro — share decks privately, control downloads, hide ads and more …

self-hosted runnerと actions/cache の噛み合わせが悪かった件 #githubactionsmeetup

whywaita
September 25, 2023

self-hosted runnerと actions/cache の噛み合わせが悪かった件 #githubactionsmeetup

whywaita

September 25, 2023
Tweet

More Decks by whywaita

Other Decks in Technology

Transcript

  1. Nakanishi Kento / whywaita • 株式会社サイバーエージェント 2019新卒 • 業務: CAグループ向けプライベートクラウド開発

    • GitHub Actions ベースCIサービス 
 (Managed myshoes) PM • 社内向け IaaS 開発者 • 趣味: ポーカー / XREAL Air / ⾃宅インフラ ISUCON本買ってね! #isucon →
  2. self-hosted runner • ↔ GitHub-hosted runner • ⾃前のインフラでrunner起動するやつ • ⾃宅

    社内サーバ プライベートクラウド... • ネットワーク CPU メモリなど嬉しい要素 6
  3. [PR] whywaita/myshoes • Auto-scaling VirtualMachine runner 🏃 for GitHub Actions

    • 様々なクラウドでrunnerを作成可能 • https://github.com/whywaita/myshoes 7
  4. [PR] 規模感 • Stadium台数: 約80台 ( 1 6 c 160

    gb) • 導⼊数: エンジニアの50% が利⽤! • アカウント数ベース • Linux版GAから: 1年8ヶ⽉ • 1⽇の実⾏job数: 約1万個 • 常時500〜700インスタンスぐらい 12
  5. GitHub owned by Microsoft • GitHub Actionsのバックエンドは 
 (現状)ほぼAzure Pipelines

    • 関連サービスもAzureの製品を⽤いて実装 されている(ことが多い) 15
  6. GitHub owned by Microsoft trigger: - main pool: vmImage: 'ubuntu-latest'

    steps: - task: Maven@4 inputs: mavenPomFile: 'pom.xml' mavenOptions: '-Xmx3072m' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' 16 https://learn.microsoft.com/ja-jp/azure/devops/pipelines/customize-pipeline?view=azure-devops
  7. GitHub owned by Microsoft • (whywaita 調べ) • GitHub Actionsのバックエンドは

    
 (現状)ほぼAzure Pipelines • 関連サービスもAzureの製品を⽤いて実装 されている(ことが多い) 18
  8. GitHub owned by Microsoft • (whywaita 調べ) • GitHub Actionsのバックエンドは

    
 (現状)ほぼAzure Pipelines • 関連サービスもAzureの製品を⽤いて実装 されている(ことが多い) 19
  9. actions/cache internal • actions/cache は Azure Blob storage • それっぽい機能が実装されている

    • CDNっぽく配信するとか • GETしたら Lifecycle 伸ばすとか 20
  10. actions/cache internal • GitHub Cache API (仮称) • 各種情報を確認しているのでは?と推測 •

    リポジトリ毎の保存ファイル容量 • アクセス状態 • etc etc... 25
  11. - name: Cache Primes id: cache-primes uses: actions/cache@v3 with: path:

    prime-numbers key: ${{ runner.os }}-primes 26
  12. - name: Cache Primes id: cache-primes uses: actions/cache@v3 with: path:

    prime-numbers key: ${{ runner.os }}-primes 32 同じcon fi gが利⽤可能
  13. actions/cache internal 33 🏠 self-hosted Azure blob storage GitHub Cache

    API GitHub-hosted Azure blob storage GitHub Cache API
  14. actions/cache internal 34 GitHub-hosted Azure blob storage GitHub Cache API

    self-hosted Azure blob storage GitHub Cache API 同じ or 近い
  15. actions/cache internal 35 GitHub-hosted Azure blob storage GitHub Cache API

    self-hosted Azure blob storage GitHub Cache API 遠い
  16. @actions/cache (= library) • ライブラリとして内部的に組み込み可能 • actions/setup-go@v 4 • Dependency

    cache is default enable • ruby/setup-ruby • rubyのキャッシュが難しく当初より実装 38
  17. Backend as a Amazon S 3 • S 3 などオブジェクトストレージをバックエンドに

    
 利⽤したCustom Actionを作る案 • actions/cache に求める物がシンプルならこれでOK • 設定が煩雑になりがち • 各リポジトリごとに AWS_ACCESS_ID 書いたり 41
  18. Backend as a Amazon S 3 • https://github.com/whywaita/actions-cache-s 3 


    作ってます (ました) • 社内オブジェクトストレージをバックエンドに採⽤ • 課題もいくつかあり • 設定の煩雑性 • GET時にLifecycleを伸ばす機能がS 3 にない 42
  19. BuildJet cache • BuildJet: self-hosted runner 会社 • buildjet/cache@v 3

    • バックエンドはCloud fl are R 2 • buildjet/setup-go などを完備 43