Skip to content

Use Proxmox for a template before reaching for linuxcontainers.org - #23

Open
MickLesk wants to merge 3 commits into
mainfrom
feat/pveam-first-template-lookup
Open

Use Proxmox for a template before reaching for linuxcontainers.org#23
MickLesk wants to merge 3 commits into
mainfrom
feat/pveam-first-template-lookup

Conversation

@MickLesk

@MickLesk MickLesk commented Sep 4, 2026

Copy link
Copy Markdown
Member

✍️ Description

Every ARM64 container took the custom-template path, so pveam was never consulted on that architecture.

-> Template lookup now runs the same way on both architectures: local templates first, then the catalog, both matched on OS, version and exact architecture. Only when Proxmox has nothing does linuxcontainers.org step in, which is still the only source for Ubuntu, Fedora and the rest on ARM64.

The interactive "pick another version" fallback matched by name only, so on a host whose catalog carries both architectures — now the normal case — it could offer an amd64 template to an ARM64 host.

🔗 Related Issue

Refs #5

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – routing unit-tested against a real pveam available catalog; not run on an ARM64 host.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.
  • API.txt regenerated – n/a, this repo has no API.txt.

🤖 AI Assistance (X in brackets)

If you used an AI tool (GitHub Copilot, Claude, ChatGPT, etc.) to write or generate any code in this PR, you must confirm compliance below.
Select exactly one option.

  • No AI used – Code was written without AI assistance.
  • AI was used – The output has been reviewed and corrected, and I take responsibility for it matching this repo's conventions.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing behavior in a way that may require updates in every downstream script.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, docs/, CONTRIBUTING.md, or other docs.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Try this branch

The engine and the scripts resolve independently, so a production script can
be run against the engine from this PR by setting one variable:

COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/community-scripts/core/feat/pveam-first-template-lookup \
bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/debian.sh)"

Swap ct/debian.sh for whatever exercises the change.

This PR touches both backends. Worth running on a Proxmox VE and an Incus host.

Run a script from a fork as well
curl -fsSL https://raw.githubusercontent.com/community-scripts/core/feat/pveam-first-template-lookup/tools/run.sh |
  bash -s -- https://raw.githubusercontent.com/YOU/ProxmoxVED/your-branch ct/debian.sh \
             https://raw.githubusercontent.com/community-scripts/core/feat/pveam-first-template-lookup

Note that run.sh is reached through a pipe, so the script it starts inherits
an exhausted stdin. Whiptail is fine — it opens /dev/tty — but a plain read
would see EOF. The single-variable form above does not have that problem.

Useful flags while testing

dev_mode=net logs every engine fetch with status and duration, which is the
quickest way to confirm the branch is really being used. dev_mode=keep stops a
failed build from deleting the container along with the evidence.

@MickLesk MickLesk changed the title Ask Proxmox for a template before reaching for linuxcontainers.org Use Proxmox for a template before reaching for linuxcontainers.org Sep 4, 2026
Every ARM64 container took the custom-template path, so pveam was never
consulted on that architecture. For Debian that path resolved its URL from
community-scripts/debian-arm64-lxc, a repository that does not exist: the
releases endpoint answers 404, so ARM64 Debian could not be created at all
through the split core.

Template lookup now runs the same way on both architectures. Local templates
first, then the catalog, both matched on OS, version and exact architecture.
Only when Proxmox has nothing does the linuxcontainers.org build step in, which
is still the only source for Ubuntu, Fedora and the rest on ARM64.

Against a live catalog this routes debian 13 and alpine 3.24 through pveam on
ARM64 -- Proxmox ships both -- while debian 12, ubuntu and fedora keep the
old path. A local template short-circuits before any catalog read.

The interactive "pick another version" fallback filtered by name only. On a
host whose catalog carries both architectures, which is now the normal case,
it could offer an amd64 template to an ARM64 host and fail later at creation.

Supersedes the Debian-only routing in #5.
@MickLesk
MickLesk force-pushed the feat/pveam-first-template-lookup branch from a6d3e2b to 400905e Compare September 4, 2026 07:24
Image resolution tried up to six images: candidates over the network before
looking at what was already copied locally, so an image on disk still cost
round-trips and resolution failed outright on a host without internet.

The local match was also a substring search over the whole CSV row: asking for
debian/12 matched a debian/13 row uploaded on 2026/12/01, because the row
contains "debian" and the date contains "12". That launched the wrong release
with no error. It now compares the alias field whole.
@MickLesk

MickLesk commented Sep 4, 2026

Copy link
Copy Markdown
Member Author
image image

@asylumexp fyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant