Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
7d0d6a82
Commit
7d0d6a82
authored
Jun 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'fix/gb/improve-build-stage-reference-migration'
# Conflicts: # db/schema.rb
parents
090ed087
853d06b9
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
64 additions
and
5 deletions
+64
-5
app/controllers/projects/deploy_keys_controller.rb
app/controllers/projects/deploy_keys_controller.rb
+2
-2
changelogs/unreleased/33878_fix_edit_deploy_key.yml
changelogs/unreleased/33878_fix_edit_deploy_key.yml
+4
-0
db/fixtures/development/19_environments.rb
db/fixtures/development/19_environments.rb
+1
-1
db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb
...170619144837_add_index_for_head_pipeline_merge_request.rb
+15
-0
db/schema.rb
db/schema.rb
+1
-0
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+1
-1
spec/features/projects/settings/repository_settings_spec.rb
spec/features/projects/settings/repository_settings_spec.rb
+17
-0
spec/lib/gitlab/regex_spec.rb
spec/lib/gitlab/regex_spec.rb
+12
-0
spec/requests/api/deploy_keys_spec.rb
spec/requests/api/deploy_keys_spec.rb
+10
-0
No files found.
app/controllers/projects/deploy_keys_controller.rb
View file @
7d0d6a82
...
@@ -6,7 +6,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
...
@@ -6,7 +6,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
before_action
:authorize_admin_project!
before_action
:authorize_admin_project!
before_action
:authorize_update_deploy_key!
,
only:
[
:edit
,
:update
]
before_action
:authorize_update_deploy_key!
,
only:
[
:edit
,
:update
]
layout
"project_settings"
layout
'project_settings'
def
index
def
index
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -66,7 +66,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
...
@@ -66,7 +66,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
protected
protected
def
deploy_key
def
deploy_key
@deploy_key
||=
@project
.
deploy_keys
.
find
(
params
[
:id
])
@deploy_key
||=
DeployKey
.
find
(
params
[
:id
])
end
end
def
create_params
def
create_params
...
...
changelogs/unreleased/33878_fix_edit_deploy_key.yml
0 → 100644
View file @
7d0d6a82
---
title
:
Fix edit button for deploy keys available from other projects
merge_request
:
12301
author
:
Alexander Randa
db/fixtures/development/19_environments.rb
View file @
7d0d6a82
...
@@ -33,7 +33,7 @@ class Gitlab::Seeder::Environments
...
@@ -33,7 +33,7 @@ class Gitlab::Seeder::Environments
create_deployment!
(
create_deployment!
(
merge_request
.
source_project
,
merge_request
.
source_project
,
"review/
#{
merge_request
.
source_branch
}
"
,
"review/
#{
merge_request
.
source_branch
.
gsub
(
/[^a-zA-Z0-9]/
,
''
)
}
"
,
merge_request
.
source_branch
,
merge_request
.
source_branch
,
merge_request
.
diff_head_sha
merge_request
.
diff_head_sha
)
)
...
...
db/migrate/20170619144837_add_index_for_head_pipeline_merge_request.rb
0 → 100644
View file @
7d0d6a82
class
AddIndexForHeadPipelineMergeRequest
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:merge_requests
,
:head_pipeline_id
end
def
down
remove_concurrent_index
:merge_requests
,
:head_pipeline_id
if
index_exists?
(
:merge_requests
,
:head_pipeline_id
)
end
end
db/schema.rb
View file @
7d0d6a82
...
@@ -777,6 +777,7 @@ ActiveRecord::Schema.define(version: 20170621102400) do
...
@@ -777,6 +777,7 @@ ActiveRecord::Schema.define(version: 20170621102400) do
add_index
"merge_requests"
,
[
"created_at"
],
name:
"index_merge_requests_on_created_at"
,
using: :btree
add_index
"merge_requests"
,
[
"created_at"
],
name:
"index_merge_requests_on_created_at"
,
using: :btree
add_index
"merge_requests"
,
[
"deleted_at"
],
name:
"index_merge_requests_on_deleted_at"
,
using: :btree
add_index
"merge_requests"
,
[
"deleted_at"
],
name:
"index_merge_requests_on_deleted_at"
,
using: :btree
add_index
"merge_requests"
,
[
"description"
],
name:
"index_merge_requests_on_description_trigram"
,
using: :gin
,
opclasses:
{
"description"
=>
"gin_trgm_ops"
}
add_index
"merge_requests"
,
[
"description"
],
name:
"index_merge_requests_on_description_trigram"
,
using: :gin
,
opclasses:
{
"description"
=>
"gin_trgm_ops"
}
add_index
"merge_requests"
,
[
"head_pipeline_id"
],
name:
"index_merge_requests_on_head_pipeline_id"
,
using: :btree
add_index
"merge_requests"
,
[
"milestone_id"
],
name:
"index_merge_requests_on_milestone_id"
,
using: :btree
add_index
"merge_requests"
,
[
"milestone_id"
],
name:
"index_merge_requests_on_milestone_id"
,
using: :btree
add_index
"merge_requests"
,
[
"source_branch"
],
name:
"index_merge_requests_on_source_branch"
,
using: :btree
add_index
"merge_requests"
,
[
"source_branch"
],
name:
"index_merge_requests_on_source_branch"
,
using: :btree
add_index
"merge_requests"
,
[
"source_project_id"
],
name:
"index_merge_requests_on_source_project_id"
,
using: :btree
add_index
"merge_requests"
,
[
"source_project_id"
],
name:
"index_merge_requests_on_source_project_id"
,
using: :btree
...
...
lib/api/deploy_keys.rb
View file @
7d0d6a82
...
@@ -86,7 +86,7 @@ module API
...
@@ -86,7 +86,7 @@ module API
at_least_one_of
:title
,
:can_push
at_least_one_of
:title
,
:can_push
end
end
put
":id/deploy_keys/:key_id"
do
put
":id/deploy_keys/:key_id"
do
key
=
user_project
.
deploy_keys
.
find
(
params
.
delete
(
:key_id
))
key
=
DeployKey
.
find
(
params
.
delete
(
:key_id
))
authorize!
(
:update_deploy_key
,
key
)
authorize!
(
:update_deploy_key
,
key
)
...
...
lib/gitlab/regex.rb
View file @
7d0d6a82
...
@@ -43,7 +43,7 @@ module Gitlab
...
@@ -43,7 +43,7 @@ module Gitlab
end
end
def
environment_name_regex_message
def
environment_name_regex_message
"can contain only letters, digits, '-', '_', '/', '$', '{', '}', '.' and spaces"
"can contain only letters, digits, '-', '_', '/', '$', '{', '}', '.'
,
and spaces"
end
end
def
kubernetes_namespace_regex
def
kubernetes_namespace_regex
...
...
spec/features/projects/settings/repository_settings_spec.rb
View file @
7d0d6a82
...
@@ -65,6 +65,23 @@ feature 'Repository settings', feature: true do
...
@@ -65,6 +65,23 @@ feature 'Repository settings', feature: true do
expect
(
page
).
to
have_content
(
'Write access allowed'
)
expect
(
page
).
to
have_content
(
'Write access allowed'
)
end
end
scenario
'edit a deploy key from projects user has access to'
do
project2
=
create
(
:project_empty_repo
)
project2
.
team
<<
[
user
,
role
]
project2
.
deploy_keys
<<
private_deploy_key
visit
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
find
(
'li'
,
text:
private_deploy_key
.
title
).
click_link
(
'Edit'
)
fill_in
'deploy_key_title'
,
with:
'updated_deploy_key'
check
'deploy_key_can_push'
click_button
'Save changes'
expect
(
page
).
to
have_content
(
'updated_deploy_key'
)
expect
(
page
).
to
have_content
(
'Write access allowed'
)
end
scenario
'remove an existing deploy key'
do
scenario
'remove an existing deploy key'
do
project
.
deploy_keys
<<
private_deploy_key
project
.
deploy_keys
<<
private_deploy_key
visit
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
visit
namespace_project_settings_repository_path
(
project
.
namespace
,
project
)
...
...
spec/lib/gitlab/regex_spec.rb
View file @
7d0d6a82
...
@@ -20,6 +20,18 @@ describe Gitlab::Regex, lib: true do
...
@@ -20,6 +20,18 @@ describe Gitlab::Regex, lib: true do
it
{
is_expected
.
to
match
(
'foo@bar'
)
}
it
{
is_expected
.
to
match
(
'foo@bar'
)
}
end
end
describe
'.environment_slug_regex'
do
subject
{
described_class
.
environment_name_regex
}
it
{
is_expected
.
to
match
(
'foo'
)
}
it
{
is_expected
.
to
match
(
'foo-1'
)
}
it
{
is_expected
.
to
match
(
'FOO'
)
}
it
{
is_expected
.
to
match
(
'foo/1'
)
}
it
{
is_expected
.
to
match
(
'foo.1'
)
}
it
{
is_expected
.
not_to
match
(
'9&foo'
)
}
it
{
is_expected
.
not_to
match
(
'foo-^'
)
}
end
describe
'.environment_slug_regex'
do
describe
'.environment_slug_regex'
do
subject
{
described_class
.
environment_slug_regex
}
subject
{
described_class
.
environment_slug_regex
}
...
...
spec/requests/api/deploy_keys_spec.rb
View file @
7d0d6a82
...
@@ -160,6 +160,16 @@ describe API::DeployKeys do
...
@@ -160,6 +160,16 @@ describe API::DeployKeys do
expect
(
json_response
[
'title'
]).
to
eq
(
'new title'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new title'
)
expect
(
json_response
[
'can_push'
]).
to
eq
(
true
)
expect
(
json_response
[
'can_push'
]).
to
eq
(
true
)
end
end
it
'updates a private ssh key from projects user has access with correct attributes'
do
create
(
:deploy_keys_project
,
project:
project2
,
deploy_key:
private_deploy_key
)
put
api
(
"/projects/
#{
project
.
id
}
/deploy_keys/
#{
private_deploy_key
.
id
}
"
,
admin
),
{
title:
'new title'
,
can_push:
true
}
expect
(
json_response
[
'id'
]).
to
eq
(
private_deploy_key
.
id
)
expect
(
json_response
[
'title'
]).
to
eq
(
'new title'
)
expect
(
json_response
[
'can_push'
]).
to
eq
(
true
)
end
end
end
describe
'DELETE /projects/:id/deploy_keys/:key_id'
do
describe
'DELETE /projects/:id/deploy_keys/:key_id'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment