profile
viewpoint

Ask questionsInput scripts lose executable bit (Windows 10 Docker host, GitBash shell)

Bug Report

An input script does not run when referenced directly as path with a Windows 10 Docker host and GitBash shell. (Yes, I know that's a weird combination. Enterprise grade! 🙄 )

Steps to Reproduce

I'm following the (pretty nice) tutorial at https://concoursetutorial.com/basics/task-scripts/ .

  • run fly -t tutorial e -c task_show_uname.yml

Expected Results

The script executes and returns uname results.

Actual Results

The script does not run and it appears that the container can't even find the executable script.

I found that the script will run when it is passed to /bin/sh, like so:

run:
  path: /bin/sh
  args: [./task-scripts/task_show_uname.sh]

However, when the script is specified directly in path, it blows up.

$ fly -t tutorial e -c task_show_uname.yml
uploading task-scripts done
executing build 19 at http://localhost:8080/builds/19
initializing
running ./task-scripts/task_show_uname.sh"
Backend error: Exit status: 500, message: {"Type":"ExecutableNotFoundError","Message":"exec failed: container_linux.go:345: starting container process caused \"exec: \\\"./task-scripts/task_show_uname.sh\\\\\\\"\\\": stat ./task-scripts/task_show_uname.sh\\\": no such file or directory\"\n","Handle":"","ProcessID":"","Binary":""}

errored

I suspected that the executable bit was not getting set properly inside the container. I hacked the task YAML to do an ls -lsaFR, and you can see that indeed the script is not executable inside the container. However, look at the local ls results and see that the script does indeed have the executable bit set on my Windows host machine.

~/code/learn/concourse/concourse-tutorial/tutorials/basic/task-scripts (master)
$ fly -t tutorial e -c task_show_uname.yml
uploading task-scripts done
executing build 20 at http://localhost:8080/builds/20
initializing
running ls -lasFR
.:
total 12
     4 drwxr-xr-x    3 root     root          4096 Jun 17 16:09 ./
     4 drwxr-xr-x    3 root     root          4096 Jun 17 16:09 ../
     4 drwxr-xr-x    1 root     root          4096 Jun 17 16:09 task-scripts/

./task-scripts:
total 20
     4 drwxr-xr-x    1 root     root          4096 Jun 17 16:09 ./
     4 drwxr-xr-x    3 root     root          4096 Jun 17 16:09 ../
     4 -rw-rw-rw-    1 root     root            19 Jun 17 16:07 task_show_uname.sh
     4 -rw-rw-rw-    1 root     root           276 Jun 17 16:08 task_show_uname.yml
     4 -rw-rw-rw-    1 root     root           278 Jun 17 15:02 test.sh
succeeded

~/code/learn/concourse/concourse-tutorial/tutorials/basic/task-scripts (master)
$ ls -lasF
total 7
0 drwxr-xr-x 1 c5288637 1049089   0 Jun 17 11:02 ./
4 drwxr-xr-x 1 c5288637 1049089   0 Jun 17 11:47 ../
1 -rwxr-xr-x 1 c5288637 1049089  19 Jun 17 12:07 task_show_uname.sh*
1 -rw-r--r-- 1 c5288637 1049089 276 Jun 17 12:08 task_show_uname.yml
1 -rwxr-xr-x 1 c5288637 1049089 278 Jun 17 11:02 test.sh*

Additional Context

I want to be convinced to switch to Concourse (from Jenkins). This might help. ;)

Version Info

  • Concourse version: 5.3.0
  • Deployment type (BOSH/Docker/binary): Docker, per the Quickstart at https://concourse-ci.org/
  • Infrastructure/IaaS: (not sure this applies?)
  • Browser (if applicable): (Chrome?)
  • Did this used to work? Nope.
concourse/concourse

Answer questions vito

I think you'd be getting a different error if it were due to not having the executable bit. :thinking: It looks like it can't even find the file. Can you paste the task config you're executing?

Whether it has an executable bit shouldn't matter since you're running it with /bin/sh anyway.

It is weird that it seems to lose the bit though. We had a related issue fixed in v5.4.0: https://github.com/concourse/concourse/releases#v540-note-16 - but this doesn't seem to be the case here.

useful!
source:https://uonfu.com/
answerer
Alex Suraci vito @vmware Toronto, ON @concourse co-creator, pm, engineer
Github User Rank List