Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
20abcbff
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
20abcbff
编写于
10月 04, 2017
作者:
S
Shinya Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add google_api to TOP_LEVEL_ROUTES. Import/Export model failure fix. Fix static analysys.
上级
c6d53250
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
26 addition
and
21 deletion
+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
未找到文件。
app/controllers/projects/clusters_controller.rb
浏览文件 @
20abcbff
...
...
@@ -9,9 +9,8 @@ class Projects::ClustersController < Projects::ApplicationController
def
login
begin
@authorize_url
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
nil
,
callback_google_api_authorizations_url
,
state:
namespace_project_clusters_url
.
to_s
).
authorize_url
nil
,
callback_google_api_authorizations_url
,
state:
namespace_project_clusters_url
.
to_s
).
authorize_url
rescue
GoogleApi
::
Auth
::
ConfigMissingError
# no-op
end
...
...
app/models/gcp/cluster.rb
浏览文件 @
20abcbff
...
...
@@ -48,7 +48,7 @@ module Gcp
validates
:gcp_cluster_zone
,
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
,
allow_blank:
true
,
...
...
app/services/ci/fetch_gcp_operation_service.rb
浏览文件 @
20abcbff
module
Ci
class
FetchGcpOperationService
def
execute
(
cluster
)
api_client
=
api_client
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
operation
=
api_client
.
projects_zones_operations
(
...
...
app/services/ci/finalize_cluster_creation_service.rb
浏览文件 @
20abcbff
module
Ci
class
FinalizeClusterCreationService
def
execute
(
cluster
)
api_client
=
api_client
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
begin
...
...
app/services/ci/provision_cluster_service.rb
浏览文件 @
20abcbff
...
...
@@ -6,12 +6,11 @@ module Ci
begin
operation
=
api_client
.
projects_zones_clusters_create
(
cluster
.
gcp_project_id
,
cluster
.
gcp_cluster_zone
,
cluster
.
gcp_cluster_name
,
cluster
.
gcp_cluster_size
,
machine_type:
cluster
.
gcp_machine_type
)
cluster
.
gcp_project_id
,
cluster
.
gcp_cluster_zone
,
cluster
.
gcp_cluster_name
,
cluster
.
gcp_cluster_size
,
machine_type:
cluster
.
gcp_machine_type
)
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
end
...
...
lib/gitlab/import_export/import_export.yml
浏览文件 @
20abcbff
...
...
@@ -53,6 +53,7 @@ project_tree:
-
:auto_devops
-
:triggers
-
:pipeline_schedules
-
:clusters
-
:services
-
:hooks
-
protected_branches
:
...
...
lib/gitlab/import_export/relation_factory.rb
浏览文件 @
20abcbff
...
...
@@ -8,6 +8,7 @@ module Gitlab
triggers:
'Ci::Trigger'
,
pipeline_schedules:
'Ci::PipelineSchedule'
,
builds:
'Ci::Build'
,
clusters:
'Gcp::Cluster'
,
hooks:
'ProjectHook'
,
merge_access_levels:
'ProtectedBranch::MergeAccessLevel'
,
push_access_levels:
'ProtectedBranch::PushAccessLevel'
,
...
...
lib/gitlab/path_regex.rb
浏览文件 @
20abcbff
...
...
@@ -33,6 +33,7 @@ module Gitlab
explore
favicon.ico
files
google_api
groups
health_check
help
...
...
lib/google_api/auth.rb
浏览文件 @
20abcbff
...
...
@@ -46,7 +46,7 @@ module GoogleApi
config
.
app_id
,
config
.
app_secret
,
site:
'https://accounts.google.com'
,
token_url:
'/o/oauth2/token'
,
token_url:
'/o/oauth2/token'
,
authorize_url:
'/o/oauth2/auth'
)
end
...
...
lib/google_api/cloud_platform/client.rb
浏览文件 @
20abcbff
...
...
@@ -44,16 +44,15 @@ module GoogleApi
service
.
authorization
=
access_token
request_body
=
Google
::
Apis
::
ContainerV1
::
CreateClusterRequest
.
new
(
{
"cluster"
:
{
"name"
:
cluster_name
,
"initial_node_count"
:
cluster_size
,
"node_config"
:
{
"machine_type"
:
machine_type
# Default 3.75 GB, if ommit
}
{
"cluster"
:
{
"name"
:
cluster_name
,
"initial_node_count"
:
cluster_size
,
"node_config"
:
{
"machine_type"
:
machine_type
}
}
)
}
)
service
.
create_cluster
(
project_id
,
zone
,
request_body
)
end
...
...
spec/lib/gitlab/import_export/all_models.yml
浏览文件 @
20abcbff
...
...
@@ -147,6 +147,10 @@ deploy_keys:
-
user
-
deploy_keys_projects
-
projects
clusters
:
-
project
-
user
-
service
services
:
-
project
-
service_hook
...
...
@@ -177,6 +181,7 @@ project:
-
tag_taggings
-
tags
-
chat_services
-
cluster
-
creator
-
group
-
namespace
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录