magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS3026: queue hook is not a command

magus queue plan, validate or apply read a hook flag whose value is not a command and its arguments.

[MGS3026] --gate "magus run ci | tee gate.log": | joins two commands, and a hook is
a command and its arguments with no shell to act on it; put the line in a script
and point --gate at it

Why

The queue runs --gate, --regenerate and --facts directly, with the change's projects (or the fact asked for) appended as arguments. No shell sits between them, so a variable, a command substitution, a pipe, ;, &&, a redirection, a glob or a leading NAME=value would reach the program as literal text, or not at all. The queue refuses the flag before anything runs rather than run something other than what the line reads as.

Quotes and backslashes still group words: --gate 'magus run "ci" --no-default-charms' is three words after magus.

Resolution

Put the shell line in a script whose last command takes the appended arguments, and point the flag at the script:

#!/bin/sh
set -eu
magus run ci --no-default-charms "$@" 2>&1 | tee gate.log
magus queue validate --gate ./tools/queue-gate.sh ...

For a tool cache, use --scratch-env NAME=DIR rather than an assignment prefix; for magus's sandbox, its global flag (magus --sandbox=required run generate:rw). See the merge queue guide.

MGS3026merge queuemagus queuehooksshell
Last updated (a9ff8609)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Charm

An execution modifier attached with : (lint:rw) that changes how a target runs, not which one; the built-in rw flips a check-only target to mutate in place, and ci always strips it. See charms.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.