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

GitHub Actions Runner 빌드 실전 적용기

kakao
December 08, 2022

GitHub Actions Runner 빌드 실전 적용기

#GithubActions #ArgoCD #CI/CD #KIC #Docker #Container

GitHub Actions Runner를 카카오엔터프라이즈 환경에 맞춰 적용하며 발생했던 이슈들과 그에 따른 Runner 환경 개선 사항들에 대해서
소개하고자 합니다.

발표자 : miguel.lee
카카오엔터프라이즈 기슬플랫폼팀 미겔입니다. 전사공통 DevOps 체계를 만들고 있습니다.

kakao

December 08, 2022
Tweet

More Decks by kakao

Other Decks in Programming

Transcript

  1. ੉୍࢚ miguel.lee ஠஠য়ূఠ೐ۄ੉ૉ GitHub Actions Runner ࠽٘ प੹ ੸ਊӝ if(kakao)2022

    Copyright 2022. Kakao Corp. All rights reserved. Redistribution or public display is not permitted without written permission from Kakao.
  2. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ ೱറ ҅ദ
  3. GitHub ੉ҙ ୨ ੉ҙ ؘ੉ఠ ௼ӝ : 185 GB ୨

    ੉ҙ Org ѐࣻ : 172 ѐ ୨ ੉ҙ Repo ѐࣻ : 6,384 ѐ
  4. ஠஠য়ਕ௼ kakaowork ஠஠য় i ௿ۄ਋٘ kakao i cloud ஠஠য় i

    ۄझ kakao i LaaS ஠஠য় i ழ֏౟ ࣃఠ kakao i connect Center ஠஠য় i ழ֏౟ స kakao i connect Talk ஠஠য় i ழ֏౟ ࠺ૉݫࣁ૑ kakao i connect Biz Message ஠஠য় i ழ֏౟ ۄ੉࠳ kakao i connect Live ׮নೠ ജ҃
  5. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ Wrap up ߂ ೱറ ҅ദ
  6. Windows Virtual Machine Docker Linux MacOS GitHub Actions Runner VM

    or Docker GitHub Actions Runner - п Workflow ݃׮ زੌೠ ജ҃ ࠁ੢
  7. Virtual Machine Docker GitHub Actions Runner - п Workflow ݃׮

    زੌೠ ജ҃ ࠁ੢ - ࠽٘ द ܻࣗझ ಩ૐ ઁয Linux MacOS GitHub Actions Runner VM or Docker Windows
  8. Virtual Machine Docker GitHub Actions Runner - п Workflow ݃׮

    زੌೠ ജ҃ ࠁ੢ - ࠽٘ द ܻࣗझ ಩ૐ ઁয - ೙ਃী ٮۄ ۞ց झாੌ݂ оמ೧ঠ ೣ Linux MacOS GitHub Actions Runner VM or Docker Windows
  9. Docker GitHub Actions Runner Linux MacOS Virtual Machine kakao i

    cloud GitHub Actions Runner Runner in Docker Windows
  10. Runner in Docker GitHub Actions Runner Docker GitHub Actions Runner

    Linux MacOS Virtual Machine kakao i cloud Windows
  11. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ ೱറ ҅ദ
  12. GitHub Events Workflows Jobs Steps Docker in Docker vs Docker

    Out of Docker ੌ߈੸ੋ Workflow GitHub Actions Runner
  13. GitHub Events Docker in Docker vs Docker Out of Docker

    Containers in Workflows Workflows Jobs Steps GitHub Actions Runner
  14. jobs: build-and-test: runs-on: k8s container: image: [IMAGE] services: redis: image:

    [REDIS_IMAGE] ports: - 6379 Docker in Docker vs Docker Out of Docker Containers in Workflows
  15. jobs: build-and-test: runs-on: k8s container: image: [IMAGE] services: redis: image:

    [REDIS_IMAGE] ports: - 6379 Docker in Docker vs Docker Out of Docker Containers in Workflows container: image: [IMAGE]
  16. Docker in Docker vs Docker Out of Docker Containers in

    Workflows jobs: build-and-test: runs-on: k8s container: image: [IMAGE] services: redis: image: [REDIS_IMAGE] ports: - 6379 services: redis: image: [REDIS_IMAGE] ports: - 6379
  17. Docker in Docker vs Docker Out of Docker Containers in

    Workflows jobs: build-and-test: runs-on: k8s container: image: [IMAGE] services: redis: image: [REDIS_IMAGE] ports: - 6379
  18. Docker in Docker vs Docker Out of Docker Containers in

    Workflows jobs: build-and-test: runs-on: k8s container: image: [IMAGE] services: redis: image: [REDIS_IMAGE] ports: - 6379
  19. Docker in Docker Docker in Docker vs Docker Out of

    Docker Docker Host Create Runner Container Job Container Job Container %PDLFS Create Create (JU)VC"DUJPOT3VOOFS
  20. Docker in Docker vs Docker Out of Docker ੌ߈੸ੋ ਕ௼೒۽਋

    ೡ׼ Docker Host Create Runner Container %PDLFS Workflows Jobs Steps File System Mount (JU)VC "DUJPOT 3VOOFS
  21. Docker in Docker vs Docker Out of Docker ஶప੉ցо ҳزغח

    ਕ௼೒۽਋ ೡ׼ Docker Host Create Runner Container Job Container1 %PDLFS Workflows Jobs Steps Job Container2 Create Create File System Mount ??? (JU)VC "DUJPOT 3VOOFS
  22. var initProcessCgroup = File.ReadLines(“/proc/1/cgroup”); if (initProcessCgroup.Any{x => x.IndexOf(“:/docker/”, StringComparison.OrdinalIgnoreCase) >=

    0}) { throw new NotSupportedException(“Container feature is not supported when runner is already running inside container.”); } Docker in Docker vs Docker Out of Docker Early container in GitHub Actions Runner
  23. Docker in Docker vs Docker Out of Docker Early container

    in GitHub Actions Runner var initProcessCgroup = File.ReadLines(“/proc/1/cgroup”); if (initProcessCgroup.Any{x => x.IndexOf(“:/docker/”, StringComparison.OrdinalIgnoreCase) >= 0}) { throw new NotSupportedException(“Container feature is not supported when runner is already running inside container.”); } Docker in docker ૑ਗೞ૑ ঋ਺
  24. Docker in Docker vs Docker Out of Docker Docker Out

    of Docker Docker Host Create Create Runner Container %PDLFS Mount Job Container Job Container Create Create (JU)VC"DUJPOT3VOOFS
  25. Docker in Docker vs Docker Out of Docker Docker Host

    3VOOFS Create Runner Container Job Container %PDLFS Create Create DinD (Docker in Docker) Docker Host 3VOOFS Create Create Runner Container %PDLFS Mount Job Container Create DooD (Docker out of Docker)
  26. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ ೱറ ҅ദ
  27. Docker Host Create Create Runner Container %PDLFS Mount Job Container1

    Job Container2 Create Create exit code 137 2ѐ੄ Job Container प೯ प೯઺ प೯઺ (JU)VC"DUJPOT3VOOFS
  28. public override void Initialize(IHostContext hostContext) { … _binPath = HostContext.GetDirectory(WellKnownDirectory.Bin);

    Trace.Info(“binPath: {0}”, _binPath); RootFolder = HostContext.GetDirectory(WellKnownDirectory.Root); Trace.Info(“RootFolder: {0}”, _RootFolder); … } exit code 137 initialize runner
  29. public class DockerCommandManager : RunnerService, IDockCommandManager { … public override

    void Initialize(IHostContext hostContext) { base.Initialize(hostContext); DockerPath = WhichUtil.Which(“docker”, true, Trace); DockerInstanceLabel = IOUtil.GetSha256Hash(hostContext.GetDirectory(WellKnownDirectory.Root)).S ubstring(0, 6); } } exit code 137 DockerCommandManager - Initialize DockerInstanceLabel = IOUtil.GetSha256Hash(hostContext.GetDirectory(WellKnownDirectory.Root)).S ubstring(0, 6);
  30. exit code 137 زੌೠ بழ ੋझఢझ ۨ੉࠶ Docker Host Create

    Create Runner Container %PDLFS Mount Job Container1 Job Container2 Create Create प೯઺ प೯઺ label=60e226 (JU)VC"DUJPOT3VOOFS
  31. exit code 137 Clean up Docker Host Create Create Runner

    Container %PDLFS Mount Job Container1 Job Container2 Create Create प೯઺ प೯઺ label=60e226 (JU)VC"DUJPOT3VOOFS
  32. Docker Host Create Create Runner Container %PDLFS Mount Job Container1

    Job Container2 Create Create प೯઺ label=60e226 exit code 137 ஶప੉ց ъઁ ઙܐ ߊࢤ ъઁઙܐ (JU)VC"DUJPOT3VOOFS
  33. Docker Host Create Create Runner Container %PDLFS Mount Job Container1

    Job Container2 Create Create प೯઺ प೯઺ unique_pod_name exit code 137 RUNNER_BINDIR ч ߸҃ RUNNER_BINDIR = RUNNER_BINDIR = unique_pod_name (JU)VC"DUJPOT3VOOFS
  34. Docker Host Create Create Runner Container %PDLFS Mount Job Container1

    Job Container2 Create Create प೯઺ प೯઺ fd26bd exit code 137 RUNNER_BINDIR ч ߸҃ RUNNER_BINDIR = RUNNER_BINDIR = 0cab5a (JU)VC"DUJPOT3VOOFS
  35. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ ೱറ ҅ദ
  36. 2022.1ਘ GitHub Actions بੑ GitHub 3.3.x ߡ੹ 2202.8ਘ GitHub 3.6-RC

    Release 2022.8ਘ GitHub 3.5.3 Upgrade 9ਘ kep-actions/cache ҳഅ GitHub Custom Actions ҳഅ ߡ੹ ఋ੐ۄੋ
  37. Workflow A jobs: [JOB_NAME]: steps: - name: Gradle cache uses:

    kep-actions/cache@v1 id: cache with: path: | ~/.gradle/caches GitHub Custom Actions ҳഅ kep-actions/cache
  38. 2. ࠽٘நद ؘ੉ఠ ੷੢ 3. ؘ੉ఠ ࠂਗ 1. ૑੿ػ ঘ࣌

    ࢎਊ 4. ࠽٘ ࣘب ѐࢶ GitHub Custom Actions ҳഅ kep-actions/cache object storage 2. ࠽٘நद ؘ੉ఠ ੷੢ kakao i cloud File Storage minio GitHub Enterprise Workflow A
  39. Workflow A 5࠙ kep- actions/ cache GitHub Custom Actions ҳഅ

    kep-actions/cache object storage kakao i cloud File Storage minio GitHub Enterprise
  40. GitHub ੉ҙҗ ׮নೠ ജ҃ GitHub Actions ӒܻҊ GitHub Actions Runner

    Docker in Docker vs Docker Out of Docker exit code 137 GitHub Custom Actions ҳഅ ೱറ ҅ദ