Skip to content

Commit fea0283

Browse files
committed
feat: enhance template metadata and outputs
- Added English description and tags to template metadata in various case.json files. - Updated version numbers for multiple templates. - Introduced SSH user and command outputs in outputs.tf files across different cloud providers. - Improved validation for required fields in case.json files. - Enhanced existing templates with architecture information.
1 parent 848cc8c commit fea0283

37 files changed

Lines changed: 392 additions & 216 deletions

File tree

.github/workflows/push-redc-templates.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ jobs:
135135
136136
# 1. 读取本地最新信息
137137
meta_name = template; meta_user = 'Unknown'; meta_desc = 'No description.'; meta_version = '0.0.0'
138+
meta_desc_en = ''; meta_tags = []
138139
case_path = os.path.join(template_path, 'case.json')
139140
try:
140141
if os.path.exists(case_path):
@@ -144,6 +145,8 @@ jobs:
144145
meta_user = c.get('user', 'Unknown')
145146
meta_desc = c.get('description', 'No description.')
146147
meta_version = c.get('version', '0.0.0')
148+
meta_desc_en = c.get('description_en', '')
149+
meta_tags = c.get('tags', [])
147150
except: pass
148151
149152
# 读取 README
@@ -163,7 +166,8 @@ jobs:
163166
# 总是更新通用元数据 (Title/Desc/Readme)
164167
manifest_data[template_id]['latest'] = meta_version
165168
manifest_data[template_id]['metadata'] = {
166-
'name': meta_name, 'author': meta_user, 'description': meta_desc, 'readme': readme_content
169+
'name': meta_name, 'author': meta_user, 'description': meta_desc,
170+
'description_en': meta_desc_en, 'tags': meta_tags, 'readme': readme_content
167171
}
168172
169173
# 3. 检查版本是否存在

.github/workflows/validate.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ jobs:
3535
3636
# case.json 必须存在的字段
3737
REQUIRED_FIELDS = {
38-
'name': '模版名称 (name)',
39-
'user': '作者 (user)',
40-
'version': '版本号 (version)',
41-
'description': '描述信息 (description)'
38+
'name': '模版名称 (name)',
39+
'user': '作者 (user)',
40+
'version': '版本号 (version)',
41+
'description': '描述信息 (description)',
42+
'description_en': '英文描述 (description_en)',
43+
'tags': '标签 (tags)'
4244
}
4345
4446
repo_root = '.'
@@ -121,6 +123,15 @@ jobs:
121123
print(f'❌ [JSON] {template_id}: Field \"version\" cannot be empty')
122124
has_error = True
123125
126+
if not data['description_en'] or str(data['description_en']).strip() == '':
127+
print(f'❌ [JSON] {template_id}: Field \"description_en\" cannot be empty')
128+
has_error = True
129+
130+
tags = data['tags']
131+
if not isinstance(tags, list) or len(tags) == 0:
132+
print(f'❌ [JSON] {template_id}: Field \"tags\" must be a non-empty list')
133+
has_error = True
134+
124135
except json.JSONDecodeError as e:
125136
print(f'❌ [JSON] {template_id}: case.json is invalid JSON! Error: {e}')
126137
has_error = True

aliyun/ecs/case.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "ecs",
3-
"user": "r0fus0d",
4-
"version": "1.0.6",
5-
"description": "引擎内嵌的阿里云 ecs 场景,仅作参考模板使用",
6-
"description_en": "Aliyun ECS scenario embedded in the engine, for reference only",
7-
"template": "preset",
8-
"tags": [
9-
"base",
10-
"infra"
11-
]
12-
}
2+
"name": "ecs",
3+
"arch": "x86_64",
4+
"user": "r0fus0d",
5+
"version": "1.0.7",
6+
"description": "引擎内嵌的阿里云 ecs 场景,仅作参考模板使用",
7+
"description_en": "Aliyun ECS scenario embedded in the engine, for reference only",
8+
"template": "preset",
9+
"tags": [
10+
"base",
11+
"infra"
12+
]
13+
}

aliyun/ecs/outputs.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ output "ecs_ip" {
55
output "ecs_password" {
66
value = nonsensitive(local.instance_password)
77
description = "vps password."
8-
}
8+
}
9+
output "ssh_user" {
10+
description = "SSH 登录用户名"
11+
value = "root"
12+
}
13+
14+
output "ssh_command" {
15+
description = "SSH 连接命令"
16+
value = "ssh root@${alicloud_instance.instance.public_ip}"
17+
}

