1

I am trying to get my Concourse CI Linux VM to run a shell script. But i keep getting the same error:

enter image description here

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.

Aid
  • 197
  • 2
  • 7

1 Answers1

3

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]
Alex Suraci
  • 841
  • 5
  • 9
  • Thanks @alexsuraci yeah i ended up fixing by cloning the gist, adding a new file locally, chmod'ing it, then pushing it. Worked straight away. – Aid Dec 06 '17 at 15:50
  • You can also use `git update-index --chmod=+x task.sh` to change the `chmod` state, or automate that as [described in this answer](https://stackoverflow.com/q/14267441/1262901). – Fabian Kleiser Dec 06 '17 at 20:38