gitlab-org--gitlab-foss/lib
Kamil Trzciński dfdce39ad6 Merge branch '22864-add-clean-environment-name' into 'master'
Add a slug to environments

## What does this MR do?

Adds a `slug` field to the `environments` table, populating existing rows and ensuring that new rows will get an entry.

Cleaning examples:

* `review/foo`  => `review-foo-5gghdf`
* `review-foo` => `review-foo`
* `1-foo` => `env-1-foo-e2hx12`
* `production` => `production`
* `Production` => `production-f8ddlz`

## Are there points in the code the reviewer needs to double check?

This migration requires downtime. I don't see a way to avoid it.

## Why was this MR needed?

External services often have more restrictive rules on naming than those enforced for `environments.name`. In particular, forward slashes and names longer than 24 characters causes problems on OpenShift. `slug` is designed to be an acceptable alternative to `name` in these situations. Since forward slashes are a documented part of environment names, to set environment types, we need an envionmnent slug, not just a slug for the branch name.

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [X] API support added
- Tests
  - [X] Added for this feature/bug
  - [x] All builds are passing
- [X] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [X] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [X] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

Part of #22864

See merge request !7983
2016-12-15 16:18:50 +00:00
..
api Add an environment slug 2016-12-15 13:57:03 +00:00
assets
backup Fix Backup::Manager#remove_old 2016-12-07 13:27:44 +00:00
banzai Merge branch 'katex-math' into 'master' 2016-12-15 14:11:38 +00:00
ci Send credentials array with build data 2016-11-21 15:01:06 +01:00
constraints Add nested groups support on data level 2016-12-08 11:47:16 +02:00
container_registry
generators/rails/post_deployment_migration require rails/generators for generators 2016-11-01 21:44:27 +01:00
gitlab Merge branch '22864-add-clean-environment-name' into 'master' 2016-12-15 16:18:50 +00:00
json_web_token
mattermost Improve deploy command message 2016-11-21 21:36:22 +01:00
omni_auth
rouge Render math in Asciidoc and Markdown with KaTeX using code blocks 2016-12-14 16:50:54 +00:00
support
tasks Add AddLowerPathIndexToRoutes to setup_postgresql.rake 2016-12-13 14:48:02 +02:00
banzai.rb Add markdown cache columns to the database, but don't use them yet 2016-10-07 02:54:25 +01:00
disable_email_interceptor.rb
email_template_interceptor.rb Add new configuration setting to enable/disable HTML emails. 2016-11-28 17:00:03 -05:00
event_filter.rb Add issue events filter and make sure "All" really shows everything 2016-12-04 23:07:22 +01:00
expand_variables.rb Update support for dynamic environments 2016-09-19 10:07:13 +02:00
extracts_path.rb Remove 'extended_sha1' option from ExtractsPath module 2016-11-06 12:33:39 +09:00
file_size_validator.rb
file_streamer.rb
gitlab.rb
gt_one_coercion.rb
repository_cache.rb
static_model.rb
unfold_form.rb
uploaded_file.rb
version_check.rb