openshift/origin-server — pull request #3331 by BanzaiMan (2013-08-12 18:18:09+00:00)
Title: Bug 970150

Fail early during the build cycle if a Rails app name starts with a
numeral.

We should fail before we run `bundle install`, since it is completely
unnecessary if Rails can't run.

If the application is created with `--from-code`, the initial build will
fail, with error message like this:

```
Creating application '12345' ...
The initial build for the application failed: Shell command
'/sbin/runuser -s /bin/sh 80e4c0ea037a11e3962922000ab2046b -c "exec
/usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c0,c502' /bin/sh
-c \"gear
postreceive >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255

.Last 10 kB of build output:
Stopping Ruby cart
httpd (no pid file) not running
Invalid Rails application name. Please delete this applicatin and
re-create it with a name which does not start with numbers
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: Failed to execute: 'control pre-build' for
/var/lib/openshift/80e4c0ea037a11e3962922000ab2046b/ruby

For more details about the problem, try running the command again with
the '--trace' option.
```

If the application is created from a template Rack app, and updated via
`git pull -s recursive -X theirs`, the build will fail on the first
push:

```
remote: Stopping Ruby cart
remote: Waiting for stop to finish
remote: CLIENT_ERROR: Invalid Rails application name. Please delete this applicatin and re-create it with a name which does not start with
numbers
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: Failed to execute: 'control pre-build' for /var/lib/openshift/520924b77b2a19115a000001/ruby
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://520924b77b2a19115a000001@12345-fooooooooooo.dev.rhcloud.com/~/git/12345.git/
9b5a31d..398f08a master -> master
```