-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathACS::CICD::SoftwarePackageDeployOnSingleEcs.json
More file actions
165 lines (165 loc) · 4.71 KB
/
ACS::CICD::SoftwarePackageDeployOnSingleEcs.json
File metadata and controls
165 lines (165 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS::CICD::SoftwarePackageDeployOnSingleEcs",
"name-zh-cn": "部署软件包在单台ECS",
"en": "Pull software package from OSS and deploy (only support linux machine)",
"zh-cn": "从OSS拉取软件包并部署 (仅支持在linux机器部署)"
},
"Parameters": {
"regionId": {
"Label": {
"en": "region",
"zh-cn": "地域"
},
"Type": "String",
"Default": "{{ ACS::RegionId }}",
"AssociationProperty": "RegionId"
},
"instanceId": {
"Label": {
"en": "ECSInstanceId",
"zh-cn": "ECS实例ID"
},
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceId",
"AssociationPropertyMetadata": {
"RegionId": "regionId"
}
},
"bucketName": {
"Label": {
"en": "Bucket Name",
"zh-cn": "OSS bucket 名称"
},
"Type": "String",
"AssociationProperty": "ALIYUN::OSS::Bucket::BucketName",
"AssociationPropertyMetadata": {
"RegionId": "regionId"
}
},
"objectName": {
"Label": {
"en": "ObjectName",
"zh-cn": "OSS object 名称"
},
"Type": "String",
"AssociationProperty": "ALIYUN::OSS::Object::ObjectName",
"AssociationPropertyMetadata": {
"RegionId": "regionId",
"BucketName": "bucketName",
"ValueType": "bucketName"
}
},
"isInternal": {
"Label": {
"en": "Whether to generate an internal url",
"zh-cn": "是否生成内网URL"
},
"Description": {
"en": "False generates an public url, True generates an internal url. If the ECS and OSS are in the same region, you can choose True to download via the internal URL, which saves traffic fees.",
"zh-cn": "False生成公网URL,True生成内网URL。如果您要下载到的ECS和OSS同地域,可选择True,通过内网URL下载,节省流量。"
},
"Type": "Boolean",
"Default": true
},
"downloadPath": {
"Label": {
"en": "DownloadPath",
"zh-cn": "下载路径"
},
"Description": {
"en": "The path to download the file to",
"zh-cn": "下载文件的路径"
},
"Type": "String",
"Default": "/home/admin/app/"
},
"deployScript": {
"Label": {
"en": "DeployScript",
"zh-cn": "部署脚本"
},
"Description": {
"en": "The script to deploy",
"zh-cn": "部署脚本"
},
"Type": "String",
"AssociationProperty": "ALIYUN::OOS::Command::CommandContent",
"AssociationPropertyMetadata": {
"CommandType": "RunShellScript"
},
"Default": "# sample deploy script\n# tar zxvf /home/admin/app/buildMaterial-{{ACS::ExecutionId}}.tgz -C /home/admin/app/\n# java -jar sample-spring-1.0-SNAPSHOT.jar --service.port=8080 &"
}
},
"Tasks": [
{
"Name": "checkInstance",
"Action": "ACS::CheckFor",
"Description": "Checks if the ECS OSType is linux",
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"InstanceIds": [
"{{ instanceId }}"
]
},
"DesiredValues": [
"linux"
],
"PropertySelector": "Instances.Instance[].OSType"
}
},
{
"Name": "generateOssUrl",
"Action": "ACS::OSS::GenerateUrl",
"Description": {
"en": "Generate Oss url",
"zh-cn": "生成 Oss URL"
},
"Properties": {
"regionId": "{{ regionId }}",
"bucketName": "{{ bucketName }}",
"objectName": "{{ objectName }}",
"isInternal": "{{ isInternal }}"
},
"Outputs": {
"temporaryUrl": {
"Type": "String",
"ValueSelector": ".temporaryUrl"
}
}
},
{
"Name": "downloadDeployMaterial",
"Action": "ACS::ECS::DownloadFile",
"Description": {
"en": "Download DeployMaterial from OSS",
"zh-cn": "从OSS下载部署物"
},
"Properties": {
"regionId": "{{ regionId }}",
"instanceId": "{{ instanceId }}",
"sourceType": "https",
"sourcePath": "{{ generateOssUrl.temporaryUrl }}",
"destinationDir": "{{ downloadPath }}"
}
},
{
"Name": "deploy",
"Action": "ACS::ECS::RunCommand",
"Description": {
"en": "Deploy",
"zh-cn": "部署"
},
"Properties": {
"regionId": "{{ regionId }}",
"instanceId": "{{ instanceId }}",
"commandType": "RunShellScript",
"workingDir": "{{ downloadPath }}",
"commandContent": "{{ deployScript }}"
}
}
]
}