本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
在 Image YAML Builder 中为自定义组件创建组件文档
要构建组件,必须提供YAML或JSON应用程序组件文档。该文档包含在您为自定义图像而定义的各个阶段和步骤中运行的代码。
本节中的示例创建了一个生成组件,该组件在 AWSTOE 组件管理应用程序中调用UpdateOS
操作模块。该模块更新操作系统。有关 UpdateOS
操作模块的更多信息,请参阅 UpdateOS。有关 AWSTOE 应用程序组件文档的阶段、步骤和语法的更多信息,请参阅在中使用文档 AWSTOE。
Image Builder 根据组件文档中定义的阶段来确定组件类型,如下所示:
有关 Image Builder 如何在其构建过程中使用阶段 (stage) 和时段 (phase) 来管理组件工作流的更多信息,请参阅 使用组件自定义 Image Builder 镜像。
要为示例YAML应用程序创建应用程序组件文档,请按照与您的映像操作系统匹配的选项卡上的步骤进行操作。
- Linux
-
创建YAML组件文件
使用文件编辑工具创建您的组件文档。文档示例使用名为的文件update-linux-os.yaml
,其内容如下:
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: update-linux-os
description: Updates Linux with the latest security updates.
schemaVersion: 1
phases:
- name: build
steps:
- name: UpdateOS
action: UpdateOS
# Document End
- Windows
-
创建YAML组件文件
使用文件编辑工具创建您的组件文档。文档示例使用名为的文件update-windows-os.yaml
,其内容如下:
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
name: update-windows-os
description: Updates Windows with the latest security updates.
schemaVersion: 1.0
phases:
- name: build
steps:
- name: UpdateOS
action: UpdateOS
# Document End