mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 13:57:43 +00:00
fix(docs): name the image the run resolved instead of a frozen reference
The published Production block hardcoded ghcr.io/infinito-nexus/core/debian, which duplicates the template meta/distros.yml declares and points every reader at :latest. That index carries linux/amd64 and an attestation, so the docs CLI test, which executes the published instructions verbatim, died on arm64 with `no matching manifest for linux/arm64/v8`. deploy_image() prefers INFINITO_IMAGE, which scripts/tests/deploy/ci/one.sh already exports from resolve/image/ci.sh, and otherwise composes the reference through environment_image() from the distro and tag default.env declares and the owner and repository SOFTWARE_REPOSITORY carries. The default is byte-identical to the literal it replaces. Nothing versioned becomes environment-dependent: the Quick Setup block is never committed, and roles/web-app-docs rebuilds it inside the container, where builder.py puts the snapshot first on PYTHONPATH and passes os.environ through. CI therefore tests the instructions against the image the run just built rather than against a release from months ago. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
db3b0dc709
commit
c480c748ea
5 files changed
+30
-2
No files matched your search
@@ -34,7 +34,7 @@ from utils.roles.entity.name import entity_name
|
||||
from utils.roles.mapping import ROLE_FILE_META_MAIN, ROLE_FILE_README
|
||||
from utils.roles.meta_lookup import get_role_guide_companions
|
||||
from utils.roles.validation.invokable import _get_invokable_paths, _is_role_invokable
|
||||
from utils.software import SOFTWARE_REPOSITORY
|
||||
from utils.software import SOFTWARE_REPOSITORY, deploy_image
|
||||
from utils.symbol_glossary import to_emoji
|
||||
|
||||
MANAGED_SECTIONS = ("Cosmos", "Quick Setup", "Credits")
|
||||
@@ -104,6 +104,7 @@ def _base_context(role_dir, role_name: str, app_name: str, *, invokable: bool) -
|
||||
[role_name, *get_role_guide_companions(role_dir, role_name=role_name)]
|
||||
),
|
||||
"software_repository": SOFTWARE_REPOSITORY,
|
||||
"application_deploy_image": deploy_image(),
|
||||
"cosmos_mermaid": derive_cosmos_mermaid(role_dir, role_name),
|
||||
"cosmos_legend": _cosmos_legend(),
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ _REQUIRED_CTX: dict = {
|
||||
"application_author": "Kevin Veen-Birkenbach",
|
||||
"cosmos_mermaid": 'flowchart LR\n a["a"] --> b["b"]',
|
||||
"software_repository": SOFTWARE_REPOSITORY,
|
||||
"application_deploy_image": "ghcr.io/example/core/debian:latest",
|
||||
}
|
||||
|
||||
_OPTIONAL_CTX: dict = {
|
||||
|
||||
@@ -6,3 +6,4 @@ DOCS_BUILD_JOBS={{ DOCS_BUILD_JOBS }}
|
||||
DOCS_FETCH_INTERVAL={{ DOCS_FETCH_INTERVAL }}
|
||||
DOCS_PORT={{ DOCS_PORT }}
|
||||
DOCS_SNAPSHOT_DIR={{ DOCS_SNAPSHOT_DIR }}
|
||||
INFINITO_IMAGE={{ lookup('env', 'INFINITO_IMAGE') | dotenv_quote }}
|
||||
@@ -118,7 +118,7 @@ SSH_PUBLIC_KEY="<your-ssh-public-key>"
|
||||
docker run --rm -it \
|
||||
-v "$PWD/inventories:/etc/infinito.nexus/inventories" \
|
||||
-e APP="$APP" -e HOST="$HOST" -e DOMAIN="$DOMAIN" {% if application_needs_clearnet_resolver %}-e DNS="$DNS" {% endif %}-e TLS_MODE="$TLS_MODE" -e SSH_PUBLIC_KEY="$SSH_PUBLIC_KEY" \
|
||||
ghcr.io/infinito-nexus/core/debian bash -c '
|
||||
{{ application_deploy_image }} bash -c '
|
||||
INVENTORY=/etc/infinito.nexus/inventories/production
|
||||
infinito administration inventory provision "$INVENTORY" \
|
||||
--inventory-file "$INVENTORY/devices.yml" \
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
from utils.cache.files import PROJECT_ROOT
|
||||
from utils.cache.yaml import load_yaml
|
||||
from utils.distros import environment_image
|
||||
from utils.env.parser import parse_static_env
|
||||
|
||||
SOFTWARE_VARS = PROJECT_ROOT / "group_vars" / "all" / "00_general.yml"
|
||||
SOFTWARE_NAME: str = load_yaml(str(SOFTWARE_VARS))["SOFTWARE_NAME"]
|
||||
@@ -13,3 +17,24 @@ SOFTWARE_EMAIL = "kevinveenbirkenbach@infinito.nexus"
|
||||
SOFTWARE_URL = "https://infinito.nexus"
|
||||
SOFTWARE_CONTACT = "contact@infinito.nexus"
|
||||
SOFTWARE_LICENSE = "Infinito.Nexus Community License (Non-Commercial)"
|
||||
DEPLOY_IMAGE_ENV = "INFINITO_IMAGE"
|
||||
|
||||
|
||||
def deploy_image() -> str:
|
||||
"""Reference of the image the published deploy instructions tell a reader to run.
|
||||
|
||||
Returns:
|
||||
The ``INFINITO_IMAGE`` the run resolved for itself when set, otherwise
|
||||
the environment image of the distro and tag ``default.env`` declares,
|
||||
under the owner and repository of ``SOFTWARE_REPOSITORY``.
|
||||
"""
|
||||
if override := os.environ.get(DEPLOY_IMAGE_ENV):
|
||||
return override
|
||||
declared = parse_static_env(PROJECT_ROOT / "default.env")
|
||||
owner, repository = SOFTWARE_REPOSITORY.removesuffix(".git").rsplit("/", 2)[-2:]
|
||||
return environment_image(
|
||||
declared["INFINITO_DISTRO"],
|
||||
owner,
|
||||
repository,
|
||||
declared["INFINITO_IMAGE_TAG"],
|
||||
)
|
||||
Reference in new issue
Block a user