Skip to content

fix(local-cluster): make destroy-all cleanup portable across POSIX shells #1261

Description

@mikeyrcamp

Summary

make -C tools/ncp-local-cluster destroy-all-ncp-local fails on systems where Make uses a POSIX /bin/sh that does not implement Bash's pipefail option. The target currently executes set -o pipefail without selecting Bash.

This prevents the repository-documented deterministic cleanup command from running on common Debian/Ubuntu environments where /bin/sh is dash, including the no-clusters-present case.

Reproduction

At current main revision 603059d81a3adc4f134866dbb0f678b053e59e0c:

$ /bin/sh -c 'set -o pipefail'
/bin/sh: 1: set: Illegal option -o pipefail

$ make -C tools/ncp-local-cluster destroy-all-ncp-local
/bin/sh: 1: set: Illegal option -o pipefail
make: *** [Makefile:156: destroy-all-ncp-local] Error 2

The failure is deterministic and occurs before the target can inspect the k3d cluster list.

Expected behavior

The target should either:

  • use only POSIX-shell syntax; or
  • explicitly execute the recipe with Bash when pipefail is required.

It should successfully report that no matching clusters exist when the inventory is empty, and should preserve failure detection for the k3d cluster list pipeline.

Acceptance criteria

  • destroy-all-ncp-local succeeds with the repository's documented prerequisites on a system where /bin/sh is dash.
  • An empty cluster inventory exits successfully.
  • A populated inventory deletes all and only ncp-local* clusters.
  • A failure from k3d cluster list or jq remains visible rather than being silently treated as an empty inventory.
  • Focused automated coverage protects the shell contract.

Context

Discovered while performing fresh end-to-end validation for #1075. The validation was stopped at this first unexpected cleanup failure; no workaround was used to represent the documented path as passing.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions