Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle empty active branch #99

Open
crenshaw-dev opened this issue Nov 4, 2024 · 0 comments
Open

Gracefully handle empty active branch #99

crenshaw-dev opened this issue Nov 4, 2024 · 0 comments

Comments

@crenshaw-dev
Copy link
Contributor

If there's no hydrator.metadata in the active branch, the CTP controller currently fails with an error like this:

2024-11-04T15:33:44.793Z        INFO    Branch SHAs     {"controller": "changetransferpolicy", "controllerGroup": "promoter.argoproj.io", "controllerKind": "ChangeTransferPolicy", "ChangeTransferPolicy": {"name":"argocon-demo-environments-development-eadabead","namespace":"promoter-system"}, "namespace": "promoter-system", "name": "argocon-demo-environments-development-eadabead", "reconcileID": "ed437977-f5b0-4c19-8b09-5e277dcf1dfe", "branchShas": {"environments/development":{"Dry":"","Hydrated":"a126b37613c32213e03939a1b1556028ec9097ea"},"environments/development-next":{"Dry":"2ab072a32a4fd923604c40a2c14d986a66b7a359","Hydrated":"53e0a9ef8464fe2b987acd908173666c7a64d2d2"}}}
2024-11-04T15:33:44.794Z        ERROR   could not git show      {"controller": "changetransferpolicy", "controllerGroup": "promoter.argoproj.io", "controllerKind": "ChangeTransferPolicy", "ChangeTransferPolicy": {"name":"argocon-demo-environments-development-eadabead","namespace":"promoter-system"}, "namespace": "promoter-system", "name": "argocon-demo-environments-development-eadabead", "reconcileID": "ed437977-f5b0-4c19-8b09-5e277dcf1dfe", "gitError": "fatal: ambiguous argument '': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n", "error": "exit status 128"}
github.com/argoproj-labs/gitops-promoter/internal/git.(*GitOperations).GetShaTime
        /workspace/internal/git/git.go:180
github.com/argoproj-labs/gitops-promoter/internal/controller.(*ChangeTransferPolicyReconciler).calculateStatus
        /workspace/internal/controller/changetransferpolicy_controller.go:168
github.com/argoproj-labs/gitops-promoter/internal/controller.(*ChangeTransferPolicyReconciler).Reconcile
        /workspace/internal/controller/changetransferpolicy_controller.go:106
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Reconcile
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:116
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:303
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:263
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.2
        /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:224

Ideally the hydrator should take care of this. But at the least we should print a nicer error.

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

No branches or pull requests

1 participant