Skip to content

Persist runtime tags on workflow run records #387

@stack72

Description

@stack72

Problem

When running a workflow with --tag flags, the tags are applied to data artifacts produced during the run, but they are not stored on the workflow run record itself. The workflow run YAML at .swamp/workflow-runs/{workflow-id}/{run-id}.yaml has no record of which runtime tags were used.

This means there is no way to filter workflow run history by tags. You cannot ask "show me all runs of deploy-pipeline for prod" — the workflow run history has no concept of the environment or any other runtime tag.

Current State

Data artifacts produced during a tagged run correctly carry the tags:

# .swamp/data/.../result/8/metadata.yaml
tags:
  type: resource
  specName: result
  workflow: deploy-pipeline
  step: deploy-app
  environment: prod          # from --tag

But the workflow run record does not:

# .swamp/workflow-runs/{id}/{run-id}.yaml
id: ...
workflowId: ...
workflowName: deploy-pipeline
status: succeeded
startedAt: ...
completedAt: ...
# no tags field

Why This Matters

Workflow run history is important for operational visibility — teams need to answer questions like:

  • "When was the last time we deployed to prod?"
  • "Show me all failed staging runs this week"
  • "What's the deployment frequency per environment?"

Today, the only way to get environment information about a run is to look at the data artifacts it produced and check their tags. But data artifacts may have been garbage-collected, and querying indirectly through data is cumbersome compared to filtering runs directly.

Proposed Solution

Store runtime tags on the workflow run record:

id: ...
workflowName: deploy-pipeline
status: succeeded
tags:
  environment: prod
  image_tag: v1.2.3

And support filtering in workflow history commands:

swamp workflow history search --tag environment=prod
swamp workflow history search --tag environment=prod --json

Use Case

An SRE team operates a deployment pipeline across multiple environments. During an incident, they need to quickly find:

  • The last successful prod deployment (to identify what changed)
  • All failed runs for a specific environment (to spot patterns)
  • Deployment frequency per environment (for capacity planning)

Without tags on run records, this information is either unavailable or requires manual correlation across data artifacts.

Metadata

Metadata

Assignees

Labels

in-discussionA feature or issue that is in active discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions