DVL-11443 add environment tags for multi-environment deployments - #28
Open
tomerstein wants to merge 1 commit into
Open
DVL-11443 add environment tags for multi-environment deployments#28tomerstein wants to merge 1 commit into
tomerstein wants to merge 1 commit into
Conversation
Environments can now carry tags, the same way services already do, so one command can cover several environments. `deploy all-backend all-prod v1.0.0` expands both axes into service/environment pairs and deploys them in a single pull request. Environment tags resolve per service, so a tag may cover environments only some services define; a service matching none of the requested environments is still an error. Two restrictions are validated before anything is committed: every resolved environment must share a deploymentRepoBranch (one command still produces one pull request), and no two pairs may share a generatedPath, since rendering clears that folder first and one pair would otherwise discard the other's manifests. Fixes two things that only surface once a command covers several environments: the rendered environment name came from the raw command argument rather than the resolved environment, which would have written the tag name into manifests and into the Helm argoBot values; and the per-service file map was keyed by service name, so a service deployed to two environments silently lost the first one's files. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tomerstein
force-pushed
the
DVL-11443-environment-aliases
branch
from
August 24, 2026 14:26
94e697d to
44f15a4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Service tags let one command cover many services, but there was no equivalent on the environment axis. Deploying the same version to
prod-usandprod-eumeant two commands and two pull requests.Solution
Environments now carry
tags, exactly mirroringservices[].tags. Both axes expand at once into service/environment pairs, and the whole set goes into a single pull request:deploy all-backend all-prod v1.0.0→api/prod-us,api/prod-eu,worker/prod-us, one PR.Both the services and the environment argument accept a name, a tag, or a comma-separated list, on
deploy,freezeandunfreeze.listnow shows each environment's tags next to its freeze status, so the aliases are discoverable from Slack.Environment tags resolve per service, so a tag may cover environments only some services define —
workerabove has noprod-euand is simply deployed where it exists. A service matching none of the requested environments is still a hard error, so a typo never silently deploys a subset.Git artifacts
Unchanged in shape: one commit, one PR, branch and PR title built from the arguments as typed (
deploy-all-backend-all-prod). What a tag expanded to is recorded in two new places, since the raw argument alone doesn't say:Deployments:Validation added
Both reported as validation errors before anything is committed:
deploymentRepoBranch— one command still produces one PR, so a tag spanning branches is rejected rather than silently splitgeneratedPath— rendering clears that folder first, so without this the last pair silently discards the earlier ones' manifestsBugs fixed
Two that only surface once a command covers more than one environment:
renderTemplatestook the environment name from the raw command argument, so a tag would have renderedall-prodinto manifests via the Go template.Environmentvar and into the HelmargoBot.environmentvalue. Now always taken from the resolved environment.service.Name, so a service deployed to two environments had its first environment's files silently overwritten in the map and never committed. Now keyed per pair.Also: the file-conflict error is now an
api.ValidationErr(so Slack labels it "Validation error:" rather than "Error:") and names the service/environment pairs involved; and target order now follows config order instead of Go map iteration order, so a command's output is deterministic between runs.Tests
First tests in the repo —
pkg/deploy/deployer_test.go, 14 cases over the resolution logic, no GitHub access needed: tag expansion, per-service partial expansion, comma-separated environments, case-insensitivity, name/tag dedup, zero-match error, mixed-branch rejection,generatedPathcollision, and deterministic ordering.Everything past resolution needs a live deployment repo, so the deploy/freeze paths themselves still want manual verification against a real repo before merge — in particular that a fanned-out deploy renders the correct per-environment manifests.
Notes for the reviewer
Deployer.DeployandDeployer.Freezenow takeenvironmentNames []string;ResolveEnvironmentTagsis new on the interface.tagson an environment is optional, and a bare environment name resolves exactly as before.argo-bot.yamlis gitignored, and every environment in it shares onegeneratedPath, so that local config already trips the pre-existing file-conflict check on any multi-service deploy. Worth cleaning up separately.🤖 Generated with Claude Code