GitHub Actions 自托管运行器因奇怪错误而关闭

问题描述 投票:0回答:1

我的 GitHub 运行程序随机关闭并出现以下错误:

自托管运行器:default-6bbn8-hw2mr 与服务器失去了通信。验证计算机正在运行并且网络连接正常。工作流程中终止运行程序进程、使其 CPU/内存不足或阻止其网络访问的任何操作都可能导致此错误。

正在运行的代码所拥有的资源肯定低于运行器可以提供的资源!

在网上找不到任何有用的信息。任何建议都会有帮助。

continuous-integration github-actions
1个回答
0
投票

此错误是由于CPU/内存已满引起的。您可以在运行前清除缓存。这是 Node.js 的示例:

name: Node.js CI/CD
on:
  push:
    branches: [ "main" ]

jobs:
  build:
    runs-on: self-hosted
    strategy:
      matrix:
        node-version: [20.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          cache: 'npm'
      - name: Clean npm cache
        run: npm cache clean --force
      - run: npm ci
      # - run: npm run build --if-present
      # - run: npm test
© www.soinside.com 2019 - 2024. All rights reserved.