javascript - How come .sh shell scripts work in Concourse tutorial but NOT in my actual codebase? - Stack Overflow

Very much a newbie to CI system setup, so please be gentle :)I'm following a Stark And Wayne tutor

Very much a newbie to CI system setup, so please be gentle :)

I'm following a Stark And Wayne tutorial & trying to get a Concourse CI task yml to run a shell script that it finds via the input folder:

task.yml

---
platform: linux

image_resource:
  type: docker-image
  source: {repository: busybox}

inputs:
- name: my-input-folder

run:
  path: ./my-input-folder/my-shell-script.sh

So when i run:

fly --target team-name execute --config task.yml -i my-input-folder=my-input-folder

It should go into that folder, action my-shell-script.sh and echo the this is working that's in there.

Instead i get:

hijack: Backend error: Exit status: 500, message: {"Type":"","Message":"runc exec: exit status 1: exec failed: container_linux.go:264: starting container process caused \"exec: \\\"./__tests__/this-is-my-shell-script.sh\\\": permission denied\"\n","Handle":""}

I get this is something to do with the docker/busybox image, from this other thread.

But...

a) why does it work with the same .sh extension and busybox image on their tutorial? (but then not when i use it on my actual project?)

b) how can i resolve this so that my project is running shell scripts? Which docker image would work?

Very much a newbie to CI system setup, so please be gentle :)

I'm following a Stark And Wayne tutorial & trying to get a Concourse CI task yml to run a shell script that it finds via the input folder:

task.yml

---
platform: linux

image_resource:
  type: docker-image
  source: {repository: busybox}

inputs:
- name: my-input-folder

run:
  path: ./my-input-folder/my-shell-script.sh

So when i run:

fly --target team-name execute --config task.yml -i my-input-folder=my-input-folder

It should go into that folder, action my-shell-script.sh and echo the this is working that's in there.

Instead i get:

hijack: Backend error: Exit status: 500, message: {"Type":"","Message":"runc exec: exit status 1: exec failed: container_linux.go:264: starting container process caused \"exec: \\\"./__tests__/this-is-my-shell-script.sh\\\": permission denied\"\n","Handle":""}

I get this is something to do with the docker/busybox image, from this other thread.

But...

a) why does it work with the same .sh extension and busybox image on their tutorial? (but then not when i use it on my actual project?)

b) how can i resolve this so that my project is running shell scripts? Which docker image would work?

Share Improve this question asked Dec 4, 2017 at 13:01 AidAid 1972 silver badges7 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

I found out through colleagues this error was due to:

a) needing to chmod +x folder/name-of-file.sh so it's an executable file.

and

b) Adding in the #!/bin/sh to the beginning of my .sh file (as i'm using oh-my-zsh). Though i gather if i were using bash, this would be #!/bin/bash.

Now the shell script links fine.

I changed image to ubuntu image and it worked, but alpine is not working too. Ubuntu is more fat and has more initial sh mands. Lightweight (alpine, busybox) has less sh mands.

source: {repository: ubuntu}

a) since it was created in there git it runs fine as permission is set in there files. when you modify it or created a new file it does not work as permission is changed. I assume that you are using a windows machine.

b) the solution is to change the git index permission git update-index --chmod=+x /path/to/file. If you change only the files local permission it might work since you are trying to run a one-off task but will give you plications once you start using concourse git resource that you will encounter further down the tutorial

refer https://github./concourse/concourse/issues/2161

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745471784a4629166.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信