

亚马逊 CodeCatalyst 不再向新买家开放。现有客户可以继续正常使用该服务。有关更多信息，请参阅 [如何从中迁移 CodeCatalyst](migration.md)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Devfile 事件
<a name="devenvironment-devfile-events"></a>

目前， CodeCatalyst 仅支持开发文件中的`postStart`事件。有关更多信息，请参阅 devFile.io 文档[postStartObject](https://devfile.io/docs/2.0.0/adding-event-bindings#post-start-object)中的。

以下示例说明如何在 devfile 中添加 `postStart` 事件绑定。

```
commands:
  - id: executescript
    exec:
      component: test
      commandLine: "./projects/devfiles/script.sh"
  - id: updateyum
    exec:
      component: test
      commandLine: "yum -y update --security"
events:
  postStart:
    - updateyum
    - executescript
```

启动后，您的开发环境将按照指定的 `postStart` 命令的定义顺序来执行这些命令。如果命令失败，开发环境将继续运行，并且执行输出将存储在 `/aws/mde/logs` 下的日志中。