Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins `Make gradlew executable` option do not make `gradelw executable

I have Jenkins setup on linux machine (CentOS) and I tried to build Gradle based project on the master host. My project use Stash Git-based repository as SCM.

In the Jenkins build job I have enabled Clean before checkout option. And I see that gradlew script is checkouted without executable permissions. So, I set Make gradlew executable checkbox for the task. But I still see issue:

java.io.IOException: Cannot run program "/project/dir/gradlew" (in directory "/project/dir/"): error=13, Permission denied

I checked gradlew permissions and there is no executable on for the file.

Does anyone know how to debug/setup it?

Now, I have to use addetional build step execute shell script to set executable permissions for gradlew.

Note 1: I use Use Gradle Wrapper build option instead of Invoke Gradle because of some suggestions I found in the Internet.

Note 2: I found make gradlew script executable issue and checked that my Jenkins build should contain this fix. I use Jenkins build 1.581

like image 421
zubactik Avatar asked Nov 25 '14 10:11

zubactik


1 Answers

Lets assume the file script.sh needs to have the executable bit set. Use the command git ls-tree to inspect the file permissions:

C:\views\myproject>git ls-tree HEAD
100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh

As you can see the file has 644 permission (ignoring the 100). We would like to change it to 755:

C:\views\myproject>git update-index --chmod=+x script.sh
C:\views\myproject>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   script.sh
#

The file is now staged. Note that the file contents is not changed, only the meta data. We must commit the file so save the change:

C:\views\myproject>git commit -m "Changing file permissions"
[master 77b171e] Changing file permissions
 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 script.sh

Running git ls-tree again to see the change:

C:\views\myproject>git ls-tree HEAD
100755 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe    script.sh

Source

like image 186
zubactik Avatar answered Oct 16 '22 20:10

zubactik