gitlab-org--gitlab-foss/spec
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
..
bin
config
controllers Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
db/production Allow users to seed the initial runner registration token using an environment variable 2016-12-01 17:21:21 -08:00
factories Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
features Merge branch 'dz-fix-admin-routes' into 'master' 2016-12-14 15:09:54 +00:00
finders Merge branch 'jej-24637-move-issue-visible_to_user-to-finder' into 'security' 2016-12-15 11:41:04 -03:00
fixtures adds impersonator variable and makes sudo usage overall more clear 2016-12-07 14:42:51 +00:00
helpers Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
initializers
javascripts Merge branch 'clean-no-undef' into 'master' 2016-12-15 00:52:46 +00:00
lib Merge branch '22864-add-clean-environment-name' into 'master' 2016-12-15 16:18:50 +00:00
mailers Merge branch '24880-configurable-plaintext-emails' into 'master' 2016-11-29 12:05:23 +00:00
migrations Encode when migrating ProcessCommitWorker jobs 2016-12-13 16:52:49 +01:00
models Merge branch '22864-add-clean-environment-name' into 'master' 2016-12-15 16:18:50 +00:00
policies Update effected tests 2016-12-04 17:32:33 +01:00
requests Add an environment slug 2016-12-15 13:57:03 +00:00
routing Add support for nested groups to admin routing 2016-12-11 10:30:10 +02:00
serializers fix transient timing failure adding timecop 2016-12-14 14:49:10 +01:00
services Create environments when the build referencing them is created 2016-12-15 13:57:04 +00:00
support Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
tasks/gitlab Don't allow to specify a repo or version when installing Workhorse 2016-12-01 19:22:46 +01:00
uploaders Add Gitlab::Middleware::Multipart 2016-12-15 12:26:36 +01:00
views Fix test 2016-12-12 13:16:52 -06:00
workers Merge branch 'zj-guest-reads-public-builds' into 'master' 2016-12-06 13:54:16 +00:00
factories_spec.rb
rails_helper.rb
rake_helper.rb Move task helpers to a module 2016-11-30 12:20:21 +01:00
simplecov_env.rb
spec_helper.rb Pass commit data to ProcessCommitWorker 2016-12-01 13:36:06 +01:00
teaspoon_env.rb