Skip to content

Commit

Permalink
feat: add chartmuseum support for template repo
Browse files Browse the repository at this point in the history
Signed-off-by: chenzhixiang <[email protected]>
  • Loading branch information
chenzhixiang committed Nov 9, 2022
1 parent e04a98a commit 7a5faab
Show file tree
Hide file tree
Showing 10 changed files with 431 additions and 172 deletions.
207 changes: 207 additions & 0 deletions build-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"type": "object",
"required": [
"buildType"
],
"properties": {
"buildType": {
"type": "string",
"title": "构建方式",
"oneOf": [
{
"enum": [
"netease-normal"
],
"title": "音乐常规构建"
},
{
"enum": [
"neteaseDockerFile"
],
"title": "DockerFile构建"
}
],
"default": "netease-normal"
}
},
"dependencies": {
"buildType": {
"oneOf": [
{
"properties": {
"buildType": {
"enum": [
"netease-normal"
]
},
"language": {
"type": "string",
"title": "语言",
"description": "选择目标构建语言",
"enum": [
"java",
"node",
"golang"
]
},
"buildInfo": {
"type": "object",
"title": "",
"properties": {
"buildTool": {
"type": "string",
"title": "构建工具",
"description": "选择云音乐Ant构建或者Shell构建",
"oneOf": [
{
"enum": [
"ant"
],
"title": "ant构建"
}
]
}
},
"dependencies": {
"buildTool": {
"oneOf": [
{
"properties": {
"buildTool": {
"enum": [
"ant"
]
},
"buildxml": {
"type": "string",
"title": "build.xml",
"default": "dsdadsa"
}
}
}
]
}
}
}
},
"dependencies": {
"language": {
"oneOf": [
{
"properties": {
"language": {
"enum": [
"java"
]
},
"environment": {
"type": "string",
"title": "环境",
"description": "目标制品包含的依赖",
"enum": [
"javaapp",
"tomcat7_jdk8",
"tomcat8_5_jdk8",
"springboot_jdk1_8"
],
"default": "javaapp"
}
}
},
{
"properties": {
"language": {
"enum": [
"golang"
]
},
"environment": {
"type": "string",
"title": "环境",
"description": "目标制品包含的依赖",
"enum": [
"golang-1.6.5"
],
"default": "golang-1.6.5"
}
}
},
{
"properties": {
"language": {
"enum": [
"node"
]
},
"environment": {
"type": "string",
"title": "环境",
"description": "目标制品包含的依赖",
"enum": [
"nodejs-8_11_2"
],
"default": "nodejs-8_11_2"
}
}
}
]
}
}
},
{
"properties": {
"buildType": {
"enum": [
"neteaseDockerFile"
]
},
"dockerfile": {
"type": "object",
"title": "Dockerfile",
"oneOf": [
{
"title": "dockerfile路径",
"properties": {
"path": {
"type": "string",
"description": "dockerfile文件相对于代码工程中子目录的路径"
}
},
"required": [
"path"
]
},
{
"title": "dockerfile内容",
"properties": {
"content": {
"type": "string"
}
},
"required": [
"content"
]
}
]
},
"buildArgs": {
"type": "array",
"title": "构建参数",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
}
]
}
}
}
38 changes: 38 additions & 0 deletions build-ui-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"ui:order": [
"buildType",
"language",
"environment",
"buildInfo",
"dockerfile",
"buildArgs"
],
"buildInfo": {
"buildxml": {
"ui:widget": "textarea",
"ui:options": {
"rows": 18
}
},
"shellScript": {
"ui:widget": "textarea",
"ui:options": {
"rows": 18
}
}
},
"dockerfile": {
"content": {
"ui:widget": "textarea",
"ui:options": {
"rows": 18
}
}
},
"buildType": {
"ui:widget": "radio",
"ui:options": {
"inline": true
}
}
}
7 changes: 1 addition & 6 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ redisConfig:
address: dev.redis:6379
password: redis
db: 1
oidcConfig:
userHeader: X-HORIZON-OIDC-USER
fullNameHeader: X-HORIZON-OIDC-FULLNAME
emailHeader: X-HORIZON-OIDC-EMAIL
oidcIDHeader: X-HORIZON-OIDC-ID
oidcTypeHeader: X-HORIZON-OIDC-TYPE
gitlabMapper:
template:
httpURL: https://g.hz.netease.com
Expand All @@ -39,6 +33,7 @@ gitlabMapper:
gitopsRepoConfig:
rootGroupPath: music-cloud-native
templateRepo:
kind: "harbor"
host: "https://harbor.mock.org"
repoName: "horizon-template"
username: ""
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ import (
"g.hz.netease.com/horizon/pkg/server/middleware/requestid"
"g.hz.netease.com/horizon/pkg/templaterelease/output"
templateschemarepo "g.hz.netease.com/horizon/pkg/templaterelease/schema/repo"
templaterepoharbor "g.hz.netease.com/horizon/pkg/templaterepo/harbor"
"g.hz.netease.com/horizon/pkg/templaterepo"
userservice "g.hz.netease.com/horizon/pkg/user/service"
"g.hz.netease.com/horizon/pkg/util/kube"
callbacks "g.hz.netease.com/horizon/pkg/util/ormcallbacks"
Expand Down Expand Up @@ -280,7 +280,7 @@ func Run(flags *Flags) {
panic(err)
}

templateRepo, err := templaterepoharbor.NewRepo(coreConfig.TemplateRepo)
templateRepo, err := templaterepo.NewRepo(coreConfig.TemplateRepo)
if err != nil {
panic(err)
}
Expand Down
Loading

0 comments on commit 7a5faab

Please sign in to comment.