-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Expected behavior and actual behavior:
One of our teams has a daily CI pipeline that builds a helm chart, and uploads it into our Harbor installation. Because there aren't changes every day, the chart is often uploaded with the exact same version like the day before. Because version tags obviously need to be unique and can only be used once, Harbor removes the tag from the artifact of yesterday and tags the artifact from today.
When you now try to browse the /artifacts-tab of this repository, the website only shows a spinner and you get a lot of JS errors in the browser console. After some digging through the code we found the following line to be the problem:
Line 108 in 70306dc
artifact.tags[0].name, |
Harbor tries to generate a pull URL for every artifact in this table for the user to just click and copy/paste. Because the tag from the artifact from yesterday was removed,
i.tags[0]
throws a TypeError because the key is null (See API output further down).
Every night when our garbage collect job is running, this tag-less artifact is cleaned up and the web-ui is fixed until the next CI job of this helm chart runs.
For Container Images in Harbor, this is not a problem when you push multiple times with the same tag, because here the pull URL is always created via their artifact sha256 sum and not with the tag the image has.
Because Helm chart can't be pulled via their hash and only with a version tag (please correct me if I'm wrong here), the table should probably skip trying to render this button if the artifact has no tag.
Steps to reproduce the problem:
- Build and push a Helm chart into Harbor with a versiontag of X
- Throw away your helm.tgz
- Build and push the chart again, with the same versiontag like in step 1
- Go to the harbor webui and try to list the artifacts for this repository in the "/artifacts-tab"
Versions:
- harbor version: v2.13.0-db1569ae
Additional context:
API Call to /artifacts on the problematic repository. You can see the 'good' artifact from today with the version tag, and the 'bad' artifact from yesterday without a tag:
[
{
"accessories": null,
"addition_links": {...}, },
"annotations": {...},
"artifact_type": "application/vnd.cncf.helm.config.v1+json",
"digest": "sha256:30849d2a2a701104356252a10d366ba82c4b2c5a2e158c7dc9f12ae42a41cd75",
"extra_attrs": {...},
"icon": "sha256:61cf3a178ff0f75bf08a25d96b75cf7355dc197749a9f128ed3ef34b0df05518",
"id": 101557,
"labels": null,
"manifest_media_type": "application/vnd.oci.image.manifest.v1+json",
"media_type": "application/vnd.cncf.helm.config.v1+json",
"project_id": 5,
"pull_time": "0001-01-01T00:00:00.000Z",
"push_time": "2025-04-30T08:41:09.615Z",
"references": null,
"repository_id": 4293,
"repository_name": "team-XXX/charts/common-chart",
"size": 6952,
"tags": [
{
"artifact_id": 101557,
"id": 114269,
"immutable": false,
"name": "2.0.18_c2b19380",
"pull_time": "0001-01-01T00:00:00.000Z",
"push_time": "2025-04-30T08:41:09.961Z",
"repository_id": 4293
}
],
"type": "CHART"
},
{
"accessories": null,
"addition_links": {...},
"annotations": {...},
"artifact_type": "application/vnd.cncf.helm.config.v1+json",
"digest": "sha256:506f91f4cfbcdee8acc2bc0d67b2cbf6808fca66891bdd84d8328620be541334",
"extra_attrs": {...},
"icon": "sha256:61cf3a178ff0f75bf08a25d96b75cf7355dc197749a9f128ed3ef34b0df05518",
"id": 101387,
"labels": null,
"manifest_media_type": "application/vnd.oci.image.manifest.v1+json",
"media_type": "application/vnd.cncf.helm.config.v1+json",
"project_id": 5,
"pull_time": "2025-04-29T10:21:18.818Z",
"push_time": "2025-04-29T08:41:03.712Z",
"references": null,
"repository_id": 4293,
"repository_name": "team-XXX/charts/common-chart",
"size": 6955,
"tags": null,
"type": "CHART"
}
]