aliyun/ecs1c2g/case.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "ecs1c2g",
3-
"user": "r0fus0d",
4-
"version": "1.0.6",
5-
"description": "阿里云 ecs 场景,采用 ecs.n1.small 规格, 1核 2G 20G存储",
6-
"description_en": "Aliyun ECS scenario with ecs.n1.small specification, 1 core 2GB RAM 20GB storage",
7-
"template": "preset",
8-
"tags": [
9-
"base",
10-
"infra"
11-
]
12-
}
2+
"name": "ecs1c2g",
3+
"arch": "x86_64",
4+
"user": "r0fus0d",
5+
"version": "1.0.7",
6+
"description": "阿里云 ecs 场景,采用 ecs.n1.small 规格, 1核 2G 20G存储",
7+
"description_en": "Aliyun ECS scenario with ecs.n1.small specification, 1 core 2GB RAM 20GB storage",
8+
"template": "preset",
9+
"tags": [
10+
"base",
11+
"infra"
12+
]
13+
}

aliyun/ecs1c2g/outputs.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ output "ecs_ip" {
55
output "ecs_password" {
66
value = nonsensitive(local.instance_password)
77
description = "vps password."
8-
}
8+
}
9+
output "ssh_user" {
10+
description = "SSH 登录用户名"
11+
value = "root"
12+
}
13+
14+
output "ssh_command" {
15+
description = "SSH 连接命令"
16+
value = "ssh root@${alicloud_instance.instance.public_ip}"
17+
}

aliyun/file/case.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "file",
3-
"user": "r0fus0d",
4-
"version": "1.0.6",
5-
"description": "阿里云文件服务场景,采用 ecs.n1.small 规格,1核 2G,30G 系统盘,预装 simplehttpserver 及常用运维工具",
6-
"description_en": "Aliyun file service scenario with ecs.n1.small specification, 1 core 2GB RAM, 30GB system disk, pre-installed simplehttpserver and common operation tools",
7-
"template": "preset",
8-
"tags": [
9-
"file",
10-
"infra"
11-
]
12-
}
2+
"name": "file",
3+
"arch": "x86_64",
4+
"user": "r0fus0d",
5+
"version": "1.0.7",
6+
"description": "阿里云文件服务场景,采用 ecs.n1.small 规格,1核 2G,30G 系统盘,预装 simplehttpserver 及常用运维工具",
7+
"description_en": "Aliyun file service scenario with ecs.n1.small specification, 1 core 2GB RAM, 30GB system disk, pre-installed simplehttpserver and common operation tools",
8+
"template": "preset",
9+
"tags": [
10+
"file",
11+
"infra"
12+
]
13+
}

aliyun/file/outputs.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ output "ecs_ip" {
55
output "ecs_password" {
66
value = nonsensitive(local.instance_password)
77
description = "vps password."
8-
}
8+
}
9+
output "ssh_user" {
10+
description = "SSH 登录用户名"
11+
value = "root"
12+
}
13+
14+
output "ssh_command" {
15+
description = "SSH 连接命令"
16+
value = "ssh root@${alicloud_instance.instance.public_ip}"
17+
}

aliyun/jndi/case.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2-
"name": "jndi",
3-
"user": "r0fus0d",
4-
"version": "1.0.6",
5-
"description": "阿里云 JNDI 演练场景,采用 ecs.n1.small 规格,1核 2G,20G 系统盘,预置 JDK8、JNDIExploit、java-chains、simplehttpserver 等组件",
6-
"description_en": "Aliyun JNDI practice scenario with ecs.n1.small specification, 1 core 2GB RAM, 20GB system disk, pre-installed JDK8, JNDIExploit, java-chains, simplehttpserver and other components",
7-
"template": "preset",
8-
"tags": [
9-
"range"
10-
]
11-
}
2+
"name": "jndi",
3+
"arch": "x86_64",
4+
"user": "r0fus0d",
5+
"version": "1.0.7",
6+
"description": "阿里云 JNDI 演练场景,采用 ecs.n1.small 规格,1核 2G,20G 系统盘,预置 JDK8、JNDIExploit、java-chains、simplehttpserver 等组件",
7+
"description_en": "Aliyun JNDI practice scenario with ecs.n1.small specification, 1 core 2GB RAM, 20GB system disk, pre-installed JDK8, JNDIExploit, java-chains, simplehttpserver and other components",
8+
"template": "preset",
9+
"tags": [
10+
"range"
11+
]
12+
}

aliyun/jndi/outputs.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ output "ecs_ip" {
55
output "ecs_password" {
66
value = nonsensitive(local.instance_password)
77
description = "vps password."
8-
}
8+
}
9+
output "ssh_user" {
10+
description = "SSH 登录用户名"
11+
value = "root"
12+
}
13+
14+
output "ssh_command" {
15+
description = "SSH 连接命令"
16+
value = "ssh root@${alicloud_instance.instance.public_ip}"
17+
}

0 commit comments

Comments
 (0)