cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
972 stars 35 forks source link

Confusing error message when missing required settings for gitea #215

Closed nettnikl closed 5 months ago

nettnikl commented 6 months ago

Hi,

thanks for the project, very useful! Did some updates and saw it wasnt updating for some time - checking it i'm getting confusing messages. Also faced https://github.com/cooperspencer/gickup/issues/208 (had to apply a workaround to patch the system cert store) and https://github.com/cooperspencer/gickup/issues/117#issuecomment-1281532186, but those were self-explanatory. I didn't get any of those issues before for this config, so either gitea or gickup changed in some regards. I think i found the remaining issue in the logs, see below. Could we get a validation that all required values are there, a error message reporting on the 422 in the logs (instead of swallowing the underlying error message whole) or some default value for gitea sync interval?

gitea-server-1  | 2024/03/24 22:47:42 ...eb/routing/logger.go:102:func1() [I] router: completed GET /api/v1/version for 172.20.0.1:0, 200 OK in 112.8ms @ misc/version.go:15(misc.Version)
gitea-server-1  | 2024/03/24 22:47:42 ...eb/routing/logger.go:102:func1() [I] router: completed GET /api/v1/user for 172.20.0.1:0, 200 OK in 109.9ms @ user/user.go:123(user.GetAuthenticatedUser)
gitea-server-1  | 2024/03/24 22:47:42 ...eb/routing/logger.go:102:func1() [I] router: completed GET /api/v1/users/nettnikl for 172.20.0.1:0, 200 OK in 26.9ms @ user/user.go:96(user.GetInfo)
gitea-server-1  | 2024/03/24 22:47:42 ...eb/routing/logger.go:102:func1() [I] router: completed GET /api/v1/repos/nettnikl/XXX for 172.20.0.1:0, 200 OK in 66.9ms @ repo/repo.go:519(repo.Get)
gitea-server-1  | 2024/03/24 22:47:43 .../api/v1/repo/repo.go:1055:updateMirror() [E] Wrong format for MirrorInternal Sent: time: invalid duration ""
gitea-server-1  | 2024/03/24 22:47:43 ...eb/routing/logger.go:102:func1() [I] router: completed PATCH /api/v1/repos/nettnikl/XXX for 172.20.0.1:0, 422 Unprocessable Entity in 185.0ms @ repo/repo.go:592(repo.Edit)
gickup-runner-1       | 2024-03-24 22:47:41 INF mirroring XXX to https://git.xxx.yyy stage=gitea url=https://git.xxx.yyy
gickup-runner-1       | 2024-03-24 22:47:41 INF Read token file bytes=41 path=/run/secrets/token-gitea
gickup-runner-1       | 2024-03-24 22:47:42 ERR Couldn't update XXX stage=gitea url=https://git.xxx.yyy
destination:
  gitea:
    - token_file: /run/secrets/token-gitea
      url: https://git.xxx.yyy
      createorg: true

Here the relevant code: https://github.com/cooperspencer/gickup/blob/7175ab6d17370a33fee7ec2c8828d3609062e007/gitea/gitea.go#L109C22-L109C36

cooperspencer commented 6 months ago

Hi, I am glad that you like it. Yes, good idea. I'll add giteas error message as well.

cooperspencer commented 6 months ago

I just added a pr for this. https://github.com/cooperspencer/gickup/pull/216/files Basically checking if it is a valid duration and if it is not it switches to the configured interval of the repository. I also added the error message from Gitea if anything happens during the change of the interval.

Please let me know if that solves your issue or if you are missing anything.

nettnikl commented 6 months ago

Thanks, will test it!

cooperspencer commented 6 months ago

@nettnikl did you test it? was it ok for you?

cooperspencer commented 6 months ago

I merged it. It will go out with the next release.

cooperspencer commented 5 months ago

I just pushed a new release with this fix included.