Facing Issues with Jenkins Pipeline - "ERROR: script returned exit code 1

Hello Everyone,

I’ve been working on a CI/CD pipeline using Jenkins and recently encountered a perplexing error during the build stage. Whenever I try to execute my shell script, I’m greeted with the following error message:

ERROR: script returned exit code 1

Here’s a snippet of my Jenkinsfile:

stage('Build') {
    steps {
        sh './build.sh'

I’ve ensured that build.sh has executable permissions, and it runs without any issues locally on my machine. I’ve followed the guidelines from this Jenkins documentation - https://www.jenkins.io/doc/book/pipeline/syntax/devops, but I’m still running into this error. Is there something specific to Jenkins that I might be overlooking? Any guidance on what could be causing this error and how to resolve it would be greatly appreciated!

Thanks in advance for your help.

Hi Emma,

Looks like the script itself has an error. Can you try executing the script on the agent without the pipeline?