我正在尝试让我的 Concourse CI Linux VM 运行 shell 脚本。但我不断收到同样的错误:
我使用 chmod +x path/filename.sh
在本地(非 VM,在 Mac 上)修复了此问题,使其可执行并添加了 !#/bin/sh
到 shell 脚本。
但我不知道如何让 Concourse/VM 知道它是一个可执行文件?有没有我应该放入 task.sh 的 chmod 命令?还是 task.yml?帮助!
我的 Concourse CI pipeline.yml
resources:
- name: my-git-repo
type: git
source:
uri: git@github.com:org-name/my-git-repo.git
branch: master
private_key: {{git-private-key}}
- name: my-task
type: git
source:
uri: git@gist.github.com:blahblahblah12345678910blah.git
private_key: {{git-private-key}}
jobs:
- name: job-build-app
plan:
- get: my-git-repo
trigger: true
- get: task
- task: run-build
file: my-task/task.yml
我的task.yml
:
---
platform: linux
image_resource:
type: docker-image
source: {repository: busybox}
inputs:
- name: my-task
run:
path: ./my-task/task.sh
我的task.sh
:
!#/bin/sh
echo this is my task shell script
我希望这只是回显/注销上面的字符串。
相反,我在顶部收到 500/permission denied 错误。
最佳答案
git repo 中的文件必须被 chmod +x
ed。你将很难在 Gist 中做到这一点,因为它不能在 UI 中设置。
您可以克隆要点,chmod +x
,然后重新推送,或者更改您的任务以运行 bash my-task/task.sh
,这样就成功了' 要求它是可执行的:
run:
path: bash
args: [./my-task/task.sh]
关于linux - 如何让 Concourse Linux 机器读取可执行文件? (chmod 样式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47650709/