Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAG_RETENTION event webhook payload is incorrect #18428

Closed
YangJiao0817 opened this issue Mar 27, 2023 · 1 comment · Fixed by #18462
Closed

TAG_RETENTION event webhook payload is incorrect #18428

YangJiao0817 opened this issue Mar 27, 2023 · 1 comment · Fixed by #18462

Comments

@YangJiao0817
Copy link
Member

UI:
图片

payload:

{
  "type": "TAG_RETENTION",
  "occur_at": 1679885941,
  "operator": "MANUAL",
  "event_data": {
    "retention": {
      "total": 0,
      "retained": 0,
      "harbor_hostname": "10.202.250.222",
      "project_name": "webhook1",
      "retention_policy_id": 1,
      "retention_rule": [
        {
          "template": "latestPulledN",
          "params": {
            "latestPulledN": 1
          },
          "tag_selectors": [
            {
              "kind": "doublestar",
              "decoration": "matches",
              "pattern": "**",
              "extras": "{\"untagged\":true}"
            }
          ],
          "scope_selectors": {
            "repository": [
              {
                "kind": "doublestar",
                "decoration": "repoMatches",
                "pattern": "**",
                "extras": ""
              }
            ]
          }
        }
      ],
      "result": "SUCCESS",
      "deleted_artifact": [
        {
          "type": "image",
          "status": "SUCCESS",
          "name_tag": "images:latest"
        }
      ]
    }
  }
}

Harbor version: v2.6.x v2.7.x v2.8.x

@YangJiao0817 YangJiao0817 changed the title TAG_RETENTION event webhook payload total field and retained field are incorrect TAG_RETENTION event webhook payload is incorrect Mar 29, 2023
@YangJiao0817
Copy link
Member Author

Two artifacts are actually deleted, but only one is shown in the deleted_artifact of the payload.

{
  "specversion": "1.0",
  "id": "f16d7ad1-c7a3-424d-b748-df8501861967",
  "source": "/projects/2/webhook/policies/3",
  "type": "harbor.tag_retention.finished",
  "datacontenttype": "application/json",
  "time": "2023-03-29T08:36:20Z",
  "data": {
    "retention": {
      "total": 3,
      "retained": 1,
      "harbor_hostname": "10.202.250.189",
      "project_name": "test01",
      "retention_policy_id": 1,
      "retention_rule": [
        {
          "template": "latestPushedK",
          "params": {
            "latestPushedK": 1
          },
          "tag_selectors": [
            {
              "kind": "doublestar",
              "decoration": "matches",
              "pattern": "**",
              "extras": "{\"untagged\":true}"
            }
          ],
          "scope_selectors": {
            "repository": [
              {
                "kind": "doublestar",
                "decoration": "repoMatches",
                "pattern": "**",
                "extras": ""
              }
            ]
          }
        }
      ],
      "result": "SUCCESS",
      "deleted_artifact": [
        {
          "type": "image",
          "status": "SUCCESS",
          "name_tag": "big:v2"
        }
      ]
    }
  },
  "operator": "MANUAL"
}

chlins added a commit to chlins/harbor that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: goharbor#18428

Signed-off-by: chlins <[email protected]>
chlins added a commit to chlins/harbor that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: goharbor#18428

Signed-off-by: chlins <[email protected]>
chlins added a commit to chlins/harbor that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: goharbor#18428

Signed-off-by: chlins <[email protected]>
chlins added a commit to chlins/harbor that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: goharbor#18428

Signed-off-by: chlins <[email protected]>
chlins added a commit to chlins/harbor that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: goharbor#18428

Signed-off-by: chlins <[email protected]>
chlins added a commit that referenced this issue Apr 3, 2023
Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: #18428

Signed-off-by: chlins <[email protected]>
wy65701436 pushed a commit that referenced this issue Apr 6, 2023
fix: correct the retention webhook payload

Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: #18428

Signed-off-by: chlins <[email protected]>
wy65701436 pushed a commit that referenced this issue Apr 6, 2023
fix: correct the retention webhook payload

Fix the incorrect number of total and retained in the retention webhook
payload, and completes the deleted_artifacts field.

Fixes: #18428

Signed-off-by: chlins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants