HylandSoftware/Harbor.Tagd

Error with harbor 1.8 ?

Closed this issue · 7 comments

Hi,
I'm trying Tagd with a hosted version of Harbor 1.8 by OVH

I run the following command:

docker run -it --rm -v /tmp/config.yml:/config.yml hylandsoftware/tagd --endpoint https://xxxxx.xxxx.container-registry.ovh.net --user xxxxxxx --password xxxxxx --config-file /config.yml -vdebug

And the config.yml file the example one provided in README.md
I have the following output:

[17:07:19 INF] Loading rules using Harbor.Tagd.Rules.FilesystemRuleProvider
[17:07:19 WRN] Running in report-only mode. To delete tags, run with --destructive
[17:07:19 INF] Connecting to https://xxxx.xxx.container-registry.ovh.net as xxxxxx
[17:07:19 INF] Running in report-only mode
[17:07:19 FTL] An Error was encountered while processing tags
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Harbor.Tagd.API.HarborClient.<ProbeVersion>d__12.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/API/HarborClient.cs:line 43
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Harbor.Tagd.API.HarborClient.<Login>d__13.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/API/HarborClient.cs:line 51
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Harbor.Tagd.TagEngine.<Process>d__9.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/TagEngine.cs:line 64
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Harbor.Tagd.TagEngine.<Process>d__9.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/TagEngine.cs:line 99
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Harbor.Tagd.TagEngine.<Process>d__9.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/TagEngine.cs:line 106
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Harbor.Tagd.Program.<DoClean>d__3.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/Program.cs:line 128
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Harbor.Tagd.Program.<Main>d__2.MoveNext() in /home/travis/build/HylandSoftware/Harbor.Tagd/src/Harbor.Tagd/Program.cs:line 98

Could this be an incompatibility with Harbor 1.8 ?

nlowe commented

I'll have to spin up a copy of 1.8 to test against. It's possible the way I was checking the version broke in 1.8. I'll take a look later today.

nlowe commented

@Congelli501 What's the harbor_version field value in /api/systeminfo on your registry? A local instance of 1.8.2 I just setup is returning v1.8.2-1c3a3d53 which should still be compatible with the version detection logic we're using here.

nlowe commented

Tagd appears to work fine against my sample 1.8 registry. I'm guessing OVH is stripping some information from the /api/systeminfo endpoint or blocking it all together.

The version field is set to dev, they must be using some custom patch / build from master.

This returns the following data:

{
	"with_notary": false,
	"with_clair": false,
	"with_admiral": false,
	"admiral_endpoint": "",
	"auth_mode": "db_auth",
	"registry_url": "1yvuiziu.gra5.container-registry.ovh.net",
	"external_url": "https://1yvuiziu.gra5.container-registry.ovh.net",
	"project_creation_restriction": "everyone",
	"self_registration": false,
	"has_ca_root": false,
	"harbor_version": "dev",
	"registry_storage_provider_name": "swift",
	"read_only": false,
	"with_chartmuseum": false
}

If you want, I can provide you with an access to a temporary harbor project on my instance.
I can also try to ask OVH to set the version to 1.8.x, for better compatibility.

nlowe commented

Nah, we should probably still support dev registries. This is only used to figure out how to log in. I can add a flag for force it one way or the other, can probably have a PR up later tonight. Thanks for the find!

nlowe commented

@Congelli501 Can you try again with hylandsoftware/tagd:GH-29, adding an extra flag: --force-new-login?

It works perfectly, thanks a lot!