Conversation
Co-authored-by: Isaac James <isaac.james@hotmail.co.uk>
Co-authored-by: isaacjames <isaac.james@gocardless.com>
Co-authored-by: Emil Lozev <elozev@gocardless.com>
Co-authored-by: isaacjames <isaac.james@gocardless.com>
58834d1 to
9651dfb
Compare
@0x0013 I've minimised your comment as I changed the logic of the argocd deployer, and I will run the Claude code review separately on the new logic. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude review this PR! |
|
Claude finished @goelozev's task in 3m 6s —— View job Code Review: Rollbacks — Adding ArgoCD Deployer Backend
🔴 Critical Issues[
type applicationPatchSource struct {
TargetRevision string `json:"targetRevision"`
Plugin applicationPatchPlugin `json:"plugin,omitempty"` // ← BUG
}Go's Fix: change 🟡 Major Concerns[ return argocddeployer.NewDeployer(http.DefaultClient, ...)
[ Both [
[ proj.Spec.SyncWindows = append(proj.Spec.SyncWindows, SyncWindow{
Kind: "deny",
Schedule: "* * * * *",
Duration: "1h",
Applications: []string{"*"}, // ← all apps in the project
...
})This blocks syncs for every application in the ArgoCD project, not just the application that was rolled back. If a project houses multiple services, triggering a rollback on one will prevent all others from being synced for up to an hour. The [ There is no guard against adding a duplicate deny window. If [ err := r.triggerPostDeploymentHooks(ctx, rollback, toRelease)
if err != nil {
logger.Error(err, "failed to trigger post deployment hooks")
message = fmt.Sprintf("%s (post-deployment hooks failed: %v)", message, err)
}
return r.markRollbackSucceeded(ctx, logger, rollback, message)A hooks failure only appends to the [ if err := json.NewDecoder(getResp.Body).Decode(&proj); err != nil {
return fmt.Errorf("failed to decode project response: %w", err) // plain error
}
...
if err := json.Marshal(projectUpdate); err != nil {
return fmt.Errorf("failed to marshal project update: %w", err) // plain error
}These error paths return plain [ When 🔵 Minor Improvements[ The README states [ The [ If an ArgoCD application name or a target revision ever contains [ The test suite covers most branches well. One gap: the case where the last operation succeeded, the ✅ Positive Observations
Summary & Next StepsThe PR introduces a solid foundation for ArgoCD-backed rollbacks with good test coverage and a well-reasoned status-detection strategy. The most important fix before merge is the |
fix: add default http client timeout fix: switch to the existing logger fix: removed unused mapSyncStatus refactor: move error handler of getApplication docs: updated ArgoCD deployer docs test: adding a new test case fix: switch back to the default client
f8d8fd5 to
7355a1e
Compare
Addressed ✅
Addressed ✅
That's expected behaviour!
This is expected behaviour!
Addressed ✅
Addressed ✅
Addressed ✅
Addressed ✅
Addressed ✅
Not addressed.
Addressed ✅ |
9bbbf62 to
91159c7
Compare
Summary
Adding ArgoCD CI/CD backend for the rollback controller. This implementation will allow for faster rollbacks as it will skip our current CI system and directly perform the rollback. To run the rollback controller with ArgoCD, you will need to provide the following cmd flags:
--cicd-backend=argocd--argocd-server-url=<your-argocd-url>the base URL of your ArgoCD server (e.g.https://argocd.yourcompany.dev)--argocd-auth-token=<your-argocd-token>authentication token for a robot account, defined inargocd-cm (e.g.accounts.theatre: apiKey`)--argocd-app-name-template="<template>"- define template to resolve the application name. In GC, we are using thecompute-lab-{{.Namespace}}-{{.Target}}template for all ArgoCD application names. If you wish, you can modify that template, but currently, the only available fields you can use are.Namespaceand.Target. You can also override this on a Rollback level by providing theargocd_app_namedeployment option.Requirements
Rollbacks using this CI/CD backend requires the following deployment options:
target_revision- a specific revision or a JSONPath in the Release to find the revision (e.g.'{.config.revisions[?(@.name=="infrastructure")].id}').Optional deployment options:
app_revision- a specific revision or a JSONPath in the Release to find the revision (e.g.'{.config.revisions[?(@.name=="application")].id}').argocd_app_name- you can provide this deployment option if you wish to specify a specific application name if the application is not using the template provided in--argocd-app-name-template.argocd_add_sync_window- when set to true, a sync window will be added to the application, which will pause any further deploymentsChanges to the Deployer interface
The Deployer interface (used to provide structure for CI/CD backends) now has a
PostDeploymentHooksmethod, which will be called after the Rollback is deemed Healthy.Tests
Tests conducted in our lab environment:
target_revision,app_revisionandargocd_add_sync_window=trueset ✅target_revisionandargocd_add_sync_window=trueset ✅target_revisiononly set ✅