Bug 1018665

Summary: [deploy]php cartridge does not execute build hook
Product: OpenShift Online Reporter: Zhe Wang <zhewang>
Component: ContainersAssignee: Andy Goldstein <agoldste>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 03:23:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zhe Wang 2013-10-14 06:41:13 UTC
Description of problem:
Given a PHP-5.3 app, it does not execute the build hook during its build cycle, but it does execute pre_build, deploy and post_deploy hook.

Version-Release number of selected component (if applicable):
devenv_3893

How reproducible:
always

Steps to Reproduce:
1. create a php-5.3 app

2. create a build hook with the following code, and make it executable
#! /bin/bash
echo "----Build Fail Test----"
touch  /var/lib/openshift/:app_uuid/app-root/runtime/repo/build_test
exit 1

3. push the change and trigger a build

Actual results:
The build succeeded, but neither the expected string was printed in stdout during interactive activation nor the build_test file was created.

Expected results:
The build hook should be executed.

Additional info:

Comment 1 Andy Goldstein 2013-10-18 14:41:00 UTC
There are a few things here:

The echo not being displayed was fixed by https://bugzilla.redhat.com/show_bug.cgi?id=1016977

If you want to create a file inside the repo in a hook, you must now use $OPENSHIFT_REPO_DIR, as ~/app-root/runtime/repo may not be valid at build time now.

The fact that the build succeeds when the build hook has a non-zero exit is a problem and I am working to fix it.

Comment 2 Andy Goldstein 2013-10-18 15:13:58 UTC
https://github.com/openshift/origin-server/pull/3926

Comment 3 openshift-github-bot 2013-10-18 18:13:25 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/18c041bcde6794c04088cd3df36083669a72e2e8
Bug 1018665

Reraise the ShellExecutionException in build() so it's seen as a
failure and halts the deployment

Comment 4 Zhe Wang 2013-10-21 03:42:15 UTC
Verified in devenv_3921

After creating a build hook with the following code:

#! /bin/bash
echo "----Build Fail Test----"
exit 1

the build process was aborted:

Building PHP cartridge
----Build Fail Test----
An error occurred executing 'gear build' (exit code: 1)
Error message: Failed to execute action hook 'build' for 5264a201ab3b098bc2000359 application phptstbldr