Repository navigation
fix(argocd-pr-env-deploy): check the customer label against the env before skipping (ENG-3919) - #77
Merged
Conversation
…efore skipping, fail at once on a parent CI can't change (ENG-3919)
…ssages and tests (ENG-3919)
mindsdb-devops
approved these changes
Nov 3, 2026
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.
User story
As an engineer whose PR gets a
customer:<hostBase>label afterdeployI 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 settreated PermissionDenied as "not created yet" and retried for 5 minutes, even for a parent the token had just read, then blamed a missingdeploylabel. 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
hostBasewith the PR'scustomer: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 anyargocdchange.argocd app seton 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.Test plan
TestCustomerEnvsruns the action's own shell from the label read through the skip, with a fakeargocdandcurl: 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 theDeploys:lint andapp 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_prchecks the new reminder text.python:3.12-slimwith bash 5.2 and jq, as on the runner. Onmain, the same image passes 42 of these two files.Ships with
ENG-3919. Merge after the cluster change that leaves customer anchor PRs out of the ApplicationSet is applied.