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?
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 commands. Lightweight (alpine, busybox) has less sh commands.
source: {repository: ubuntu}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With