Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ concurrency:

jobs:
aio-build:
uses: JSONbored/aio-fleet/.github/workflows/aio-build.yml@c4099c09cb2375a0f5a5a822a0f8af02a77d0526
uses: JSONbored/aio-fleet/.github/workflows/aio-build.yml@388300f0f98701ea81bd8185660257d06cd8f472
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
check-upstream:
uses: JSONbored/aio-fleet/.github/workflows/aio-check-upstream.yml@c4099c09cb2375a0f5a5a822a0f8af02a77d0526
uses: JSONbored/aio-fleet/.github/workflows/aio-check-upstream.yml@388300f0f98701ea81bd8185660257d06cd8f472
permissions:
contents: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:

jobs:
publish-release:
uses: JSONbored/aio-fleet/.github/workflows/aio-publish-release.yml@c4099c09cb2375a0f5a5a822a0f8af02a77d0526
uses: JSONbored/aio-fleet/.github/workflows/aio-publish-release.yml@388300f0f98701ea81bd8185660257d06cd8f472
permissions:
actions: read
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:

jobs:
prepare-release:
uses: JSONbored/aio-fleet/.github/workflows/aio-prepare-release.yml@c4099c09cb2375a0f5a5a822a0f8af02a77d0526
uses: JSONbored/aio-fleet/.github/workflows/aio-prepare-release.yml@388300f0f98701ea81bd8185660257d06cd8f472
permissions:
contents: write
pull-requests: write
Expand Down
130 changes: 24 additions & 106 deletions scripts/validate-derived-repo.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,120 +1,38 @@
#!/usr/bin/env bash
# shellcheck disable=SC2312
set -euo pipefail

repo_root="${1:-.}"
cd "${repo_root}"
strict_placeholders="${STRICT_PLACEHOLDERS:-false}"

fail() {
echo "template validation error: $*" >&2
exit 1
}

require_file() {
local path="$1"
[[ -f ${path} ]] || fail "missing required file: ${path}"
}

require_absent() {
local path="$1"
[[ ! -e ${path} ]] || fail "remove template placeholder path in derived repo: ${path}"
}

check_no_placeholder() {
local pattern="$1"
shift
if grep -F -n -- "${pattern}" "$@" >/dev/null 2>&1; then
fail "found unresolved placeholder '${pattern}' in: $*"
fi
}

require_file "Dockerfile"
require_file "README.md"
require_file "pyproject.toml"
require_file "tests/template/test_validate_template.py"
require_file "tests/integration/test_container_runtime.py"
require_file "scripts/validate-template.py"
if [[ -f components.toml ]]; then
require_file "scripts/components.py"
fi
require_file "scripts/update-template-changes.py"
require_file ".github/FUNDING.yml"
require_file "SECURITY.md"
require_file ".github/pull_request_template.md"
require_file ".github/ISSUE_TEMPLATE/bug_report.yml"
require_file ".github/ISSUE_TEMPLATE/feature_request.yml"
require_file ".github/ISSUE_TEMPLATE/installation_help.yml"
require_file ".github/ISSUE_TEMPLATE/config.yml"
require_file "renovate.json"
require_absent ".github/CODEOWNERS"

effective_template_xml="${TEMPLATE_XML-}"
component_template_xml=()
if [[ -f components.toml ]]; then
while IFS= read -r template_path; do
[[ -n ${template_path} ]] || continue
component_template_xml+=("${template_path}")
done < <(
python3 - <<'PY'
from scripts.components import load_components

for component in load_components():
print(component.template)
PY
)
args=(validate-derived --repo-path "${repo_root}")
if [[ ${strict_placeholders} == "true" ]]; then
args+=(--strict-placeholders)
fi

