Skip to content

feat: discover a pipeline's stacks and ECS services when adding a project - #68

Merged
Skeyelab merged 1 commit into
mainfrom
feat/discover-resources
Sep 29, 2026
Merged

Skeyelab merged 1 commit into
mainfrom
feat/discover-resources

Conversation

@Skeyelab

@Skeyelab Skeyelab commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Closes #67

Summary

Adding a project from the manage screen used to save only its pipeline, so stacks and ECS had to be added to config.toml by hand (e.g. testlibnd / reserves).

The pipeline definition can't name its stacks, because CDK pipelines deploy through CodeBuild (cdk deploy). Instead, discovery links them through the tags the blueprints already set:

  • internal/discover:
    • Reads the pipeline's ProjectName tag, then finds every active stack with the same tag, excluding the pipeline's own stack (found via DescribeStackResources).
    • Reads each stack's AWS::ECS::Service resources and groups the services by cluster.
    • Every call is read-only.
  • Result.Likely(project) narrows the results to what's named after the project. A shared tag also matches sibling projects: ProjectName=dec covers honeycomb, beehive and honeypot.
  • Manage screen:
    • After the form, discovery runs for a new project, or for an edited one that has a pipeline but no stacks or ECS yet.
    • A confirmation step shows two multi-selects, stacks and ECS services, with the Likely picks pre-selected.
    • enter saves the selection, and esc saves the project without the discovered items.
    • A failed lookup, or a pipeline with no tag, still saves the project and says why nothing was added.

Live check (read-only, real accounts)

Pipeline Stacks found ECS found
testlibnd reserves reserves-cluster, reserves-service, reserves-test-service, matching the hand config exactly App service in each of the 2 clusters
libnd api api-cluster, api-service, api-test-service App plus Solr services in each of the 2 clusters
libnd honeycomb 11 dec stacks 2 foundation clusters, including honeypot services

For honeycomb, Likely pre-selects only the honeycomb stacks and services.

Test plan

  • internal/discover: stacks by tag, own stack excluded, untagged pipeline finds nothing, ECS grouped by cluster, AWS errors surface, Likely narrowing and its fallback to everything.
  • Manage: add saves the confirmed resources for the right profile, region and pipeline; only likely items are pre-selected; a discovery failure still saves; an edit with existing resources skips discovery.
  • go test -race ./... passes and golangci-lint reports 0 issues.
  • Manual: add a project in the TUI and confirm the picker (confirmed on v0.10.0).

…ject

Adding a project from the manage screen saved only its pipeline; stacks
and ECS services had to be hand-edited into config.toml. CDK pipelines
deploy through CodeBuild, so the pipeline definition never names a stack.

New internal/discover links them through the ProjectName tag the CDK
blueprints put on the pipeline and every stack (minus the pipeline's own
stack), and reads ECS services from those stacks' resources. The manage
screen runs it after the form for new projects and for ones with a
pipeline but nothing else, and shows a confirmation with the resources
named after the project pre-selected, since a shared tag also matches
sibling projects. Discovery failure never blocks the save.

Closes #67
@Skeyelab
Skeyelab merged commit 38247b0 into main Sep 29, 2026
3 checks passed
@Skeyelab
Skeyelab deleted the feat/discover-resources branch September 29, 2026 18:05
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.

Discover a pipeline's stacks and ECS services when adding a project

1 participant