Giter Club home page Giter Club logo

Comments (9)

AyushCloud avatar AyushCloud commented on May 23, 2024 1

Hello,

harbor_db=> \d repository

Table "public.repository"
Column | Type | Collation | Nullable | Default
---------------+-----------------------------+-----------+----------+---------------------------------------------------
repository_id | integer | | not null | nextval('repository_repository_id_seq'::regclass)
name | character varying(255) | | not null |
project_id | integer | | not null |
description | text | | |
pull_count | integer | | not null | 0
star_count | integer | | not null | 0
creation_time | timestamp without time zone | | | CURRENT_TIMESTAMP
update_time | timestamp without time zone | | | CURRENT_TIMESTAMP
Indexes:
"repository_pkey" PRIMARY KEY, btree (repository_id)
"repository_name_key" UNIQUE CONSTRAINT, btree (name)
Triggers:
repository_update_time_at_modtime BEFORE UPDATE ON repository FOR EACH ROW EXECUTE FUNCTION update_update_time_at_column()

It is same.

The issue arises when we have a repo name "go_user_task" and rename to "go-user-task".

Also i saw a similar post #19468.
For Harbor v2.8.4 version

Thank You,
Ayush

from harbor.

AyushCloud avatar AyushCloud commented on May 23, 2024

Hello,

In Postgresql query we could see it is listing both "go_user_task" and "go-user-task"

May be postgresql is failed differentiate between "_" and "-"

harbor_db=> select * from repository where name LIKE 'components/go-user%'; 
 repository_id | name | project_id | description | pull_count | star_count | creation_time | update_time 
---------------+--------------------------+------------+-------------+------------+------------+----------------------------+---------------------------- 
 1870 | components/go-user-task | 464 | | 45 | 0 | 2024-01-19 11:45:21.786858 | 2024-01-28 00:40:34.245535 
 1929 | components/go-user-task | 464 | | 23 | 0 | 2024-01-25 12:58:28.767893 | 2024-01-30 16:17:49.893138 
(2 rows) 

select * from repository where name LIKE 'components/go_user%'; 
 repository_id | name | project_id | description | pull_count | star_count | creation_time | update_time 
---------------+--------------------------+------------+-------------+------------+------------+----------------------------+---------------------------- 
 1866 | components/go_user_task | 464 | | 41 | 0 | 2024-01-16 15:57:26.64285 | 2024-01-30 15:46:25.162086 
 1870 | components/go-user-task | 464 | | 45 | 0 | 2024-01-19 11:45:21.786858 | 2024-01-28 00:40:34.245535 
 1929 | components/go-user-task | 464 | | 23 | 0 | 2024-01-25 12:58:28.767893 | 2024-01-30 16:17:49.893138 
 1930 | components/go_user_task | 464 | | 1 | 0 | 2024-01-25 14:42:32.075659 | 2024-01-30 16:46:40.25571 
(4 rows) 

from harbor.

MinerYang avatar MinerYang commented on May 23, 2024

Nah, it's do differentiate - and _.
Uploading Screenshot 2024-02-02 at 15.31.45.png…

Could you describe your repository table to determin if there's any UNIQUE CONSTRAINT

psql
\c registry
\d repository

It should looks like this

Indexes:
    "repository_pkey" PRIMARY KEY, btree (repository_id)
    "repository_name_key" UNIQUE CONSTRAINT, btree (name)

from harbor.

MinerYang avatar MinerYang commented on May 23, 2024

Could you describe how do you exactly rename repo name from "go_user_task" to "go-user-task".

from harbor.

AyushCloud avatar AyushCloud commented on May 23, 2024

Hello,

We accidently use the repo name "go-user-task" instead of "go_user_task", then tag and push the image.
So i am just guessing it could be because of "_"/ "-". But i am not sure, why it is showing two repo with same name in UI and backend as well. And when we try to delete it then it says "repo not exist"

Thanks,
Ayush

from harbor.

zyyw avatar zyyw commented on May 23, 2024

@AyushCloud could you please provide us with steps how you end up with two components/go_admin_task repositories as you posted in this following image:
go_admin_task

I tried the following steps intending to reproduce this scenario:

  • docker tag alpine:2.6 /components/go-user-task:2.6
  • docker tag alpine:2.6 /components/go_user_task:2.6
  • docker push /components/go-user-task:2.6
  • docker push /components/go_user_task:2.6

but there are two repositories with different name, such as components/go-user-task and components/go_user_task. And they are different names, not the same records occurs two times.
Screenshot 2024-02-05 at 12 25 29

from harbor.

AyushCloud avatar AyushCloud commented on May 23, 2024

Hello,

Even i tried to reproduce, but it is now showing any duplicate repo.

select * from repository where name LIKE 'components/go_admin%';
repository_id | name | project_id | description | pull_count | star_count | creation_time | update_time
---------------+--------------------------+------------+-------------+------------+------------+----------------------------+----------------------------
1866 | components/go_admin_task | 464 | | 41 | 0 | 2024-01-16 15:57:26.64285 | 2024-01-30 15:46:25.162086
1870 | components/go-admin-task | 464 | | 45 | 0 | 2024-01-19 11:45:21.786858 | 2024-01-28 00:40:34.245535
1929 | components/go-admin-task | 464 | | 23 | 0 | 2024-01-25 12:58:28.767893 | 2024-01-30 16:17:49.893138
1930 | components/go_admin_task | 464 | | 1 | 0 | 2024-01-25 14:42:32.075659 | 2024-01-30 16:46:40.25571

Based on the time stamp, i could say that, on 25th January we did an upgrade to v2.8.4.
So i believe the repo already exist and post upgrade showing duplicate repo.

Thanks,
Ayush

from harbor.

zyyw avatar zyyw commented on May 23, 2024

please follow this workaround:

closing it now.

from harbor.

SunilDD avatar SunilDD commented on May 23, 2024

Regarding: Duplicate Repository

I encountered the same issue after upgrading from Harbor version v2.8.2-d4c34dcc to v2.8.4-ad3e767d regarding image repository management.

Before the upgrade, I had several images pushed with different repository names, some containing underscores ('_') and hyphens ('-'). For instance, repositories like go_admin_task/image:1.0, go-admin-task/image:1.0, before-upgrade:1.0, and before_upgrade:2.0 were present.

After the upgrade, I noticed that images from repositories with names differing only in the use of underscores or hyphens were unexpectedly deleted. Specifically, repositories with names like go_admin_task/image:1.0 and go-admin-task/image:1.0, as well as before-upgrade:1.0 and before_upgrade:2.0, were affected. Interestingly, repositories without such naming discrepancies, like temp_admin/image:1.0 and temp_admin/image:2.0, remained intact.

Furthermore, attempts to push images to repositories containing underscores or hyphens post-upgrade resulted in the creation of duplicate repositories. This behavior was not observed prior to the upgrade.

I believe this issue warrants attention from the Harbor community as it impacts repository management consistency and may lead to unintended data loss or duplication. Any assistance or insights into resolving this matter would be greatly appreciated.

Thank you
Sunil

from harbor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.