I am trying to get my Concourse CI Linux VM to run a shell script. But i keep getting the same error:
I fixed this locally (non VM, on a Mac) with chmod +x path/filename.sh to make it executable and adding !#/bin/sh to the shell script.
But i dont know how to get Concourse/VM to know that it’s an executable? Is there a chmod command i should put into the task.sh? or the task.yml? Help!
my 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
My task.yml:
---
platform: linux
image_resource:
type: docker-image
source: {repository: busybox}
inputs:
- name: my-task
run:
path: ./my-task/task.sh
My task.sh:
!#/bin/sh echo this is my task shell script
I expected this to just echo/log out the string above.
Instead i get the 500/permission denied error at the top.
Advertisement
Answer
The file in the git repo has to be chmod +xed. You’re gonna have a hard time doing that in a Gist, since that can’t be set in the UI.
You could clone the gist, chmod +x, and re-push, or change your task to run bash my-task/task.sh instead, which won’t require it to be executable:
run: path: bash args: [./my-task/task.sh]
