管道因“劫持:后端错误”而失败

Pipeline fails due to `hijack: Backend error`

我正在学习 Stark & Wayne 教程,但遇到了问题:

管道失败

hijack: Backend error: Exit status: 500, message {"Type":"","Message": "
runc exec: exit status 1: exec failed: container_linux.go:247:
starting container process caused \"exec format error\"\n","Handle":""}

我有一项 git 资源和一项任务的工作:

- task: test
  file: resource-ci/ci/test.yml

test.yml 文件:

platform: linux

image_resource:
  type: docker-image
  source:
    repository: busybox
    tag: latest

inputs:
- name: resource-tool

run:
  path: resource-tool/scripts/deploy.sh

deploy.sh 是一个简单的虚拟文件,带有一个 echo 命令

echo [+] Testing in the process ...

那会是什么呢?

此错误意味着 shell 它试图在您的脚本中调用的容器在您的任务 运行 上不可用。

Busybox 没有 bash,它只带有 /bin/sh,检查 deploy.sh 中的 shebang,确保它看起来像:

#!/bin/sh
# rest of script

当我忘记在管道 shell 脚本的顶部添加 ! 时,我也 运行 遇到了这个错误:

#/bin/bash
# rest of script