Tech Stand #9 GitHubにてお話しした際の資料です。 https://standfm.connpass.com/event/256786/
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectric田中 裕一 (@yuichielectric)How GitHub usesCodespaces
View Slide
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectric田中 裕一GitHub、シニアソリューションズエンジニア個人で「システム運用アンチパターン」(オライリー・ジャパン)の翻訳を担当@yuichielectric
Codespacesクラウド上の開発環境妥協のないコーディング体験ブラウザから、コーディング、ビルド、テスト、デバッグ、デプロイが可能な完全な開発環境にアクセス。ワークフローをシンプルに依存関係やSSHキーを自動でセットアップ。あらゆるプロジェクトでコーディングを開始できるまでの時間を短縮。カスタマイズ可能dotfileによるエディタの設定やすべてのCodespace環境にあらかじめインストールしておくVS Code拡張の指定など
{"name": "Go","build": {"dockerfile": "Dockerfile","args": {"VARIANT": "1-bullseye",}},"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],"settings": {"go.toolsManagement.checkForUpdates": "local","go.useLanguageServer": true,"go.gopath": "/go","go.goroot": "/usr/local/go"},"extensions": ["golang.Go"],"forwardPorts": [8080],"postCreateCommand": "go version","remoteUser": "vscode"}https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/devcontainer.json名前コンテナの指定Visual Studio Codeの設定Visual Studio Code拡張フォワードするポート環境作成後コマンド実行ユーザーコンテナ実行時パラメータ.devcontainer/devcontainer.json
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricGitHub社内での標準の開発環境github/github:コミット数100万以上、サイズは13GB以上Codespaces以前各エンジニアのmac上に開発環境を構築。すべてスクリプト化されてはいたものの、環境構築には半日かかっていた。Codespaces以後github/githubの環境を10秒で用意ブランチ切り替えの必要なしVS Codeユーザー以外からもSSHhttps://github.blog/jp/2021-08-30-githubs-engineering-team-moved-codespaces/
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricコンテナイメージベースイメージ用のリポジトリを作り、Actionsで、イメージをビルドしPackagesにpushプリビルドgithub/githubのmainへのマージのたびにCodespaces環境をビルド環境32コア、64GBメモリのマシンサイズのみを使うように設定https://docs.github.com/ja/codespaces/prebuilding-your-codespaces/about-github-codespaces-prebuildsCodespace環境のビルド
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricCodespaceのビルド(プリビルドも含む)は複数リポジトリにも対応関連するリポジトリに対しての権限を要求した上で、プリビルド環境を構築後に必要なリポジトリを取得してセットアップhttps://github.blog/changelog/2022-07-28-prebuilding-codespaces-is-now-supported-for-multi-repository-and-monorepo-projects/複数リポジトリ
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricVPNのセットアップをfeaturesを使って共通化。プロジェクトごとに必要に応じて利用。その他の手段として、ローカルマシンを、Codespaceとプライベートリソースへのゲートウェイとして使うことも可能。GitHub CLI拡張としてプレビュー公開。https://github.com/github/gh-netプライベートリソースへのアクセス
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricCodespaces環境に単機能を追加するプロセスを定義するための仕組み例● GitHub CLI● Ruby● SSHサーバ独自のfeatureを定義することも可能。devcontainers/feature-templatefeatures
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricCodespacesの別の側面
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricドキュメント担当以外のメンバーがGitHubのドキュメントに間違いを見つけた場合であっても、devcontainer.jsonがあれば、Codespace上でドキュメントを修正して、プレビューを確認後にPullRequestを送るというプロセスが容易になる。チームの垣根を超えたコントリビュート
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectric社内の多くのリポジトリでCodespacesの設定をしておくことでチームの壁を超えたコントリビュートの敷居を低減プリビルドを積極的に使うことで迅速に開発環境を構築CodespacesはGitHub社内での標準開発環境その過程で生み出された機能をCodespacesに組み込みまとめ
2022/08/31How GitHub uses CodespacesTech Stand #9@yuichielectricThank you