1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-10-15 19:42:06 +00:00

fix: do not attempt to run the LXC stop script with self-hosted (#1037)

The test is covered by TestRunnerLXC which verifies the script actually runs on LXC.

Resolves forgejo/runner#1035

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- bug fixes
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1037): <!--number 1037 --><!--line 0 --><!--description Zml4OiBkbyBub3QgYXR0ZW1wdCB0byBydW4gdGhlIExYQyBzdG9wIHNjcmlwdCB3aXRoIHNlbGYtaG9zdGVk-->fix: do not attempt to run the LXC stop script with self-hosted<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1037
Reviewed-by: fnetX <fnetx@noreply.code.forgejo.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-09-28 14:49:45 +00:00 committed by earl-warren
parent ea824bde1c
commit 7f90c8acb2
No known key found for this signature in database
GPG key ID: F128CBE6AB3A7201

View file

@ -254,6 +254,10 @@ func (rc *RunContext) stopHostEnvironment(ctx context.Context) error {
logger := common.Logger(ctx) logger := common.Logger(ctx)
logger.Debugf("stopHostEnvironment") logger.Debugf("stopHostEnvironment")
if !rc.IsLXCHostEnv(ctx) {
return nil
}
var stopScript bytes.Buffer var stopScript bytes.Buffer
if err := stopTemplate.Execute(&stopScript, struct { if err := stopTemplate.Execute(&stopScript, struct {
Name string Name string