Gitlab ci , How do I run a shell file? run .sh file in gitlab-ci

Problem to solve

How should I run .sh files? I look up a lot of information that is supported, but I really don’t have it, the path is correct,

Steps to reproduce

Which troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?




GitLab 企业版 17.2.0-pre 069b00f3964


Are you sure your shell interpreter is found if you’re running on alpine? I’m doing AWS stuff, so I’m using:

then my pipeline looks like:

  stage: do_the_thing
    - bash ./  

chmod a+rwx makes the file world writable and executable, and can become a security problem. Suggest changing that to chmod +x ... in case the flag is not persisted in the Git repository.

The error message reads like the script is trying to execute itself again in line 159. Can you show the content of the script itself?

I mean I can’t be sure, but given the script is 221 bytes, it’s unlikely to have 159 lines. :slightly_smiling_face:

It could download another script using curl, and run eval/execute. I’d like to see the content to verify my assumptions :slight_smile: