开发者指南

构建开发环境

OpenStack gate 会运行在 tox.ini 中找到的 tox 测试。开发者应该使用这些 tox 测试来验证他们的更改在 gate 作业运行时是否有效。某些系统可能需要额外的软件包才能正确运行这些测试。

要安装所有先决条件并运行功能测试,请使用 run_tests.sh 脚本

./run_tests.sh

注意

此脚本会将默认的安全加固配置应用于本地主机。避免在未经安全角色正确测试的生产服务器上运行此脚本。

编写文档

文档由两部分组成:元数据和部署者说明。元数据以 YAML frontmatter 的形式存在于每个 STIG 配置中。frontmatter 之后是部署者说明的文本。

所有说明都位于 doc/metadata/rhel7 中。以下是 V-71989 的示例

---
id: V-71989
status: implemented
tag: lsm
---

The tasks in the security role enable the appropriate Linux Security Module
(LSM) for the operating system.

For Ubuntu, openSUSE and SUSE Linux Enterprise 12 systems, AppArmor is installed and
enabled. This change takes effect immediately.

For CentOS or Red Hat Enterprise Linux systems, SELinux is enabled (in
enforcing mode) and its user tools are automatically installed. If SELinux is
not in enforcing mode already, a reboot is required to enable SELinux and
relabel the filesystem.

.. warning::

    Relabeling a filesystem takes time and the server must be offline for the
    relabeling to complete. Filesystems with large amounts of files and
    filesystems on slow disks will cause the relabeling process to take more
    time.

Deployers can opt out of this change by setting the following Ansible variable:

.. code-block:: yaml

    security_rhel7_enable_linux_security_module: no

第一个三破折号 (---) 之后的块是元数据。元数据必须包括

  • id:STIG 配置项的 ID。

  • status:STIG 配置的实施状态,例如 implementedexceptionopt-in

  • tag:与基于 STIG 需求进行更改的任务相关的 Ansible 标签,例如 auditdkernellsm

下一个块是部署者说明。说明应简明扼要,但必须回答几个关键问题

  • 更改对系统有什么作用?

  • 进行此更改的价值是什么?

  • 部署者如何选择退出或选择加入特定更改?

  • 是否有额外的在线文档可以帮助部署者决定此更改是否对他们有价值?

运行 tox -e docs 以从元数据重建文档并查看您的更改。

发布说明

添加发布说明有助于部署者和其他开发者以简洁的格式发现角色中的新添加内容。如果补丁会更改角色中一些明显的内容,例如错误修复、新功能或变量名称更改,则应将发布说明添加到传入的补丁中。

要添加发布说明,请使用 reno

reno new i-made-a-new-feature-that-does-something-awesome

一旦您使用发布说明 slug 运行 reno new 命令,一个新的文件将出现在 releasenotes/notes 中。编辑该文件并调整相关部分以解释补丁中发现的更改。删除任何未使用的部分并提交带有补丁的发布说明。

有关更多详细信息,请参阅 OpenStack-Ansible 开发者文档中关于发布说明的文档 OpenStack-Ansible 开发者文档