Skip to content

Commit

Permalink
Github actions auto update oos templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ceshihao committed Sep 8, 2024
1 parent 88d9d4e commit fcef04c
Show file tree
Hide file tree
Showing 7 changed files with 663 additions and 8 deletions.
54 changes: 48 additions & 6 deletions list-templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"CreatedDate": "2019-10-22T08:17:08Z",
"Description": "{\"en\": \"Creates an ECS image\", \"zh-cn\": \"创建一个ECS镜像\", \"name-en\": \"Create Image\", \"name-zh-cn\": \"创建镜像\", \"categories\": [\"image_manage\", \"application_manage\"]}",
"HasTrigger": false,
"Hash": "eea281d8751174c935b5cb7877bff5657546f12db870127d263ddb7e6a840f04",
"Hash": "81135cac5cb27bd658eaf49dba16030e55c6fc226532ece97a383c03e30408f6",
"IsFavorite": false,
"Popularity": 8.23,
"ResourceGroupId": "rg-acfmz4wrjukykdy",
Expand All @@ -310,10 +310,10 @@
"TemplateId": "t-4bdb1745c171401883a2",
"TemplateName": "ACS-ECS-CreateImage",
"TemplateType": "Automation",
"TemplateVersion": "v16",
"TemplateVersion": "v17",
"TotalExecutionCount": -1,
"UpdatedBy": "ACS",
"UpdatedDate": "2023-12-27T08:40:56Z"
"UpdatedDate": "2024-09-06T06:00:42Z"
},
{
"Category": "Other",
Expand Down Expand Up @@ -5130,7 +5130,7 @@
"CreatedDate": "2024-06-20T08:03:57Z",
"Description": "{\"en\": \"Use lifecycleHook to modify instance charge type in the specified scaling activity\", \"zh-cn\": \"使用生命周期挂钩修改实例付费方式(仅支持弹性扩张活动)\", \"name-en\": \"ACS-ESS-LifeCycleModifyInstanceChargeType\", \"name-zh-cn\": \"使用生命周期挂钩修改实例付费方式(仅支持弹性扩张活动)\", \"categories\": [\"elastic_manage\"]}",
"HasTrigger": false,
"Hash": "d3941991ea196d6adef9be45866caf2ef22c5adbd00fd481ca75f25d3449756a",
"Hash": "56613e8cb140004ad2e667fafb23be176eb6293a91a4f02e27a01aaf6f73bcbd",
"IsFavorite": false,
"Popularity": 5,
"ResourceGroupId": "",
Expand All @@ -5140,10 +5140,10 @@
"TemplateId": "t-a4b9386581c541718b51",
"TemplateName": "ACS-ESS-LifeCycleModifyInstanceChargeType",
"TemplateType": "Automation",
"TemplateVersion": "v2",
"TemplateVersion": "v3",
"TotalExecutionCount": -1,
"UpdatedBy": "ACS",
"UpdatedDate": "2024-08-21T06:32:54Z"
"UpdatedDate": "2024-09-06T01:43:13Z"
},
{
"Category": "Other",
Expand Down Expand Up @@ -5376,6 +5376,48 @@
"UpdatedBy": "ACS",
"UpdatedDate": "2024-08-06T08:57:02Z"
},
{
"Category": "Other",
"CreatedBy": "ACS",
"CreatedDate": "2024-09-02T03:38:03Z",
"Description": "{\"en\": \"Build and deploy applications on a single ECS\", \"zh-cn\": \"在单个ECS上构建并部署应用\", \"name-en\": \"ACS-ECS-LocalBuildAndDeployOnSingleECS\", \"name-zh-cn\": \"单ECS本地构建部署\"}",
"HasTrigger": false,
"Hash": "a21e88e0534022bff616ea30e87f93862addcc05be91ec46e7204cceb24fb38d",
"IsFavorite": false,
"Popularity": 5,
"ResourceGroupId": "",
"ShareType": "Public",
"Tags": {},
"TemplateFormat": "YAML",
"TemplateId": "t-19a26faf087d4d8a8a1a",
"TemplateName": "ACS-ECS-LocalBuildAndDeployOnSingleECS",
"TemplateType": "Automation",
"TemplateVersion": "v2",
"TotalExecutionCount": -1,
"UpdatedBy": "ACS",
"UpdatedDate": "2024-09-02T05:51:04Z"
},
{
"Category": "Other",
"CreatedBy": "ACS",
"CreatedDate": "2024-09-03T09:27:39Z",
"Description": "{\"en\": \"Bulky encrypt the disks\", \"zh-cn\": \"批量加密云盘\", \"name-en\": \"ACS-ECS-BulkyEncryptDisks\", \"name-zh-cn\": \"批量加密云盘\", \"categories\": [\"security\"]}",
"HasTrigger": false,
"Hash": "e578228b6ef14ea3dfe35a1992eca70e93b2bf51ff6abfdc8f23248cae75208d",
"IsFavorite": false,
"Popularity": 5,
"ResourceGroupId": "",
"ShareType": "Public",
"Tags": {},
"TemplateFormat": "YAML",
"TemplateId": "t-5028412d133e4853976c",
"TemplateName": "ACS-ECS-BulkyEncryptDisks",
"TemplateType": "Automation",
"TemplateVersion": "v1",
"TotalExecutionCount": -1,
"UpdatedBy": "ACS",
"UpdatedDate": "2024-09-03T09:27:39Z"
},
{
"Category": "Other",
"CreatedBy": "ACS",
Expand Down
154 changes: 154 additions & 0 deletions templates/ACS-ECS-BulkyEncryptDisks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
FormatVersion: OOS-2019-06-01
Description:
en: Bulky encrypt the disks
zh-cn: 批量加密云盘
name-en: ACS-ECS-BulkyEncryptDisks
name-zh-cn: 批量加密云盘
categories:
- security
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: 目标实例
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
KMSKeyId:
Label:
en: KMSKeyId
zh-cn: 加密镜像使用的KMS密钥ID
AssociationProperty: ALIYUN::KMS::Key::KeyId
AssociationPropertyMetadata:
RegionId: regionId
Type: String
diskType:
Label:
en: DiskType
zh-cn: 磁盘类型
Type: List
AllowedValues:
- system
- data
Default:
- system
rateControl:
Label:
en: RateControl
zh-cn: 任务执行的并发比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: 获取ECS实例
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: encryptSystemDisk
Action: ACS::ECS::EncryptSystemDisk
Description:
en: Bulky encrypt the system disks
zh-cn: 批量加密系统盘
When:
Fn::Equals:
- true
- Fn::Jq:
- First
- 'contains(["system"])'
- '{{diskType}}'
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
KMSKeyId: '{{ KMSKeyId }}'
Outputs:
systemDiskEncryptedInstance:
Type: String
ValueSelector: .systemDiskEncryptedInstance
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
systemDiskEncryptedInstances:
AggregateType: Fn::ListJoin
AggregateField: systemDiskEncryptedInstance
- Name: encryptDataDisk
Action: ACS::ECS::BulkyEncryptDataDisk
Description:
en: Bulky encrypt the data disks
zh-cn: 批量加密数据盘
When:
Fn::Equals:
- true
- Fn::Jq:
- First
- 'contains(["data"])'
- '{{diskType}}'
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
KMSKeyId: '{{ KMSKeyId }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
systemDiskEncryptedInstances:
Type: Json
Value:
Fn::Jq:
- First
- '[.[][]]|.|= map(select(.))'
- '{{ encryptSystemDisk.systemDiskEncryptedInstances }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- targets
- instancePassword
- diskType
Label:
default:
zh-cn: 选择实例
en: Select Ecs Instances
- Parameters:
- KMSKeyId
Label:
default:
zh-cn: 配置KMSKey
en: Configure KMSKey
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 高级选项
en: Control Options
37 changes: 36 additions & 1 deletion templates/ACS-ECS-CreateImage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ Parameters:
AssociationPropertyMetadata:
ShowSystem: false
Default: []
whetherOnlySystemDisk:
Label:
en: WhetherOnlySystemDisk
zh-cn: 是否仅选择系统盘
Type: Boolean
Default: false
OOSAssumeRole:
Label:
en: OOSAssumeRole
Expand All @@ -53,6 +59,28 @@ Tasks:
Description:
en: Create new image with the specified image name and instance ID
zh-cn: 通过指定实例ID和镜像名称创建新的镜像
When:
Fn::Equals:
- '{{ whetherOnlySystemDisk }}'
- false
Properties:
regionId: '{{ regionId }}'
imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
instanceId: '{{ instanceId }}'
tags: '{{tags}}'
Outputs:
imageId:
ValueSelector: imageId
Type: String
- Name: createImageOnlySystemDisk
Action: ACS::ECS::CreateImageForSystemDisk
Description:
en: Create new system disk image with the specified image name and instance ID
zh-cn: 通过指定实例ID和镜像名称创建新的系统盘镜像
When:
Fn::Equals:
- '{{ whetherOnlySystemDisk }}'
- true
Properties:
regionId: '{{ regionId }}'
imageName: '{{ imageName }}__on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
Expand All @@ -65,7 +93,13 @@ Tasks:
Outputs:
imageId:
Type: String
Value: '{{ createImage.imageId }}'
Value:
Fn::If:
- Fn::Equals:
- '{{ whetherOnlySystemDisk }}'
- false
- '{{ createImage.imageId }}'
- '{{ createImageOnlySystemDisk.imageId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
Expand All @@ -79,6 +113,7 @@ Metadata:
- Parameters:
- imageName
- tags
- whetherOnlySystemDisk
Label:
default:
zh-cn: 镜像设置
Expand Down
Loading

0 comments on commit fcef04c

Please sign in to comment.