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
Jérome Perrin
gitlab-ce
Commits
20abcbff
Commit
20abcbff
authored
Oct 04, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add google_api to TOP_LEVEL_ROUTES. Import/Export model failure fix. Fix static analysys.
parent
c6d53250
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
26 additions
and
21 deletions
+26
-21
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+2
-3
app/models/gcp/cluster.rb
app/models/gcp/cluster.rb
+1
-1
app/services/ci/fetch_gcp_operation_service.rb
app/services/ci/fetch_gcp_operation_service.rb
+1
-1
app/services/ci/finalize_cluster_creation_service.rb
app/services/ci/finalize_cluster_creation_service.rb
+1
-1
app/services/ci/provision_cluster_service.rb
app/services/ci/provision_cluster_service.rb
+5
-6
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+1
-0
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+1
-0
lib/gitlab/path_regex.rb
lib/gitlab/path_regex.rb
+1
-0
lib/google_api/auth.rb
lib/google_api/auth.rb
+1
-1
lib/google_api/cloud_platform/client.rb
lib/google_api/cloud_platform/client.rb
+7
-8
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+5
-0
No files found.
app/controllers/projects/clusters_controller.rb
View file @
20abcbff
...
@@ -9,9 +9,8 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -9,9 +9,8 @@ class Projects::ClustersController < Projects::ApplicationController
def
login
def
login
begin
begin
@authorize_url
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
@authorize_url
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
nil
,
callback_google_api_authorizations_url
,
nil
,
callback_google_api_authorizations_url
,
state:
namespace_project_clusters_url
.
to_s
state:
namespace_project_clusters_url
.
to_s
).
authorize_url
).
authorize_url
rescue
GoogleApi
::
Auth
::
ConfigMissingError
rescue
GoogleApi
::
Auth
::
ConfigMissingError
# no-op
# no-op
end
end
...
...
app/models/gcp/cluster.rb
View file @
20abcbff
...
@@ -48,7 +48,7 @@ module Gcp
...
@@ -48,7 +48,7 @@ module Gcp
validates
:gcp_cluster_zone
,
presence:
true
validates
:gcp_cluster_zone
,
presence:
true
validates
:gcp_cluster_size
,
presence:
true
,
validates
:gcp_cluster_size
,
presence:
true
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
numericality:
{
only_integer:
true
,
greater_than:
0
}
validates
:project_namespace
,
validates
:project_namespace
,
allow_blank:
true
,
allow_blank:
true
,
...
...
app/services/ci/fetch_gcp_operation_service.rb
View file @
20abcbff
module
Ci
module
Ci
class
FetchGcpOperationService
class
FetchGcpOperationService
def
execute
(
cluster
)
def
execute
(
cluster
)
api_client
=
api_client
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
operation
=
api_client
.
projects_zones_operations
(
operation
=
api_client
.
projects_zones_operations
(
...
...
app/services/ci/finalize_cluster_creation_service.rb
View file @
20abcbff
module
Ci
module
Ci
class
FinalizeClusterCreationService
class
FinalizeClusterCreationService
def
execute
(
cluster
)
def
execute
(
cluster
)
api_client
=
api_client
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
begin
begin
...
...
app/services/ci/provision_cluster_service.rb
View file @
20abcbff
...
@@ -6,12 +6,11 @@ module Ci
...
@@ -6,12 +6,11 @@ module Ci
begin
begin
operation
=
api_client
.
projects_zones_clusters_create
(
operation
=
api_client
.
projects_zones_clusters_create
(
cluster
.
gcp_project_id
,
cluster
.
gcp_project_id
,
cluster
.
gcp_cluster_zone
,
cluster
.
gcp_cluster_zone
,
cluster
.
gcp_cluster_name
,
cluster
.
gcp_cluster_name
,
cluster
.
gcp_cluster_size
,
cluster
.
gcp_cluster_size
,
machine_type:
cluster
.
gcp_machine_type
machine_type:
cluster
.
gcp_machine_type
)
)
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
end
end
...
...
lib/gitlab/import_export/import_export.yml
View file @
20abcbff
...
@@ -53,6 +53,7 @@ project_tree:
...
@@ -53,6 +53,7 @@ project_tree:
-
:auto_devops
-
:auto_devops
-
:triggers
-
:triggers
-
:pipeline_schedules
-
:pipeline_schedules
-
:clusters
-
:services
-
:services
-
:hooks
-
:hooks
-
protected_branches
:
-
protected_branches
:
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
20abcbff
...
@@ -8,6 +8,7 @@ module Gitlab
...
@@ -8,6 +8,7 @@ module Gitlab
triggers:
'Ci::Trigger'
,
triggers:
'Ci::Trigger'
,
pipeline_schedules:
'Ci::PipelineSchedule'
,
pipeline_schedules:
'Ci::PipelineSchedule'
,
builds:
'Ci::Build'
,
builds:
'Ci::Build'
,
clusters:
'Gcp::Cluster'
,
hooks:
'ProjectHook'
,
hooks:
'ProjectHook'
,
merge_access_levels:
'ProtectedBranch::MergeAccessLevel'
,
merge_access_levels:
'ProtectedBranch::MergeAccessLevel'
,
push_access_levels:
'ProtectedBranch::PushAccessLevel'
,
push_access_levels:
'ProtectedBranch::PushAccessLevel'
,
...
...
lib/gitlab/path_regex.rb
View file @
20abcbff
...
@@ -33,6 +33,7 @@ module Gitlab
...
@@ -33,6 +33,7 @@ module Gitlab
explore
explore
favicon.ico
favicon.ico
files
files
google_api
groups
groups
health_check
health_check
help
help
...
...
lib/google_api/auth.rb
View file @
20abcbff
...
@@ -46,7 +46,7 @@ module GoogleApi
...
@@ -46,7 +46,7 @@ module GoogleApi
config
.
app_id
,
config
.
app_id
,
config
.
app_secret
,
config
.
app_secret
,
site:
'https://accounts.google.com'
,
site:
'https://accounts.google.com'
,
token_url:
'/o/oauth2/token'
,
token_url:
'/o/oauth2/token'
,
authorize_url:
'/o/oauth2/auth'
authorize_url:
'/o/oauth2/auth'
)
)
end
end
...
...
lib/google_api/cloud_platform/client.rb
View file @
20abcbff
...
@@ -44,16 +44,15 @@ module GoogleApi
...
@@ -44,16 +44,15 @@ module GoogleApi
service
.
authorization
=
access_token
service
.
authorization
=
access_token
request_body
=
Google
::
Apis
::
ContainerV1
::
CreateClusterRequest
.
new
(
request_body
=
Google
::
Apis
::
ContainerV1
::
CreateClusterRequest
.
new
(
{
{
"cluster"
:
{
"cluster"
:
{
"name"
:
cluster_name
,
"name"
:
cluster_name
,
"initial_node_count"
:
cluster_size
,
"initial_node_count"
:
cluster_size
,
"node_config"
:
{
"node_config"
:
{
"machine_type"
:
machine_type
# Default 3.75 GB, if ommit
"machine_type"
:
machine_type
}
}
}
}
}
)
}
)
service
.
create_cluster
(
project_id
,
zone
,
request_body
)
service
.
create_cluster
(
project_id
,
zone
,
request_body
)
end
end
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
20abcbff
...
@@ -147,6 +147,10 @@ deploy_keys:
...
@@ -147,6 +147,10 @@ deploy_keys:
-
user
-
user
-
deploy_keys_projects
-
deploy_keys_projects
-
projects
-
projects
clusters
:
-
project
-
user
-
service
services
:
services
:
-
project
-
project
-
service_hook
-
service_hook
...
@@ -177,6 +181,7 @@ project:
...
@@ -177,6 +181,7 @@ project:
-
tag_taggings
-
tag_taggings
-
tags
-
tags
-
chat_services
-
chat_services
-
cluster
-
creator
-
creator
-
group
-
group
-
namespace
-
namespace
...
...
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