uselagoon/lagoon

Validate updates to `productionenv` for a Lagoon project

seanhamlin opened this issue · 1 comments

Describe the bug

I am currently looking at a Lagoon project that looks like this:

$ lagoon get project -p PROJECT --output-json | jq '.data[].productionenv'
" production -b (feature|release|hotfix)/|(dev|test|develop|master|main|sandbox)$ -m false"

Clearly this will never map to a valid git branch. The impact is that the branch called production is not actually production. This has flow on impacts for monitoring and scaling.

To Reproduce

Update productionenv with a non-valid git branch.

Expected behavior

Lagoon validates productionenv to ensure it is possible to push a git branch with that name.

Branches aren't the only thing that can deploy to an environment. A promote flow would not require that the production environment name be a valid git branch.

There is probably a middle ground between "any string" and "git branch regex" though.