Build failed when starting command shell from Jenkins

I call a shell script to create the source code through the jenkins "Invoke Shell" option. My command is as follows:

export PATH=$PATH:/usr/bin/repo cd /home/administrator/administrator/repo_sync whoami source ./build/envsetup.sh choosecombo release project_int_factory eng 

As a result, I get below errors. I gave full permission to the folder. The location of the source code is / home / administrator / administrator / repo _sync. I tried with the administrator sudo chmod + x and sudo chmod 777 , but nothing helps. plus whoami return jenkins

 Building in workspace /home/administrator/administrator/repo_sync [repo_sync] $ /bin/sh -xe /tmp/hudson1461193343405073934.sh + export PATH=/usr/lib/jvm/java-6-openjdk-amd64/bin:/usr/lib/jvm/java-6-openjdk-amd64/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/var/lib/jenkins/lib:/usr/lib/jvm/java-6-openjdk-amd64/bin:/home/administrator/pawan/adt-bundle-linux-x86_64-20140702/sdk/tools:/home/administrator/pawan/adt-bundle-linux-x86_64-20140702/sdk/platform-tools:/usr/bin/repo + cd /home/administrator/administrator/repo_sync + whoami jenkins + source ./build/envsetup.sh /tmp/hudson1461193343405073934.sh: 5: /tmp/hudson1461193343405073934.sh: source: Permission denied Build step 'Execute shell' marked build as failure Finished: FAILURE 
+7
source share
3 answers

Using the user Jenkins works with, Jenkins scripts are executed (and the Execute Shell execution step a script). By default, Jenkins runs as a jenkins user.

Your script runs as the user "jenkins", as seen from:
+ whoami
jenkins

You should run the chmod commands for user jenkins , not administrator .

+7
source

Running bash command.sh worked for me.

+8
source

Add a run bit to your .sh file

 git add --chmod=+x "filename" 
0
source

Source: https://habr.com/ru/post/1206606/


All Articles