From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 02E761FF09F for ; Tue, 01 Dec 2026 15:59:04 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 9D11B2175F; Tue, 01 Dec 2026 15:58:31 +0100 (CET) From: =?UTF-8?q?Michael=20K=C3=B6ppl?= To: pve-devel@lists.proxmox.com Subject: [PATCH test-tools 3/8] instance: distinguish builtin hooks from hook files Date: Tue, 1 Dec 2026 15:58:12 +0100 Message-ID: <20261201145817.894414-4-m.koeppl@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261201145817.894414-1-m.koeppl@proxmox.com> References: <20261201145817.894414-1-m.koeppl@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1796137099337 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.172 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: LLVIYJTRPQ5HIWFIKDZAJY73GGKCEPU4 X-Message-ID-Hash: LLVIYJTRPQ5HIWFIKDZAJY73GGKCEPU4 X-MailFrom: m.koeppl@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hooks were command lines run relative to the current dir of proxmox-test-instance. For proxmox-test-scheduler, that is the home dir of the SSH user, so a plan only found its scripts if they happened to be placed there, regardless of where the plan itself was. Hooks now either name a script shipped with proxmox-test-instance, as in Builtin("update-packages pve staging"), or a script of their own, as in File("../scripts/setup-ldap.sh"), which is resolved relative to the directory of the plan file. A symlink to the plan is resolved first, so that the scripts next to the plan itself are found. Hooks given as plain strings are no longer accepted, so existing plans need to be adapted. The setup digest of plans with hooks changes accordingly and their next setup starts fresh. Signed-off-by: Michael Köppl --- README.md | 23 ++++++-- proxmox-test-instance/src/cli.rs | 20 ++++++- proxmox-test-instance/src/config.rs | 53 ++++++++++++++++++- .../src/instance_manager/mod.rs | 10 ++-- 4 files changed, 96 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index abef2c61..8bca2818 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,8 @@ Plan( // root_password: Inline("password"), ), post_setup: [ - "scripts/update-packages.sh pve staging", + Builtin("update-packages pve staging"), + File("scripts/my-hook.sh"), ], ), ] @@ -177,7 +178,24 @@ Plan( The `proxmox-test-instance run-script` command can be used to run scripts on test instances, e.g. to update them to the latest packages, to inject test artifacts etc. +### Setup hooks +The `post_setup` hooks of an instance run after its installation. Each hook is a command line +naming a script, followed by its arguments, which are passed through the shell: + +- `Builtin(" []")` runs a script shipped with `proxmox-test-instance`, installed as + `/usr/share/proxmox-test-instance/scripts/.sh`. +- `File(" []")` runs a script of your own. A relative path is resolved against the + directory of the plan file, after resolving symlinks to it. + +| Builtin | Arguments | Description | +|---|---|---| +| `update-packages` | ` ` | Switch to the given repository and upgrade all packages | +| `download-container-image` | `