Skip to content

Fix orphaned PR env scan when no non-default workspaces#890

Closed
lorenyu wants to merge 2 commits intomainfrom
lorenyu/fixprenvscan
Closed

Fix orphaned PR env scan when no non-default workspaces#890
lorenyu wants to merge 2 commits intomainfrom
lorenyu/fixprenvscan

Conversation

@lorenyu
Copy link
Copy Markdown
Contributor

@lorenyu lorenyu commented Mar 3, 2025

Ticket

Resolves #{TICKET NUMBER OR URL}

Changes

  • Add "or true" to grep command that searches for non-default workspaces

Context for reviewers

The Scan orphaned PR environments workflow was failing (Most recent failed run: https://github.com/navapbc/pfml-starter-kit-app/actions/runs/13625676007)

When there's only one workspace, terraform workspace list will return * default, which doesn't get found by grep -o 'p-[0-9]\+' which is only looking for lines without the *. This means that the grep returns a status code of 1, causing the line workspaces="$(terraform -chdir="infra/${app_name}/service" workspace list)" to fail, terminating the script.

This change fixes this issue by adding || true to the grep part of the command pipeline.

Testing

see https://github.com/navapbc/pfml-starter-kit-app/pull/266

@lorenyu
Copy link
Copy Markdown
Contributor Author

lorenyu commented Mar 3, 2025

duplicate of #889

@lorenyu lorenyu closed this Mar 3, 2025
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.

1 participant