How to run an action hook on Red Hat OpenShift?

1.1k Views Asked by At

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
0

There are 0 best solutions below