hooks:create

Create one hook on an owner node. Creating a hook runs nothing: it is stored, and while enabled it runs later and automatically, as queued runs, when an `artifact.finalized` (an artifact upload finalized) or `node.published` (a node made public with submission artifacts) event matches its scope. A workflow is a restricted set of steps (HTTP requests and polling, JSON extraction, artifact load and upsert, adding tags) and can call outside services, using secrets as `${{ secrets.NAME }}`. Needs write access to the owner node.

Reference for flywheel hooks:create.

Command Group

Hooks Commands

Summary

Create one hook on an owner node. Creating a hook runs nothing: it is stored, and while enabled it runs later and automatically, as queued runs, when an artifact.finalized (an artifact upload finalized) or node.published (a node made public with submission artifacts) event matches its scope. A workflow is a restricted set of steps (HTTP requests and polling, JSON extraction, artifact load and upsert, adding tags) and can call outside services, using secrets as $\{\{ secrets.NAME \}\}. Needs write access to the owner node.

Effect

changes data

Usage

flywheel hooks:create <FLAGS>

Required flags

FlagValueDefaultChoicesDescription
--owner_node_idstringNode owning the hooks and secrets: any node_id, or owner_node_id in hook results. Missing or hidden: 404. Listing hooks or runs needs read access; changes and secret listing need write access (else 403).
--namestringLabel for the hook (non-blank).
--workflow_yamlstringWorkflow as YAML text. Needs on (events that trigger it: artifact.finalized, node.published) and jobs.main.steps, a list of id, uses and with; optional if (an event condition) and outputs. uses is one of flywheel/http_request@v1, flywheel/http_poll@v1, flywheel/json_extract@v1, flywheel/load_artifact@v1, flywheel/upsert_artifact@v1 or flywheel/add_node_tags@v1. Secrets: $\{\{ secrets.NAME \}\}. Invalid YAML or steps are refused.

Optional flags

FlagValueDefaultChoicesDescription
--scopestringWhose events run the hook: self, the owner node's own; subtree, the owner node's and its descendants'; graph, matched like subtree (not a separate graph-wide stream). Omitted: self.
--rerun_policystringif_inputs_changed (the only value): skip an event whose inputs match the hook's latest finished run for the same node. Omitted: if_inputs_changed.
--enabledStart enabled (omitted: true). --enabled=false stores the hook without it running until hooks:set-enabled turns it on.
--formatFORMATjson, tsv, csv, tableOutput format for command results.
--envPROFILESelect a CLI profile; unconfigured default requires FLYWHEEL_BASE_URL.
--outPATHWrite output to a file path, or use - for stdout.
--openOpen browser-bound URLs when supported.
--no-retryDisable transient-error retries.
--retry-maxNMaximum transient-error retry attempts.
--waitBlock on async operations until a terminal state is reached.
--wait-timeoutSECONDS600Seconds to wait for --wait before timing out. Defaults to 600.
--allow-selfAllow mutating the currently active credential.
--timeoutSECONDSSet the per-request timeout budget in seconds.
--idempotency-keyKEYReuse an Idempotency-Key so ambiguous write failures can be retried with the same key.
--forceForce safety-gated operations where supported.
--yesConfirm forced compute:release-all --force. Other runtime commands do not read --yes.
--debugPrint structured request debugging with secrets masked.
--verbosePrint verbose progress for long-running operations.
-h, --helpShow this help.

Examples

Create an enabled subtree hook.

flywheel hooks:create --owner_node_id n_owner --name build --workflow_yaml "on:\n  artifact.finalized: {}\njobs:\n  main:\n    steps:\n      - id: call_eval\n        uses: flywheel/http_request@v1\n        with:\n          url: https://example.invalid/eval\n          method: POST" --scope subtree --enabled

Create an enabled subtree hook that tags finalized submissions.

flywheel hooks:create --owner_node_id n_owner --name tag-red-submissions --workflow_yaml 'on:\n  artifact.finalized: {}\nif:\n  any_artifact:\n    field: metadata.submission_kind\n    eq: red\njobs:\n  main:\n    steps:\n      - id: tag_red_submission\n        uses: flywheel/add_node_tags@v1\n        with:\n          node_id: ${{ event.source_node_id }}\n          tag_ids:\n            - tag-red-submission' --scope subtree --enabled

Output

Default format: json.

FieldType
hookobject