macOS 執行器

apple 驅動程式在由 Apple 的 container 工具提供的全新 Linux 虛擬機中執行每個作業。這是 macOS 上的預設驅動程式。

開始之前

  • 一部配備 Apple silicon 及 macOS 26 的 Mac。
  • Apple container 1.6.1 或更新版本。使用 container system start 啟動其服務。
  • 適用於 aarch64-apple-darwin 的 nerudo-runner 二進位檔。請參閱下載執行器。
  • 一個包含作業工具的 OCI 映像。請參閱準備作業映像。

執行器不會安裝或啟動 Apple container。

註冊及測試

  1. 輸入 nerudo-runner login --repo OWNER/REPO --name mac-ci --labels nerudo-ci。
  2. 取得擁有者或管理員的批准。請參閱註冊執行器。
  3. 輸入 nerudo-runner doctor --image IMAGE --cpus 4 --memory 8G。
  4. 確保每項檢查都顯示 ok 或 info。
  5. 輸入 nerudo-runner daemon --image IMAGE --cpus 4 --memory 8G --timeout 1800 --once。
  6. 在儲存庫中啟動一個 CI 作業。

使用 --once 的守護程序會執行一個作業,然後停止。在 Pipelines(管線)分頁上查看作業的日誌及結果。

把執行器作為服務運行

cf/nerudo-runner/scripts 中的 launchd.py 輔助程式會建立一個用戶 LaunchAgent。它在寫入服務檔案之前,會檢查狀態、運行環境及映像。

  1. 輸入 python3 cf/nerudo-runner/scripts/launchd.py prepare,並加上 cf/nerudo-runner/README-macos.md 中的選項。
  2. 查看所產生的 plist 檔案。
  3. 輸入 python3 cf/nerudo-runner/scripts/launchd.py install --plist PLIST。
  4. 輸入 python3 cf/nerudo-runner/scripts/launchd.py status --plist PLIST。

服務在失敗後會以 30 秒的間隔再次啟動。它的日誌會寫入 --logs-dir 目錄。

注意:plist 列明 Apple container 的真實路徑,其中包括其版本。Apple container 更新後,請再次準備及安裝服務。

準備作業映像

作業虛擬機有唯讀的根檔案系統。步驟只能在 /workspace 及 /tmp 中寫入。

  1. 在映像中安裝作業的工具:例如 Git、編譯器及套件管理器。
  2. 把工具快取設定為 /workspace 中的路徑,例如 CARGO_HOME=/workspace/.cache/cargo。
  3. 使用 container build 建置映像。
  4. 在服務中使用映像的摘要,而不是標記。

在此驅動程式上,/tmp 是記憶體檔案系統。/tmp 中的檔案會使用虛擬機的記憶體。

驅動程式詳情

  • 每部虛擬機都會獲得 --cpus 及 --memory。記憶體大小使用二進制單位:8G 即 8 GiB。
  • 工作區是主機目錄。它沒有大小限制。請在 Mac 上保留足夠的可用磁碟空間。
  • nerudo-runner status 顯示目前的作業、其虛擬機,以及其記憶體及 CPU 用量。

另請參閱排解執行器問題及執行器限制。