if [[ -z ${effective_template_xml} ]]; then
repo_name="${PWD##*/}"
inferred_repo_xml="${repo_name}.xml"
if [[ -f ${inferred_repo_xml} ]]; then
effective_template_xml="${inferred_repo_xml}"
else
root_xml_files=()
shopt -s nullglob
for xml_path in ./*.xml; do
[[ -f ${xml_path} ]] || continue
root_xml_files+=("${xml_path#./}")
done
shopt -u nullglob
if [[ ${#root_xml_files[@]} -eq 1 ]]; then
effective_template_xml="${root_xml_files[0]}"
fi
fi
if python3 -c "import aio_fleet" >/dev/null 2>&1; then
exec python3 -m aio_fleet.cli "${args[@]}"
Comment on lines +12 to +13
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore standalone validation fallback

This change makes scripts/validate-derived-repo.sh fail in a normal checkout unless aio_fleet is preinstalled or a sibling aio-fleet repo exists, which is a regression from the previous self-contained validator behavior. In this repository as committed, running bash scripts/validate-derived-repo.sh . exits with the new error path, so local validation (and any CI job that only installs this repo’s own dev deps) breaks immediately instead of validating derived-repo contents.

Useful? React with 👍 / 👎.

Comment on lines +12 to +13
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor AIO_FLEET_PATH before importing installed aio_fleet

The early import aio_fleet check immediately execs the installed module and never reaches the AIO_FLEET_PATH fallback logic, so a stale or partial site-packages install can break validation even when a valid local checkout is explicitly provided. In practice, if PYTHONPATH contains an aio_fleet package without aio_fleet.cli, this path exits with No module named aio_fleet.cli instead of using the checkout discovered later in the script, which defeats the documented local-override behavior.

Useful? React with 👍 / 👎.

fi

is_template_repo="false"
if [[ -f .github/workflows/publish-release.yml ]] && grep -F -q -- "Publish Release / Template" .github/workflows/publish-release.yml; then
is_template_repo="true"
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
candidate_roots=()
if [[ -n ${AIO_FLEET_PATH-} ]]; then
candidate_roots+=("${AIO_FLEET_PATH}")
fi

if [[ -n ${effective_template_xml} ]]; then
require_file "${effective_template_xml}"
if [[ ${is_template_repo} != "true" ]]; then
require_absent "template-aio.xml"
candidate_roots+=(
"${script_dir}/../../aio-fleet"
"${script_dir}/../../../aio-fleet"
"../aio-fleet"
"../../aio-fleet"
)

for candidate in "${candidate_roots[@]}"; do
if [[ -d ${candidate}/src/aio_fleet ]]; then
PYTHONPATH="${candidate}/src${PYTHONPATH:+:${PYTHONPATH}}" exec python3 -m aio_fleet.cli "${args[@]}"
fi
fi

xml_files=()
for xml_path in "${component_template_xml[@]}"; do
require_file "${xml_path}"
xml_files+=("${xml_path}")
done
if [[ -n ${effective_template_xml} ]] && [[ -f ${effective_template_xml} ]]; then
xml_files+=("${effective_template_xml}")
fi

if [[ ${strict_placeholders} == "true" ]]; then
check_no_placeholder "Replace this starter base with the real upstream image once the derived repo is wired." "Dockerfile"
if [[ ${#xml_files[@]} -gt 0 ]]; then
check_no_placeholder "yourapp-aio" "${xml_files[@]}"
check_no_placeholder "Replace this overview with the real app description and first-run guidance." "${xml_files[@]}"
check_no_placeholder "replace-with-real-search-terms" "${xml_files[@]}"
check_no_placeholder "Replace this with any real operational prerequisites or remove it." "${xml_files[@]}"
check_no_placeholder "https://github.com/JSONbored/yourapp-aio/releases" "${xml_files[@]}"
fi
check_no_placeholder "aio-template starter app" rootfs/etc/services.d/app/run rootfs/usr/local/bin/aio-template-app.py
fi

echo "Derived repo validation passed."
cat >&2 <<'EOF'
template validation error: aio-fleet is required for derived repo validation.
Install aio-fleet or set AIO_FLEET_PATH to a local aio-fleet checkout.
EOF
exit 1
Loading