Description
If you are reporting a problem, please make sure the following information are provided:
1)Version of docker 1.12.3
2)Config files of harbor, just use http not https
3)Log files, you can get them by package the /var/log/harbor/
Dec 6 00:16:46 172.18.0.1 ui[26532]: 2016/13/06 05:16:46 #33[1;34m[router.go:829][D] | POST | /service/notifications | 601.872µs | match | /service/notifications | #33[0m
Dec 6 00:16:46 172.18.0.1 ui[26532]: 2016-12-06T05:16:46Z [DEBUG] [notification.go:96]: Increase the repository replication1/vmware/harbor-db pull count.
Dec 6 00:16:46 172.18.0.1 ui[26532]: 2016-12-06T05:16:46Z [ERROR] [accesslog.go:154]: error in AccessLog: Error 1048: Column 'project_id' cannot be null
Dec 6 00:16:46 172.18.0.1 ui[26532]: 2016-12-06T05:16:46Z [ERROR] [accesslog.go:155]: sql command is: admin, replication1/vmware, replication1/vmware/harbor-db, dev, pull
Dec 6 00:16:46 172.18.0.1 ui[26532]: 2016-12-06T05:16:46Z [ERROR] [notification.go:73]: failed to add access log: Error 1048: Column 'project_id' cannot be null
Analysis: Harbor receive the notification after push repository registry complete, but if the more than two "/" in the repository name, harbor couldn't find the right project name, but this repository already exist in the Harbor's registry, for example:
10.1.1.143/replication1/vmware/harbor-log
Harbor's ip is "1.1.1.143 "
project name is "replication1 "
but Harbor think project name is "replication1/vmware"
Fix : "src/common/utils/utils.go :49"
func ParseRepository(repository string) (project, rest string) {
repository = strings.TrimLeft(repository, "/")
repository = strings.TrimRight(repository, "/")
if !strings.ContainsRune(repository, '/') {
rest = repository
return
}
//index := strings.LastIndex(repository, "/") //replace this line with following line
index := strings.Index(repository, "/")
project = repository[0:index]
rest = repository[index+1:]
return
}
Activity
rikatz commentedon Dec 6, 2016
Actually, is this even possible on pure Docker Registry? I though that the first '/' separates the project and the image name, and that there weren't more sub projects or sub images possible.
I'm trying to remember a repo on the public Docker Hub that uses more than on slash, but can't remember 😄
Can you please show me some repo or even try to publish on the public Docker Hub with more than one slash on the image tag/name, so I can try to make a PR on the code correcting this :)
Tks
Alex-toughman commentedon Dec 6, 2016
hi rikatz, thank you for your reply.
Actually, docker tag command support more than one "/" as the repo name, docker user also can make a repo with more than one "/" as the name, and this repo can be pushed into private Registry, no matther it if exist on current docker Hub.( my docker version is 1.12.3)
I think it is not good if the user push the repo to the Harbor registry successfully but can't find it on Harbor UI.
I suggest 1) support this scenario, or 2) forbid user push more than one "/" repository , and give him the reason.
rikatz commentedon Dec 9, 2016
@onecool2 I see now that you already have a fix on the code (in the description of your issue).
Have you already tried this way, correcting the code and testing?
If don't, I can check that. I'm just pretty busy this week.
Alex-toughman commentedon Dec 9, 2016
@rikatz . thank you for your reply.
I just did some sample testing on the change. Such as push repo and find it on Harbor UI.
: )
support multiple namespace fix goharbor#1217