Bug 980253 - Validate cartridge version
Validate cartridge version
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Jhon Honce
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-01 17:23 EDT by Dan McPherson
Modified: 2015-05-14 19:22 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-07 18:54:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dan McPherson 2013-07-01 17:23:01 EDT
Description of problem:

According to the writers guide, cart versions should be of the form:

<number>[.<number>[.<number>[...]]]


But we don't validate against this in the runtime.  It should fail if you have letters in your versions for example.
Comment 1 Jhon Honce 2013-07-02 18:32:39 EDT
Fixed in https://github.com/openshift/origin-server/pull/2979
Comment 2 Xiaoli Tian 2013-07-09 01:56:58 EDT
(In reply to Jhon Honce from comment #1)
> Fixed in https://github.com/openshift/origin-server/pull/2979

Hi, Jhon

Just fyi that above pull request has failed the merge testing, not sure if you've already noted.

Thanks for checking.
Comment 3 Xiaoli Tian 2013-07-09 23:01:35 EDT
Assign it back to get more attention since related pull request is not merged yet.
Comment 4 Jhon Honce 2013-07-10 17:07:19 EDT
Fixed in https://github.com/openshift/origin-server/pull/2979
Comment 5 openshift-github-bot 2013-07-10 20:57:24 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/d9323dfffe5e57b3fa427e726e08ad2d37ae0d66
Bug 980253 - Validate version numbers from manifest

* Add Manifest.sort_versions to sort version numbers meaningfully
* Rebase for LXC container
Comment 6 Yan Du 2013-07-11 06:52:15 EDT
test on devenv_3483, there is warning message shown when create app with invalid version cartridge. but the Reference ID should not be shown 


steps:
1. prepare a download cartridge, eg: ruby
2. change the Versions: ['1.9', '1.8'] in manifest.yml 
   (eg: change to Versions: ['a1.9', '1.8'])
3. create the app with download cartridge prepared in step1&2
4. modify the Version: '1.9' in manifest.yml 
   (eg:change to Version: '1.9c')
5. create the app with download cartridge again
6. modify the  Cartridge-Version number 0.0.4 in manifest.yml
   (eg: change to Cartridge-Version number 0.a0.4 )
7. repeat step5


step3:
[root@ip-10-147-221-130 dyruby]# rhc app create -a rubyapp1 https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml -l yaXX@redhat.com -p XXX
The cartridge 'https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml' will be downloaded and
installed

Application Options
-------------------
  Namespace:  ccc
  Cartridges: https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml
  Gear Size:  default
  Scaling:    no

Creating application 'rubyapp1' ... 
Unable to complete the requested operation due to: Version number a1.9 is invalid: 'Versions'.
Reference ID: fc7fcc40313e61a65b8527858b60dc5e


step5:
[root@ip-10-147-221-130 dyruby]# rhc app create -a rubyapp1 https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml -l yaXX@redhat.com -p XXX
The cartridge 'https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml' will be downloaded and
installed

Application Options
-------------------
  Namespace:  ccc
  Cartridges: https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml
  Gear Size:  default
  Scaling:    no

Creating application 'rubyapp1' ... 
Unable to complete the requested operation due to: Version number 1.9c is invalid: 'Version'.
Reference ID: 49e1d03ec479debf2c6478e5fa701417


step7:
[root@ip-10-147-221-130 dyruby]# rhc app create -a rubyapp1 https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml -l yaXX@redhat.com -p XXX
The cartridge 'https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml' will be downloaded and
installed

Application Options
-------------------
  Namespace:  ccc
  Cartridges: https://raw.github.com/duyanyan/dyruby/master/metadata/manifest.yml
  Gear Size:  default
  Scaling:    no

Creating application 'rubyapp1' ... 
Unable to complete the requested operation due to: Cartridge-Version number 0.a0.4 is invalid: 'Version'.
Reference ID: 0e00e7c95fb314dc0a37b670eb60786c
Comment 7 openshift-github-bot 2013-07-16 17:08:35 EDT
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0fa67c104e4cf0a6e7ad79d588dd3520925801d2
Bug 980253 - Map illegal versions to 0.0.0

* Raising exception broke CDK which uses illegal version numbers
Comment 8 Qiushui Zhang 2013-07-28 23:26:05 EDT
According to defect 988727, we should not use invalid cartridge version.
Comment 9 Qiushui Zhang 2013-07-29 00:15:28 EDT
If invalid cartridge version used, error message pops up, for example,
"cp: cannot stat `/var/lib/openshift/51f5d7e16cec0e27be000235/perl//versions/0.0.0/etc/*': No such file or directory"
Comment 10 Jhon Honce 2013-07-29 11:47:29 EDT
The CDK created invalid cartridge version numbers and to continue to support those cartridges created by the CDK we now map invalid cartridge numbers to 0.0.0.

For this test to work you must support version 0.0.0.
Comment 11 Meng Bo 2013-07-30 08:03:04 EDT
For custom cartridge with invalid version format, it will redirect to 0.0.0 and popup error about dir does not exist.

Manually create 0.0.0 dir under versions dir. App will be created successfully.

[root@dhcp-10-180 openshiftest]# rhc app create appperl https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml
The cartridge 'https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml' will be downloaded and installed

Application Options
-------------------
  Namespace:  bmengdev
  Cartridges: https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml
  Gear Size:  default
  Scaling:    no

Creating application 'appperl' ... cp: cannot stat `/var/lib/openshift/109784612893244197437440/perl//versions/0.0.0/etc/*': No such file or directory
[root@dhcp-10-180 openshiftest]# rhc app create appperl https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml
The cartridge 'https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml' will be downloaded and installed

Application Options
-------------------
  Namespace:  bmengdev
  Cartridges: https://github.com/bmeng/bmeng_cart_perl/raw/master/metadata/manifest.yml
  Gear Size:  default
  Scaling:    no

Creating application 'appperl' ... done


Waiting for your DNS name to be available ... done

Cloning into 'appperl'...
Warning: Permanently added 'appperl-bmengdev.dev.rhcloud.com' (RSA) to the list of known hosts.

Your application 'appperl' is now available.

  URL:        http://appperl-bmengdev.dev.rhcloud.com/
  SSH to:     a5d08c24f90f11e299cc12313d2d26a2@appperl-bmengdev.dev.rhcloud.com
  Git remote: ssh://a5d08c24f90f11e299cc12313d2d26a2@appperl-bmengdev.dev.rhcloud.com/~/git/appperl.git/
  Cloned to:  /root/openshiftest/appperl

Run 'rhc show-app appperl' for more details about your app.


Move bug to verified.

Note You need to log in before you can comment on or make changes to this bug.