Closed carletes closed 3 years ago
We have fixed some similar issue introduced in harbor 2.0, but not sure why pushedtime is empty in 1.10.x yet. Do you have any special operation that how tag "2020-03-25-001" create ?
seems this is not an issue with tag retention engine, but how pushtimes are calculated. @carletes Can you elaborate on how these are pushed to harbor?
Can you elaborate on how these are pushed to harbor?
Sure! We push images from our CI build plans after tests run successfully, by doing something like this. We first push each image, using the image tag matching the Git repository branch it was built from:
$ docker push xxx/webdev/webdev-django:develop
Then we create a new tag that uniquely identifies the image we're pushing:
$ docker tag xxx/webdev/webdev-django:develop xxx/webdev/webdev-django:develop-XXYYZZ
And then we push that tag:
$ docker push xxx/webdev/webdev-django:develop-XXYYZZ
The aim of this is to have xxx/webdev/webdev-django:<branch-name>
always pointing to the image built from the Git HEAD
of the given branch, and xxx/webdev/webdev-django:<branch-name>-<some-id>
to the image we tested in the CI plan (so that we may then deploy to our Kubernetes cluster exactly what we tested).
The <some-id>
bit is the first seven characters of docker inspect xxx/webdev/webdev-django:<branch-name> --format '{{ .ID }}'
.
We run several build plans whenever a new Git commit is detected. It might be the case that several build plans running on different CI hosts end up doing something like this:
# Plan A on CI host `foo`
$ docker push xxx/webdev/webdev-django:develop
# Plan B on CI host `bar`
$ docker push xxx/webdev/webdev-django:develop
# Plan A on CI host `foo`
$ docker tag xxx/webdev/webdev-django:develop xxx/webdev/webdev-django:develop-1234567
# Plan B on CI host `bar`
$ docker tag xxx/webdev/webdev-django:develop xxx/webdev/webdev-django:develop-7654321
# Plan A on CI host `foo`
$ docker push xxx/webdev/webdev-django:develop-1234567
# Plan B on CI host `bar`
$ docker push xxx/webdev/webdev-django:develop-7654321
We're using Docker version 19.03.4 on some CI hosts, and version 19.03.7 on some others.
Not reproduced that PushedTime be '0001/01/01' with harbor.1.10.0 as the case. And 1.10.x is not actively maintained, please try newer harbor release.
Using Harbor version v1.10.0-6b84b62f, I have several retention rules defined in a project, one of which is the following:
**
, retain the images pulled within the last 1 days with tags matching**
I got a tag incorrectly deleted shortly after it was pushed --- probably because its
PushedTime
andPulledTime
were recorded incorrectly. The tag in question isdevelop-4e67f38
. This is the log from the retention process which deleted it:Note that there are other tags with incorrect values for
PushedTime
andPulledTime
, too. Luckily they are covered by other retention rules which do not depend on the pulled/pushed time.Is this a known issue?