跳至内容

使用 oci-env 运行 Galaxy NG

设置你的环境

请按照 oci-env 仓库 中提供的说明进行操作。设置你的 compose.env 文件时,请使用这个文件。

# : separated list of profiles to use. Ex: galaxy_ng/base:galaxy_ng/ui
COMPOSE_PROFILE=galaxy_ng/base

# : separate list of python dependencies to include from source
DEV_SOURCE_PATH=galaxy_ng

# Program to use for compose. This defaults to podman. Uncomment this to use docker-compose.
COMPOSE_BINARY=docker

# Set any custom pulp settings by adding environment variables with the PULP_ prefix
# PULP_MY_SETTING....

# Django admin user credentials that gets created during startup
# DJANGO_SUPERUSER_USERNAME=admin
# DJANGO_SUPERUSER_PASSWORD=password

# Port, hostname and protocol used to configure pulp content origin
# API_HOST=localhost
# API_PORT=5001
# API_PROTOCOL=http

这将从源代码启动 galax_ng(参见 DEV_SOURCE_PATH),使用 galaxy_ng/base 配置文件(参见 COMPOSE_PROFILE)。你可以使用 oci-env profile docs galaxy_ng/base 获取此配置文件可用选项的更多信息。

其他配置文件位于 profiles/ 目录下。

使用 Keycloak、Insights 模式和 LDAP 进行开发

所有这些模式的配置文件都可以在 galaxy_ng 中找到。只需将它们添加到你的 COMPOSE_PROFILE 中即可。

# compose.env

# LDAP
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/ldap

# Insights
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/insights

# Keycloak
COMPOSE_PROFILE=galaxy_ng/base:galaxy_ng/keycloak

每个配置文件的更多文档可以在其各自的 README 文件中找到,或者使用 oci-env profile docs 命令。

测试

集成

要在你的当前环境中运行测试,请 cd 到你的 galaxy_ng 文件夹并运行 make oci-env/integration。这将运行你已配置的配置文件预期通过的集成测试。测试应该足够智能,可以确定你是否为 galaxy ng 定制了 url 或端口。这接受一个 FLAGS 参数,允许你发送自定义 pystest 标志,例如 make oci-env/integration FLAGS="-m rbac_roles -k test_admin_permissions"-k 标志特别有用,因为它允许你按名称或文件名选择特定测试。

要运行 GitHub Actions 中运行的相同测试,请运行 make gh-action/<action>(例如 make gh-action/standalone)。请参阅 Makefile 以了解所有受支持的目标。这将以与 GitHub Actions 相同的方式启动堆栈并运行 CI 管道运行的相同测试集。此命令将负责配置整个环境、运行测试和拆除环境。

make gh-action/* 接受以下环境变量:

  • GH_DUMP_LOGS=1 -> 在测试运行完成后打印服务器日志。
  • GH_TEARDOWN=0 -> 测试退出后不拆除环境。这允许你重新运行操作,而无需每次都等待环境重新配置。
  • GH_FLAGS="pytest flags" -> 允许你向集成测试传递自定义 pytest 标志。

示例:GH_FLAGS="-k test_delete_collection" GH_DUMP_LOGS=1 GH_TEARDOWN=0 make gh-action/standalone

功能测试和单元测试

有关运行单元测试和功能测试的信息,请参阅 oci-env README