Skip to content

plugin: gate that platform conditions agree with CheckSporeOS once #1041 and #1054 are both on main #1055

Closed

Description

@scttfrdmn

#1041 adds plugin.CheckSporeOS (blanket Windows refusal, #1001). #1054 adds evaluation of conditions.remote (#1040), including type: platform, compared against the same hostGOOS variable via plugin.MatchesOS/NormalizeOS (trimmed, case-insensitive, empty = Linux, the same normalisation as CheckSporeOS).

Neither PR can carry a gate on their agreement, because each lacks the other's symbol on main. A trial merge of the two branches auto-merges and passes this ad-hoc check, which should be committed once both have landed (in pkg/plugin):

for _, g := range []string{"windows", "Windows", " windows ", "linux", "LINUX", "darwin", ""} {
	refused := CheckSporeOS(g) != nil
	err := CheckCondition(ctx, Condition{Type: "platform", OS: "linux"}, NewTemplateContext(), ConditionHost{GOOS: g})
	// a refused OS must fail the registry's os: linux condition; a Linux spore must pass both
	if refused && err == nil || NormalizeOS(g) == "linux" && (refused || err != nil) { t.Errorf(...) }
}

Better still, have CheckSporeOS call NormalizeOS(goos) == "windows" so there is one normaliser rather than two that happen to agree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions