Skip to content

fix(argocd-pr-env-deploy): check the customer label against the env before skipping (ENG-3919) - #77

Merged
lucas-koontz merged 2 commits into
mainfrom
fix/eng-3919-customer-skip-after-mismatch
Nov 3, 2026
Merged

lucas-koontz merged 2 commits into
mainfrom
fix/eng-3919-customer-skip-after-mismatch

Conversation

@lucas-koontz

@lucas-koontz lucas-koontz commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

User story

As an engineer whose PR gets a customer:<hostBase> label after deploy
I want the deploy job to refuse with a comment that says what to do
So that my ordinary environment doesn't silently stop getting new images

Why this matters

The customer-label skip ran before the job read the parent Application, so it ended green even when the label disagreed with the environment that already existed. Before the skip, that mismatch posted "PR-env deploy blocked" and failed. Separately, argocd app set treated PermissionDenied as "not created yet" and retried for 5 minutes, even for a parent the token had just read, then blamed a missing deploy label. A customer environment's parent is now created by an admin, not by the ApplicationSet, so the close reminder's "this env is gone" is no longer true either.

What should happen

  • The job reads the parent and compares its hostBase with the PR's customer: label first. A mismatch posts the blocking comment and fails. Then a customer-labeled PR whose environment matches, or has none yet, ends with a notice before link resolution and any argocd change.
  • argocd app set on a parent the token could read but gets PermissionDenied fails at once: "ci-pr-envs may not change (project ); an admin deploys it." A parent that doesn't exist yet is still waited for.
  • The closed-PR reminder says closing the PR leaves the customer environment running until an admin removes it.

Test plan

  • TestCustomerEnvs runs the action's own shell from the label read through the skip, with a fake argocd and curl: a customer PR with no env and one with a matching env end with the notice and no comment; a customer label on an ordinary env, and an ordinary PR on a customer env, post "PR-env deploy blocked" and exit 1; an ordinary PR goes on.
  • test_the_label_is_checked_against_the_env_before_the_customer_skip: the parent read and the mismatch come before the skip, and the skip before the Deploys: lint and app set.
  • TestAppSetPermission: a readable parent's PermissionDenied fails on the first attempt with the project named; an absent parent is retried 30 times.
  • test_posts_once_per_closed_customer_pr checks the new reminder text.
  • Full suite: 276 passed in python:3.12-slim with bash 5.2 and jq, as on the runner. On main, the same image passes 42 of these two files.
  • Rollback: revert this PR.

Ships with

ENG-3919. Merge after the cluster change that leaves customer anchor PRs out of the ApplicationSet is applied.

…efore skipping, fail at once on a parent CI can't change (ENG-3919)
@lucas-koontz
lucas-koontz requested a review from a team as a code owner November 2, 2026 23:06
@lucas-koontz
lucas-koontz merged commit 1ac2566 into main Nov 3, 2026
6 checks passed
@lucas-koontz
lucas-koontz deleted the fix/eng-3919-customer-skip-after-mismatch branch November 3, 2026 00:41
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.

2 participants