Bug 1017097

Summary: [deploy]A shell error pop up on git push after the app has been deployed twice with same id
Product: OpenShift Online Reporter: Jianwei Hou <jhou>
Component: ContainersAssignee: Dan Mace <dmace>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: dmace
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: 2013-10-17 13:34:25 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 Jianwei Hou 2013-10-09 09:15:06 UTC
Description of problem:
Error message: Shell command '/bin/cp -a app-root/runtime/dependencies/. app-deployments/2013-10-09_04-06-33.574/dependencies' returned an error. rc=1 is seen when an app is being pushed. The program takes app-root/runtime/dependencies/ as a directory, which is file

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

How reproducible:
Always

Steps to Reproduce:
1. Create an application, set keep_deployments of the app to 2
rhc create-app p1 php-5.3
2. Change application code, commit and push, app will be deployed and a deploy id will be returned to end user
3. Deploy the app again via rest api, same deploy id is applied to the app
curl -s -k -H 'Content-Type: Application/json' --user jhou:x https://ec2-184-72-155-218.compute-1.amazonaws.com/broker/rest/domain/jhou/application/p1/deployments -X POST
4. Change application codes, commit and push again

Actual results:
After step 4
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 359 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Stopping PHP cartridge
remote: [Wed Oct 09 04:06:31 2013] [warn] PassEnv variable SHELL was undefined
remote: [Wed Oct 09 04:06:31 2013] [warn] PassEnv variable USER was undefined
remote: [Wed Oct 09 04:06:31 2013] [warn] PassEnv variable LOGNAME was undefined
remote: Waiting for stop to finish
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: Shell command '/bin/cp -a app-root/runtime/dependencies/. app-deployments/2013-10-09_04-06-33.574/dependencies' returned an error. rc=1
remote: stdout: 
remote: stderr: /bin/cp: cannot stat `app-root/runtime/dependencies/.': No such file or directory
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://52550e316948fa0ce8000087.rhcloud.com/~/git/p1.git/
   61dd335..207f1a3  master -> master

Further dig in rhcsh, turns out the destination directory failed to be created
[p1-jhou.dev.rhcloud.com 52550e316948fa0ce8000087]\> file app-root/runtime/dependencies 
app-root/runtime/dependencies: broken symbolic link to `../../app-deployments/2013-10-09_04-06-06.771/dependencies'
[p1-jhou.dev.rhcloud.com 52550e316948fa0ce8000087]\> ls -l app-deployments/
total 12
drwxr-x---. 5 52550e316948fa0ce8000087 52550e316948fa0ce8000087 4096 Oct  9 04:06 2013-10-09_04-06-13.906
drwxr-x---. 5 52550e316948fa0ce8000087 52550e316948fa0ce8000087 4096 Oct  9 04:06 2013-10-09_04-06-33.574
drwxr-xr-x. 2 52550e316948fa0ce8000087 52550e316948fa0ce8000087 4096 Oct  9 04:06 by-id

Expected results:
Should be able to push the code and deploy the app successfully.

Additional info:

Comment 1 Andy Goldstein 2013-10-09 16:01:19 UTC
I believe this is fixed by https://github.com/openshift/origin-server/pull/3805

Comment 2 Dan Mace 2013-10-09 19:38:18 UTC
Confirmed this is fixed by https://github.com/openshift/origin-server/pull/3805

Comment 3 Jianwei Hou 2013-10-10 06:06:01 UTC
Verified on devenv_3880

A new deploy id is generated when no new changes were committed to the app, and this error is not reproduced anymore.