gitlab-org--gitlab-foss/spec/lib/gitlab
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
..
backend
backup Fix Backup::Manager#remove_old 2016-12-07 13:27:44 +00:00
badge
bitbucket_import
chat_commands Accept issue new as command to create an issue 2016-12-05 10:02:21 +01:00
checks
ci Improve build status specs contexts descriptions 2016-12-14 11:36:19 +01:00
conflict
cycle_analytics Update effected tests 2016-12-04 17:32:33 +01:00
data_builder
database
diff Fixes ActionView::Template::Error: undefined method text? for nil:NilClass 2016-12-02 14:03:30 +02:00
downtime_check
email fix rubocop failures 2016-11-17 11:59:44 +09:00
fogbugz_import
gfm Add shorthand support to gitlab markdown references 2016-12-02 19:18:17 -02:00
git
github_import Use :maximum instead of :within for length validators with a 0..N range 2016-12-06 10:23:17 +01:00
gitlab_import
google_code_import
graphs
import_export Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
ldap
metrics
middleware Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
o_auth
saml
sanitizers
sherlock
slash_commands
sql Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
template
allowable_spec.rb Extract abilities checking module from ability model 2016-12-13 14:44:43 +01:00
asciidoc_spec.rb Render math in Asciidoc and Markdown with KaTeX using code blocks 2016-12-14 16:50:54 +00:00
auth_spec.rb
award_emoji_spec.rb
blame_spec.rb
changes_list_spec.rb
chat_name_token_spec.rb More refactoring, push present to base command 2016-11-17 21:44:26 +01:00
closing_issue_extractor_spec.rb
color_schemes_spec.rb
contributions_calendar_spec.rb
current_settings_spec.rb
database_spec.rb
downtime_check_spec.rb
exclusive_lease_spec.rb
file_detector_spec.rb Unify detecting of special repository files 2016-11-21 12:51:40 +01:00
git_access_spec.rb
git_access_wiki_spec.rb Improve Gitlab::GitAccessWiki spec with download access checks 2016-11-30 16:02:25 -02:00
git_spec.rb
highlight_spec.rb
identifier_spec.rb Use Commit#author so we share logic and cache 2016-11-24 02:33:55 +08:00
incoming_email_spec.rb
key_fingerprint_spec.rb
lazy_spec.rb
lfs_token_spec.rb
markup_helper_spec.rb
metrics_spec.rb
optimistic_locking_spec.rb
popen_spec.rb
project_search_results_spec.rb Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
redis_spec.rb
reference_extractor_spec.rb
regex_spec.rb Add an environment slug 2016-12-15 13:57:03 +00:00
routing_spec.rb Make it possible to mix Gitlab::Routing in 2016-12-13 14:51:23 +01:00
search_results_spec.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
sidekiq_throttler_spec.rb
snippet_search_results_spec.rb
themes_spec.rb
upgrader_spec.rb
uploads_transfer_spec.rb
url_builder_spec.rb get rid of light url builder and fix wrong spec 2016-11-17 08:22:58 +01:00
url_sanitizer_spec.rb
user_access_spec.rb
utils_spec.rb
version_info_spec.rb
workhorse_spec.rb