Skip to content

feat: trigger a building block run from the CLI - #11

Closed
JohannesRudolph wants to merge 1 commit into
feat/cli-bb-run-logsfrom
feat/buildingblock-trigger-run
Closed

JohannesRudolph wants to merge 1 commit into
feat/cli-bb-run-logsfrom
feat/buildingblock-trigger-run

Conversation

@JohannesRudolph

@JohannesRudolph JohannesRudolph commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Adds meshstack buildingblock trigger-run <uuid> [--dry-run] [-o json|ndjson].

Why: agents and scripts can ask meshStack for a run without a local OpenTofu, e.g. after pushing a fix to a draft definition's branch. The command does not wait and approves nothing. Approval stays with a human in meshPanel.

It writes the building block meshStack answers with (202). The run starts asynchronously, so status.latestRunUuid may still name the previous run.

The call sits on its own client.Client.RunTrigger, so the provider's MeshBuildingBlockV2Client mock is unaffected.

Stacked on #10.

🤖 Generated with Claude Code

@meshcloud-gh-actions

meshcloud-gh-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 2819ea534ff027b41da1be54fbd4d1ddce8934b1.

Scope Coverage
Unit tests 66.8%
Acceptance tests 10.9%
Combined 66.9%
Uncovered functions
client/api_key.go:48: meshApiKeyClient.Create 0.0%
client/api_key.go:52: meshApiKeyClient.Read 0.0%
client/api_key.go:56: meshApiKeyClient.Update 0.0%
client/api_key.go:60: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:21: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:34: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:50: ApiKeyPermissions.MarkdownString 0.0%
client/api_key_permissions.go:226: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:231: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:74: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:85: DisabledSchedule 0.0%
client/building_block_definition.go:92: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:97: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:102: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:171: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:178: meshBuildingBlockDefinitionClient.ListRawSeq 0.0%
client/building_block_definition.go:185: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:189: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:193: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:197: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:103: TagInputTargetsFor 0.0%
client/building_block_definition_version.go:248: meshBuildingBlockDefinitionVersionClient.List 0.0%
client/building_block_definition_version.go:254: meshBuildingBlockDefinitionVersionClient.ListRawSeq 0.0%
client/building_block_definition_version.go:260: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:269: meshBuildingBlockDefinitionVersionClient.Update 0.0%
... and 159 more

covdata func names a method without its receiver, so an entry can belong to an implementation nothing selects rather than to a function the tests never reached. Open the file and line before reading one as a coverage gap.

}

func (c meshBuildingBlockV2Client) TriggerRun(ctx context.Context, bbUuid string) (err error) {
// MeshBuildingBlockV2TriggerRunRequest is the body of a trigger-run. DryRun asks for a DETECT run,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove useless comment, these are already covered by API docs authoritatively and should not be restated in the clinet code

Add `meshstack buildingblock trigger-run <uuid> [--dry-run]`. It asks
meshStack to run a building block and writes the building block that
meshStack answers with. --dry-run asks for a DETECT run.

This lets agents and scripts start a run without a local OpenTofu, for
example after a fix is pushed to a draft definition's branch. The
command does not wait for the run and does not approve anything.
Approval stays with humans in meshPanel.

The client gets TriggerRunWith, which takes the dryRun flag and returns
the answered building block. TriggerRun keeps its signature and calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grubmeshi

Copy link
Copy Markdown
Collaborator

Superseded by #23, which brings this work together with #10, #11, #12 and #21, rebased on main and reviewed. I'm closing this PR by deleting its branch.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants