Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
5ebe366e
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5ebe366e
编写于
4月 15, 2016
作者:
Y
Yiming Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ingore empty item when build release
上级
a5ff9a98
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
18 deletion
+27
-18
apollo-adminservice/pom.xml
apollo-adminservice/pom.xml
+5
-0
apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ReleaseService.java
...ain/java/com/ctrip/apollo/biz/service/ReleaseService.java
+4
-0
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
...ain/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
+1
-1
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
.../com/ctrip/apollo/portal/controller/ConfigController.java
+1
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java
...n/java/com/ctrip/apollo/portal/service/ConfigService.java
+15
-13
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/txtresolver/PropertyResolver.java
...p/apollo/portal/service/txtresolver/PropertyResolver.java
+1
-1
未找到文件。
apollo-adminservice/pom.xml
浏览文件 @
5ebe366e
...
...
@@ -64,6 +64,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
...
...
apollo-biz/src/main/java/com/ctrip/apollo/biz/service/ReleaseService.java
浏览文件 @
5ebe366e
...
...
@@ -15,6 +15,7 @@ import com.ctrip.apollo.biz.repository.ItemRepository;
import
com.ctrip.apollo.biz.repository.NamespaceRepository
;
import
com.ctrip.apollo.biz.repository.ReleaseRepository
;
import
com.ctrip.apollo.core.exception.NotFoundException
;
import
com.ctrip.apollo.core.utils.StringUtils
;
import
com.google.gson.Gson
;
/**
...
...
@@ -50,6 +51,9 @@ public class ReleaseService {
List
<
Item
>
items
=
itemRepository
.
findByNamespaceIdOrderByLineNumAsc
(
namespace
.
getId
());
Map
<
String
,
String
>
configurations
=
new
HashMap
<
String
,
String
>();
for
(
Item
item
:
items
)
{
if
(
StringUtils
.
isEmpty
(
item
.
getKey
()))
{
continue
;
}
configurations
.
put
(
item
.
getKey
(),
item
.
getValue
());
}
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/AdminServiceAPI.java
浏览文件 @
5ebe366e
...
...
@@ -76,7 +76,7 @@ public class AdminServiceAPI {
public
List
<
ItemDTO
>
findItems
(
String
appId
,
Env
env
,
String
clusterName
,
String
namespace
)
{
if
(
StringUtils
.
isContainEmpty
(
appId
,
clusterName
,
namespace
))
{
return
Collections
.
EMPTY_LIST
;
return
Collections
.
emptyList
()
;
}
return
Arrays
.
asList
(
restTemplate
.
getForObject
(
getAdminServiceHost
(
env
)
+
String
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
浏览文件 @
5ebe366e
...
...
@@ -11,7 +11,6 @@ import com.ctrip.apollo.portal.entity.form.NamespaceReleaseModel;
import
com.ctrip.apollo.portal.service.ConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -39,7 +38,7 @@ public class ConfigController {
@RequestMapping
(
value
=
"/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
method
=
RequestMethod
.
PUT
,
consumes
=
{
"application/json"
})
public
ResponseEntity
modifyItems
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
public
void
modifyItems
(
@PathVariable
String
appId
,
@PathVariable
String
env
,
@PathVariable
String
clusterName
,
@PathVariable
String
namespaceName
,
@RequestBody
NamespaceTextModel
model
)
{
...
...
@@ -56,7 +55,6 @@ public class ConfigController {
}
configService
.
updateConfigItemByText
(
model
);
return
ResponseEntity
.
ok
().
build
();
}
@RequestMapping
(
value
=
"/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/release"
,
method
=
RequestMethod
.
POST
,
consumes
=
{
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java
浏览文件 @
5ebe366e
package
com.ctrip.apollo.portal.service
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -47,6 +46,7 @@ public class ConfigService {
/**
* load cluster all namespace info with items
*
* @param appId
* @param env
* @param clusterName
...
...
@@ -56,7 +56,7 @@ public class ConfigService {
List
<
NamespaceDTO
>
namespaces
=
groupAPI
.
findGroupsByAppAndCluster
(
appId
,
env
,
clusterName
);
if
(
namespaces
==
null
||
namespaces
.
size
()
==
0
)
{
return
Collections
.
EMPTY_LIST
;
return
Collections
.
emptyList
()
;
}
List
<
NamespaceVO
>
namespaceVOs
=
new
LinkedList
<>();
...
...
@@ -67,8 +67,8 @@ public class ConfigService {
namespaceVO
=
parseNamespace
(
appId
,
env
,
clusterName
,
namespace
);
namespaceVOs
.
add
(
namespaceVO
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"parse namespace error. app id:{}, env:{}, clusterName:{}, namespace:{}"
,
appId
,
env
,
clusterName
,
namespace
.
getNamespaceName
(),
e
);
logger
.
error
(
"parse namespace error. app id:{}, env:{}, clusterName:{}, namespace:{}"
,
appId
,
env
,
clusterName
,
namespace
.
getNamespaceName
(),
e
);
return
namespaceVOs
;
}
}
...
...
@@ -76,8 +76,8 @@ public class ConfigService {
return
namespaceVOs
;
}
@SuppressWarnings
(
"unchecked"
)
private
NamespaceVO
parseNamespace
(
String
appId
,
Env
env
,
String
clusterName
,
NamespaceDTO
namespace
)
{
NamespaceVO
namespaceVO
=
new
NamespaceVO
();
namespaceVO
.
setNamespace
(
namespace
);
...
...
@@ -133,7 +133,8 @@ public class ConfigService {
/**
* parse config text and update config items
* @return parse result
*
* @return parse result
*/
public
void
updateConfigItemByText
(
NamespaceTextModel
model
)
{
String
appId
=
model
.
getAppId
();
...
...
@@ -143,8 +144,8 @@ public class ConfigService {
long
namespaceId
=
model
.
getNamespaceId
();
String
configText
=
model
.
getConfigText
();
ItemChangeSets
changeSets
=
resolver
.
resolve
(
namespaceId
,
configText
,
itemAPI
.
findItems
(
appId
,
env
,
clusterName
,
namespaceName
));
ItemChangeSets
changeSets
=
resolver
.
resolve
(
namespaceId
,
configText
,
itemAPI
.
findItems
(
appId
,
env
,
clusterName
,
namespaceName
));
try
{
changeSets
.
setModifyBy
(
model
.
getModifyBy
());
enrichChangeSetBaseInfo
(
changeSets
);
...
...
@@ -155,18 +156,19 @@ public class ConfigService {
}
private
void
enrichChangeSetBaseInfo
(
ItemChangeSets
changeSets
){
for
(
ItemDTO
item
:
changeSets
.
getCreateItems
())
{
private
void
enrichChangeSetBaseInfo
(
ItemChangeSets
changeSets
)
{
for
(
ItemDTO
item
:
changeSets
.
getCreateItems
())
{
item
.
setDataChangeCreatedTime
(
new
Date
());
}
}
/**
* createRelease config items
*
* @return
*/
public
ReleaseDTO
createRelease
(
NamespaceReleaseModel
model
){
return
releaseAPI
.
release
(
model
.
getAppId
(),
model
.
getEnv
(),
model
.
getClusterName
(),
model
.
getNamespaceName
(),
model
.
getReleaseBy
(),
model
.
getReleaseComment
());
public
ReleaseDTO
createRelease
(
NamespaceReleaseModel
model
)
{
return
releaseAPI
.
release
(
model
.
getAppId
(),
model
.
getEnv
(),
model
.
getClusterName
(),
model
.
getNamespaceName
(),
model
.
getReleaseBy
(),
model
.
getReleaseComment
());
}
}
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/txtresolver/PropertyResolver.java
浏览文件 @
5ebe366e
...
...
@@ -45,7 +45,7 @@ public class PropertyResolver implements ConfigTextResolver {
}
ItemChangeSets
changeSets
=
new
ItemChangeSets
();
Map
<
Integer
,
String
>
newLineNumMapItem
=
new
HashMap
();
//use for delete blank and comment item
Map
<
Integer
,
String
>
newLineNumMapItem
=
new
HashMap
<
Integer
,
String
>
();
//use for delete blank and comment item
int
lineCounter
=
1
;
for
(
String
newItem
:
newItems
)
{
newItem
=
newItem
.
trim
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录