Skip to content

feat: add deployment-id input for per-attempt ArgoCD notification dedupe - #92

Merged
John C. Bland II (johncblandii) merged 1 commit into
mainfrom
feat/replicate-argocd-deploy-action
Aug 28, 2026
Merged

John C. Bland II (johncblandii) merged 1 commit into
mainfrom
feat/replicate-argocd-deploy-action

Conversation

@johncblandii

Copy link
Copy Markdown
Contributor

what

  • Adds an optional deployment-id input, stamped into the generated config.yaml as deployment_id alongside app_commit.
  • No changes to outputs, the destination-path logic, or any other step.
  • Adds test coverage in both directions, and documents the input in README.yaml / README.md.

why

  • ArgoCD's notification oncePer trigger dedupes on whichever field it is pointed at. Keying it on the application commit has a gap: rollback. Replaying a previously-deployed commit reuses an app_commit value ArgoCD already marked as notified, so the rollback's own success/failure is silently suppressed — no GitHub status at all, not even a wrong one.
  • Keying the dedupe on something unique per deploy attempt rather than per code state closes that gap. This PR adds the field needed to produce that value; it does not change dedupe behavior on its own.
  • The recommended value is ${{ github.run_id }}-${{ github.run_attempt }}, which is unique across both re-runs and retries.

implementation notes

  • The value is stamped with yq + strenv rather than interpolated into the YAML literal. IDs that would otherwise be type-coerced or break the document round-trip correctly (01234 stays a string, true stays a string, values containing : or # are quoted), and the input never reaches the shell command string. yq is already installed by the action's first step, so this adds no dependency.
  • Backward compatible. deployment-id is optional with an empty default. Left unset, the step is skipped entirely and the deployment_id key is omitted, so config.yaml output is byte-identical for existing callers.
  • That last point is deliberate rather than cosmetic: the action only commits to the GitOps repo when git diff-index sees a change. Unconditionally emitting the key — even empty — would push a config-only commit, and an ArgoCD sync, for every application on the first deploy after upgrading.

testing

  • test-helm-raw.yml — passes deployment-id and asserts the value round-trips through the committed config.yaml.
  • test-helm-raw-default-kube-version.yml — asserts has("deployment_id") is false when the input is omitted, locking in the backward-compat guarantee above.
  • Verified locally that the render + stamp sequence is additive-only against a config.yaml matching what create-a-file-action produces, and that numeric-, boolean-, and colon-containing IDs read back correctly.
  • The integration workflows are workflow_dispatch-only against cloudposse-tests/argocd-deploy-non-prod-test, so they need a manual dispatch to exercise.

references

  • README.md gains a "Deduping ArgoCD notifications per deploy attempt" section covering the rollback gap, the recommended value, and the resulting config.yaml. Regenerated from README.yaml with atmos readme.

…dupe

ArgoCD's notification `oncePer` trigger dedupes on whichever field it is
pointed at. Keying it on the application commit means a rollback --
replaying a commit ArgoCD has already notified for -- is silently
suppressed, so the rollback reports no status at all.

Add an optional `deployment-id` input whose value is written to the
generated `config.yaml` as `deployment_id`, giving `oncePer` a field that
is unique per deploy attempt rather than per code state.

The value is stamped with `yq` and `strenv` rather than interpolated into
the YAML literal, so IDs that would otherwise be type-coerced or break the
document (`01234`, `true`, values containing `:`) round-trip correctly, and
the input never reaches the shell command string.

Left at its empty default the step is skipped entirely and the key is
omitted, keeping `config.yaml` byte-identical for existing callers. This
matters because the action only commits to the GitOps repo when the
rendered output actually changes -- always emitting the key would push a
config-only commit, and an ArgoCD sync, for every app on upgrade.

Covered by the helm raw tests in both directions: the value round-trips
through the committed `config.yaml` when passed, and the key is absent when
it is not.
Copilot AI lite review requested due to automatic review settings August 28, 2026 20:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@johncblandii
John C. Bland II (johncblandii) merged commit 9db127d into main Aug 28, 2026
33 checks passed
@johncblandii
John C. Bland II (johncblandii) deleted the feat/replicate-argocd-deploy-action branch August 28, 2026 20:39
@github-actions

Copy link
Copy Markdown

These changes were released in v1.11.0.

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.

3 participants