mirror of
https://github.com/d9pouces/id_configurator.git
synced 2026-11-09 01:47:21 +01:00
feat: add new configuration files for Apt, Apk, Java, and Yum
Signed-off-by: d9pouces <github@19pouces.net>
This commit is contained in:
+2
-2
@@ -28,7 +28,7 @@ def _file(relative: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def render_template(text: str) -> str:
|
def render_template(text: str) -> str:
|
||||||
"""Render a tests/configs/*.yaml.tmpl fixture as a Jinja2 template.
|
"""Render a tests/configs/*.yaml.j2 fixture as a Jinja2 template.
|
||||||
|
|
||||||
Custom filters: `| env` reads an environment variable, `| file` reads a
|
Custom filters: `| env` reads an environment variable, `| file` reads a
|
||||||
file relative to tests/. Combine with Jinja2's built-in `indent` filter
|
file relative to tests/. Combine with Jinja2's built-in `indent` filter
|
||||||
@@ -48,7 +48,7 @@ def render_template(text: str) -> str:
|
|||||||
|
|
||||||
@app.command(
|
@app.command(
|
||||||
name="render-config",
|
name="render-config",
|
||||||
help="Render a tests/configs/*.yaml.tmpl fixture into a ready-to-use configuration.",
|
help="Render a tests/configs/*.yaml.j2 fixture into a ready-to-use configuration.",
|
||||||
)
|
)
|
||||||
def render_config(
|
def render_config(
|
||||||
template: Annotated[pathlib.Path, typer.Argument(exists=True, dir_okay=False)],
|
template: Annotated[pathlib.Path, typer.Argument(exists=True, dir_okay=False)],
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
uuid: 3d2f6a44-8b19-4c2b-9e7a-1f5c8a2d6b90
|
||||||
|
organisation: InterDiode
|
||||||
|
description: Apk test configuration
|
||||||
|
configurations:
|
||||||
|
certificates: []
|
||||||
|
apt:
|
||||||
|
sources: []
|
||||||
|
keys: []
|
||||||
|
apk:
|
||||||
|
repositories:
|
||||||
|
- url: http://host.docker.internal:{{ 'APK_REPO_PORT' | env }}/
|
||||||
|
key: |
|
||||||
|
{{ 'dockerfiles/repos/040d0af5f97a0a44.rsa.pub' | file | indent(8, first=true) }}
|
||||||
|
yum:
|
||||||
|
repositories: []
|
||||||
|
keys: []
|
||||||
|
python:
|
||||||
|
repositories: []
|
||||||
|
java:
|
||||||
|
repositories: []
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
uuid: 0147050d-d045-4719-b084-e2b1f337290e
|
||||||
|
organisation: InterDiode
|
||||||
|
description: Apt test configuration
|
||||||
|
configurations:
|
||||||
|
certificates:
|
||||||
|
- name: Test CA
|
||||||
|
content: |
|
||||||
|
{{ 'certs/test-ca.crt.pem' | file | indent(6, first=true) }}
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- name: demo
|
||||||
|
types: [deb]
|
||||||
|
uris:
|
||||||
|
- https://host.docker.internal:{{ 'APT_REPO_PORT' | env }}/
|
||||||
|
suites: ["./"]
|
||||||
|
trusted: true
|
||||||
|
keys: []
|
||||||
|
apk:
|
||||||
|
repositories: []
|
||||||
|
yum:
|
||||||
|
repositories: []
|
||||||
|
keys: []
|
||||||
|
python:
|
||||||
|
repositories: []
|
||||||
|
java:
|
||||||
|
repositories: []
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
uuid: 6a1d4e2c-9f3b-4a5d-8c7e-2b1f9a6d4c3e
|
||||||
|
organisation: InterDiode
|
||||||
|
description: Java test configuration
|
||||||
|
configurations:
|
||||||
|
certificates: []
|
||||||
|
apt:
|
||||||
|
sources: []
|
||||||
|
keys: []
|
||||||
|
apk:
|
||||||
|
repositories: []
|
||||||
|
yum:
|
||||||
|
repositories: []
|
||||||
|
keys: []
|
||||||
|
python:
|
||||||
|
repositories: []
|
||||||
|
java:
|
||||||
|
repositories:
|
||||||
|
- name: central
|
||||||
|
url: http://host.docker.internal:{{ 'JAVA_REPO_PORT' | env }}/
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
uuid: 8f6a0e2a-5b7a-4d2c-9d1a-3c2b6b9c4b7e
|
||||||
|
organisation: InterDiode
|
||||||
|
description: Yum test configuration
|
||||||
|
configurations:
|
||||||
|
certificates: []
|
||||||
|
apt:
|
||||||
|
sources: []
|
||||||
|
keys: []
|
||||||
|
apk:
|
||||||
|
repositories: []
|
||||||
|
yum:
|
||||||
|
repositories:
|
||||||
|
- name: demo
|
||||||
|
index-url: http://host.docker.internal:{{ 'YUM_REPO_PORT' | env }}/
|
||||||
|
keys: []
|
||||||
|
python:
|
||||||
|
repositories: []
|
||||||
|
java:
|
||||||
|
repositories: []
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
env_list = py313,py314,coverage,packaging,publish,module-python
|
env_list = py313,py314,coverage,packaging,publish,module-python,module-apt,module-yum,module-apk,module-java
|
||||||
isolated_build = true
|
isolated_build = true
|
||||||
requires =
|
requires =
|
||||||
tox>=4
|
tox>=4
|
||||||
@@ -10,7 +10,7 @@ package = wheel
|
|||||||
dependency_groups = test
|
dependency_groups = test
|
||||||
change_dir = {env_tmp_dir}
|
change_dir = {env_tmp_dir}
|
||||||
set_env =
|
set_env =
|
||||||
COVERAGE_FILE = {toxworkdir}/coverage/coverage.db
|
COVERAGE_FILE = {env_dir}/coverage.db
|
||||||
commands =
|
commands =
|
||||||
pytest {tox_root}/tests --cov-config={tox_root}/pyproject.toml --cov-fail-under=0 {posargs}
|
pytest {tox_root}/tests --cov-config={tox_root}/pyproject.toml --cov-fail-under=0 {posargs}
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ depends = py313,py314
|
|||||||
change_dir = {tox_root}
|
change_dir = {tox_root}
|
||||||
dependency_groups = test
|
dependency_groups = test
|
||||||
set_env =
|
set_env =
|
||||||
COVERAGE_FILE = {toxworkdir}/coverage/coverage.db
|
COVERAGE_FILE = {env_dir}/coverage.db
|
||||||
commands =
|
commands =
|
||||||
python3 -m coverage combine
|
python3 -m coverage combine
|
||||||
python3 -m coverage xml -o .tox/coverage.xml --ignore
|
python3 -m coverage xml -o .tox/coverage.xml --ignore
|
||||||
@@ -77,5 +77,102 @@ docker =
|
|||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
docker
|
docker
|
||||||
commands =
|
commands =
|
||||||
python3 -m id_tools test render-config {tox_root}/tests/configs/Python.yaml.tmpl {env_dir}/configs/Python.yaml
|
python3 -m id_tools test render-config {tox_root}/tests/configs/Python.yaml.j2 {env_dir}/configs/Python.yaml
|
||||||
docker buildx build --platform linux/amd64 --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Python.Dockerfile -t id-configurator-python .
|
docker buildx build --platform linux/amd64 --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Python.Dockerfile -t id-configurator-python .
|
||||||
|
|
||||||
|
[docker:apt-repo]
|
||||||
|
dockerfile = {tox_root}/tests/dockerfiles/repos/apt-repo.Dockerfile
|
||||||
|
expose =
|
||||||
|
APT_REPO_PORT=8443/tcp
|
||||||
|
healthcheck_cmd = wget --no-check-certificate -qO- https://127.0.0.1:8443/Packages || exit 1
|
||||||
|
healthcheck_interval = 1
|
||||||
|
healthcheck_retries = 30
|
||||||
|
healthcheck_timeout = 2
|
||||||
|
healthcheck_start_period = 1
|
||||||
|
|
||||||
|
[testenv:module-apt]
|
||||||
|
package = skip
|
||||||
|
change_dir = {tox_root}
|
||||||
|
dependency_groups = dev
|
||||||
|
docker =
|
||||||
|
apt-repo
|
||||||
|
allowlist_externals =
|
||||||
|
docker
|
||||||
|
commands =
|
||||||
|
python3 -m id_tools test render-config {tox_root}/tests/configs/Apt.yaml.j2 {env_dir}/configs/Apt.yaml
|
||||||
|
docker buildx build --platform linux/amd64 --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Apt.Dockerfile -t id-configurator-apt .
|
||||||
|
|
||||||
|
[docker:yum-repo]
|
||||||
|
dockerfile = {tox_root}/tests/dockerfiles/repos/yum-repo.Dockerfile
|
||||||
|
expose =
|
||||||
|
YUM_REPO_PORT=8443/tcp
|
||||||
|
healthcheck_cmd = wget -qO- http://127.0.0.1:8443/repodata/repomd.xml || exit 1
|
||||||
|
healthcheck_interval = 1
|
||||||
|
healthcheck_retries = 30
|
||||||
|
healthcheck_timeout = 2
|
||||||
|
healthcheck_start_period = 1
|
||||||
|
|
||||||
|
[testenv:module-yum]
|
||||||
|
package = skip
|
||||||
|
change_dir = {tox_root}
|
||||||
|
dependency_groups = dev
|
||||||
|
docker =
|
||||||
|
yum-repo
|
||||||
|
allowlist_externals =
|
||||||
|
docker
|
||||||
|
commands =
|
||||||
|
python3 -m id_tools test render-config {tox_root}/tests/configs/Yum.yaml.j2 {env_dir}/configs/Yum.yaml
|
||||||
|
docker buildx build --platform linux/amd64 --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Yum.Dockerfile -t id-configurator-yum .
|
||||||
|
|
||||||
|
[docker:apk-repo]
|
||||||
|
dockerfile = {tox_root}/tests/dockerfiles/repos/apk-repo.Dockerfile
|
||||||
|
expose =
|
||||||
|
APK_REPO_PORT=8443/tcp
|
||||||
|
healthcheck_cmd = wget -qO- http://127.0.0.1:8443/APKINDEX.tar.gz || exit 1
|
||||||
|
healthcheck_interval = 1
|
||||||
|
healthcheck_retries = 30
|
||||||
|
healthcheck_timeout = 2
|
||||||
|
healthcheck_start_period = 1
|
||||||
|
|
||||||
|
[testenv:module-apk]
|
||||||
|
package = skip
|
||||||
|
change_dir = {tox_root}
|
||||||
|
dependency_groups = dev
|
||||||
|
docker =
|
||||||
|
apk-repo
|
||||||
|
allowlist_externals =
|
||||||
|
docker
|
||||||
|
description =
|
||||||
|
Unlike the other module-* envs, this one is not pinned to --platform
|
||||||
|
linux/amd64: apk embeds the client's own architecture in the repository
|
||||||
|
URL it fetches, and the apk-repo fixture (built by tox-docker, which
|
||||||
|
cannot be pinned to a platform) always publishes its index under the
|
||||||
|
Docker host's native architecture. Leaving both builds on the host's
|
||||||
|
native platform keeps them in agreement everywhere (including under
|
||||||
|
QEMU emulation on non-amd64 hosts); CI runners are amd64, so this still
|
||||||
|
matches the other envs there.
|
||||||
|
commands =
|
||||||
|
python3 -m id_tools test render-config {tox_root}/tests/configs/Apk.yaml.j2 {env_dir}/configs/Apk.yaml
|
||||||
|
docker buildx build --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Apk.Dockerfile -t id-configurator-apk .
|
||||||
|
|
||||||
|
[docker:java-repo]
|
||||||
|
dockerfile = {tox_root}/tests/dockerfiles/repos/java-repo.Dockerfile
|
||||||
|
expose =
|
||||||
|
JAVA_REPO_PORT=8443/tcp
|
||||||
|
healthcheck_cmd = wget -qO- http://127.0.0.1:8443/org/interdiode/idconfiguratortestpkg/0.0.1/idconfiguratortestpkg-0.0.1.pom || exit 1
|
||||||
|
healthcheck_interval = 1
|
||||||
|
healthcheck_retries = 30
|
||||||
|
healthcheck_timeout = 2
|
||||||
|
healthcheck_start_period = 1
|
||||||
|
|
||||||
|
[testenv:module-java]
|
||||||
|
package = skip
|
||||||
|
change_dir = {tox_root}
|
||||||
|
dependency_groups = dev
|
||||||
|
docker =
|
||||||
|
java-repo
|
||||||
|
allowlist_externals =
|
||||||
|
docker
|
||||||
|
commands =
|
||||||
|
python3 -m id_tools test render-config {tox_root}/tests/configs/Java.yaml.j2 {env_dir}/configs/Java.yaml
|
||||||
|
docker buildx build --platform linux/amd64 --add-host=host.docker.internal:host-gateway --build-context generated-config={env_dir}/configs -f {tox_root}/tests/dockerfiles/Java.Dockerfile -t id-configurator-java .
|
||||||
|
|||||||
Reference in New Issue
Block a user