GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

errors.go 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package daemon
  2. import (
  3. "fmt"
  4. "sync"
  5. fluxerr "github.com/fluxcd/flux/errors"
  6. "github.com/fluxcd/flux/job"
  7. "github.com/fluxcd/flux/resource"
  8. )
  9. type SyncErrors struct {
  10. errs map[resource.ID]error
  11. mu sync.Mutex
  12. }
  13. func manifestLoadError(reason error) error {
  14. return &fluxerr.Error{
  15. Type: fluxerr.User,
  16. Err: reason,
  17. Help: `Unable to parse files as manifests
  18. Flux was unable to parse the files in the git repo as manifests,
  19. giving this error:
  20. ` + reason.Error() + `
  21. Check that any files mentioned are well-formed, and resources are not
  22. defined more than once. It's also worth reviewing
  23. https://docs.fluxcd.io/en/latest/requirements.html
  24. to make sure you're not running into any corner cases.
  25. If you think your files are all OK and you are still getting this
  26. message, please log an issue at
  27. https://github.com/fluxcd/flux/issues
  28. and include the problematic file, if possible.
  29. `,
  30. }
  31. }
  32. func unknownJobError(id job.ID) error {
  33. return &fluxerr.Error{
  34. Type: fluxerr.Missing,
  35. Err: fmt.Errorf("unknown job %q", string(id)),
  36. Help: `Job not found
  37. This is often because the job did not result in committing changes,
  38. and therefore had no lasting effect. A release dry-run is an example
  39. of a job that does not result in a commit.
  40. If you were expecting changes to be committed, this may mean that the
  41. job failed, but its status was lost.
  42. In both of the above cases it is OK to retry the operation that
  43. resulted in this error.
  44. If you get this error repeatedly, it's probably a bug. Please log an
  45. issue describing what you were attempting, and posting logs from the
  46. daemon if possible:
  47. https://github.com/weaveworks/flux/issues
  48. `,
  49. }
  50. }
  51. func unsignedHeadRevisionError(latestValidRevision, headRevision string) error {
  52. return &fluxerr.Error{
  53. Type: fluxerr.User,
  54. Err: fmt.Errorf("HEAD revision is unsigned"),
  55. Help: `HEAD is not a verified commit.
  56. The branch HEAD in the git repo is not verified, and fluxd is unable to
  57. make a change on top of it. The last verified commit was
  58. ` + latestValidRevision + `
  59. HEAD is
  60. ` + headRevision + `.
  61. `,
  62. }
  63. }