1

I read the documentation about Action Hook Scripts for OpenShift and created a pre_build action hook with the following commands on my OpenShift gear:

rhc ssh jbosswildfly
cd $OPENSHIFT_REPO_DIR/.openshift/action_hooks
touch pre_build
chmod a+x pre_build

Afterwards I created the pre_build file in the Git repository of my OpenShift application and pushed it to the repo. My deployments to OpenShift are performed by Travis CI and I got the following response:

remote: NOTE: The .openshift/action_hooks/pre_build hook is not executable, to make it executable:
remote:       On Windows run:   git update-index --chmod=+x .openshift/action_hooks/pre_build
remote:       On Linux/OSX run: chmod +x .openshift/action_hooks/pre_build

So I executed git update-index --chmod=+x .openshift/action_hooks/pre_build (because I am running on Windows) and pushed that pre_build file again to my remote Git repository.

Now I get the following message:

remote: No such file or directory - /var/lib/openshift/54e8f8984382ecc9a1000047/app-root/runtime/repo/.openshift/action_hooks/pre_build

Why does it tell me now that it cannot find the pre_build file? If I login (via SSH) to my OpenShift gear, then it's there:

enter image description here

This is my pre_build file:

#!/bin/bash
echo Hello World
Benny Code
  • 51,456
  • 28
  • 233
  • 198
  • Make sure it's added to your git repo. You can always winscp or ssh into your gear and check to make sure the file is there and the proper permissions are set after the git push. – fat fantasma Mar 26 '15 at 14:03
  • The permissions for the `pre_build` file are set to `rwx`. – Benny Code Mar 26 '15 at 14:06
  • Hmm. Strange. Do a force stop and then restart. – fat fantasma Mar 26 '15 at 14:52
  • Can you post the entire pre_build script? It should have a shebang at the top of it for whatever language it's written in, such as #!/bin/bash –  Mar 26 '15 at 15:24
  • Thanks for the hints. I added the contents of my `pre_build` file. It starts with `#!/bin/bash`. – Benny Code Mar 26 '15 at 22:48
  • Can you ssh into your gear and give us the output of "ls -lah" in your repo/.openshift/action_hooks directory? –  Apr 01 '15 at 17:41
  • Sure! Here it is: http://snag.gy/mLXrJ.jpg – Benny Code Apr 01 '15 at 20:40
  • @BennyNeugebauer I am experiencing the exact same problem right now. Did you come to a certain solution? I'd be more than glad to know – Preslav Rachev Jun 12 '15 at 06:52
  • @user1107412 - Unfortunately, I could not find a solution so far. We should consider [filing a bug for OpenShift Online](https://bugzilla.redhat.com/enter_bug.cgi). – Benny Code Jun 14 '15 at 22:48

0 Answers0