linux - 如何让 Concourse Linux 机器读取可执行文件? (chmod 样式)

标签 linux bash shell continuous-integration concourse

我正在尝试让我的 Concourse CI Linux VM 运行 shell 脚本。但我不断收到同样的错误:

enter image description here

我使用 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 +xed。你将很难在 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/

相关文章:

Bash 从另一个终端捕获击键

c - 使用 fork/execvp 在 C 中编写一个简单的 shell

linux - 如何在 shell 脚本中将多个 shell 变量传递给 awk?

linux - .htaccess mod_rewrite 用于 web 服务以及隐藏其他文件

do while 第一次后无法输入

linux - 当 NFS 安装停止时,bash 检查目录是否存在挂起

linux - 如何通过字符串组装变量

linux - 将 find -execdir 与 grep 结合使用

c - ALSA "default"与 "hw:0,0"

Linux shell 脚本 : How can I remove initial numbers in a word list file?