Bug 1104140

Summary: It will not validate the deployment type when do app deploy via REST API
Product: OpenShift Online Reporter: Meng Bo <bmeng>
Component: MasterAssignee: Rory Thrasher <rthrashe>
Status: CLOSED WONTFIX QA Contact: Wei Sun <wsun>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: aos-bugs, jokerman, mmccomas, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1308739 (view as bug list) Environment:
Last Closed: 2017-05-31 18:22:11 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:
Bug Depends On:    
Bug Blocks: 1308739    

Description Meng Bo 2014-06-03 11:24:42 UTC
Description of problem:
Try to do binary deploy on the app with git deploy method configured via rest api, will get succeeded. Vice versa. 

Version-Release number of selected component (if applicable):
STG(devenv-stage_861)
devenv-stage_861

How reproducible:
always

Steps to Reproduce:
1. Create app of any type
2. Do binary deploy via rest api without change the app configure to use binary deploy method
# curl -k -H "Accept: application/xml" --user "bmeng:123123" https://localhost/broker/rest/application/538dcd847c317b9d03000009/deployments -XPOST -d artifact_url=http://cphp-ccyd.rhcloud.com/cphp2.tar.gz

3. 

Actual results:
Will get succeeded.

  <status>created</status>
  <type>deployment</type>
  <data>
    <deployment>
      <created-at>2014-06-03T13:33:53Z</created-at>
      <hot-deploy>false</hot-deploy>
      <force-clean-build>false</force-clean-build>
      <ref>master</ref>
      <sha1 nil="true"></sha1>
      <id>a99f1e03</id>
      <activations>
        <activation>2014-06-03T13:33:56Z</activation>
      </activations>
    </deployment>
  </data>
  <messages>
    <message>
      <severity>info</severity>
      <text>Added a99f1e03 to application php54</text>
      <exit-code>0</exit-code>
      <field nil="true"></field>
      <index nil="true"></index>
    </message>
  </messages>


Expected results:
Should report that the app is configured as git deploy and does not support for the binary deploy.

Additional info:
Works well for the rhc client.

# rhc deploy http://cphp-ccyd.rhcloud.com/cphp2.tar.gz -a php54
The application 'php54' is configured for git reference deployments but the artifact provided ('http://cphp-ccyd.rhcloud.com/cphp2.tar.gz') is a url. Please provide a
git reference to deploy (branch, tag or commit SHA1) or configure your app to deploy from binaries with 'rhc configure-app php54 --deployment-type binary'.

The artifact provided is not compatible with the app deployment type.

Comment 1 openshift-github-bot 2015-11-25 16:05:32 UTC
Commits pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/8a3183b4b860c9b1de530647ebc6aa6e168d4ec4
deployments_controller.rb: Adds checks for app deployment mode via REST

Bug 1104140
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1104140

Adds additional checks to verify that the app is in the correct deployment mode when deploying via the REST api.  Will throw a 422 error when attempting to binary deploy in git mode or vice versa.

Adds deployment types to relevant REST api tests to specify deployment mode.

https://github.com/openshift/origin-server/commit/db254f5ee9cd758774427a42814f183932541571
Merge pull request #6320 from thrasher-redhat/bug1104140

Merged by openshift-bot

Comment 2 Rory Thrasher 2016-01-06 21:46:08 UTC
QA,

Please verify that this bug has been fixed.

1. When attempting to binary deploy via the rest API while in git deployment mode (default mode), there should be a 422 error similar to "The binary artifact provided is not compatible with the app deployment type, git".

2. When attempting to git deploy via the rest API while in binary deployment mode, there should be a 422 error similar to "The git ref provided is not compatible with the app deployment type, binary".

3. When attempting to git deploy in git deployment mode or binary deploy in binary deployment mode, the deployment should succeed as normal.

Comment 3 Meng Bo 2016-01-08 10:26:40 UTC
  <messages>
    <message>
      <severity>error</severity>
      <text>The git ref provided is not compatible with the app deployment type, 'binary'.</text>
      <exit-code>-1</exit-code>
      <field>ref</field>
      <index nil="true"></index>
    </message>
  </messages>

  <messages>
    <message>
      <severity>error</severity>
      <text>The binary artifact provided is not compatible with the app deployment type, 'git'.</text>
      <exit-code>-1</exit-code>
      <field>artifact_url</field>
      <index nil="true"></index>
    </message>
  </messages>

Issue has been fixed, the error message shown when deploying with incorrect type.

Comment 5 Eric Paris 2017-05-31 18:22:11 UTC
We apologize, however, we do not plan to address this report at this time. The majority of our active development is for the v3 version of OpenShift. If you would like for Red Hat to reconsider this decision, please reach out to your support representative. We are very sorry for any inconvenience this may cause.