ERROR: script returned exit code 1

Hi, Guys

I’m running jenkins of my k6 browser project but I encountered an error after build.

Obtained Jenkinsfile from git https://bitbucket.org/legalmatch/loadtest-k6/src/
[Pipeline] Start of Pipeline
[Pipeline] node
Running on aut1 in /home/jenkins/workspace/Performance/loadtestk6
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: NONE
Fetching changes from the remote Git repository
Cleaning workspace
 > git rev-parse --resolve-git-dir /home/jenkins/workspace/Performance/loadtestk6/.git # timeout=10
 > git config remote.origin.url https://bitbucket.org/
 > git rev-parse --verify HEAD # timeout=10
Resetting working tree
 > git reset --hard # timeout=10
 > git clean -fdx # timeout=10
Fetching upstream changes from https://bitbucket.org/
 > git --version # timeout=10
 > git --version # 'git version 2.7.4'
using GIT_ASKPASS to set credentials jenkins-bitbucket-app-password
 > git fetch --tags --progress https://bitbucket.org/
+refs/heads/*:refs/remotes/origin/* # timeout=10
Checking out Revision fbe65636c069e63128f608e0e643dbf610993877 (refs/remotes/origin/AUT-3626)
Commit message: "jenkins file update"
 > git rev-parse refs/remotes/origin/AUT-3626^{commit} # timeout=10
 > git config core.sparsecheckout # timeout=10
 > git checkout -f fbe65636c069e63128f608e0e643dbf610993877 # timeout=10
 > git rev-list --no-walk 723778f21ce158b00d850fe6a590ae59f74aaa73 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Performance Testing)
[Pipeline] echo
Installing k6
[Pipeline] sh
+ sudo set +e chmod +x setup_k6.sh
sudo: no tty present and no askpass program specified
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

Hi there!

I would assume the issue is with this:

+ sudo set +e chmod +x setup_k6.sh
sudo: no tty present and no askpass program specified

I’m not sure why you would need sudo in your CI pipeline, but the shell used in CIs is not interactive, i.e. it’s not a tty. Since sudo requires user input for a password, you get that error.

I would advise you to not use sudo in CI, or, if you must for some reason, configure the sudoers file to not require a password for whatever account or program you need.

This is off-topic for a k6 forum, so please look elsewhere for help. There are plenty of resources online that explain what to do in this case.

2 Likes