Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-23706

Docker Promotion to the source repository deletes the file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Resolution: Done
    • Affects Version/s: 6.12.2, 6.21.0
    • Fix Version/s: 7.16.1, 7.16.3
    • Component/s: Artifactory
    • Labels:
      None
    • Severity:
      Medium
    • Team:
      dev-artifactory-packages
    • Release Notes:
      Yes

      Description

      Problem description:

      When performing a docker promotion to the same repository the image is already in, rather than a new destination, it deletes the image instead. This can cause accidental artifact deletionssince this is not expected behavior at all.

       

      Expected behavior:

      Ideally this would return with a message saying you aren't promoting the image anywhere and the promotion gets aborted, or the promotion promotes the image to the same repository it is already in so the image is retained. Currently the image gets deleted with no warning or feedback.

       

      Steps to reproduce:

      To reproduce, upload a docker image alpine:latest to docker-local.

      Then run a
      curl -X POST -u user:password -H "Content-Type: application/json" -d @test.json https://<ArtifactoryURL>/artifactory/api/docker/docker-local/v2/promote

      and your test.json looks like

      { "targetRepo" : "docker-local", "dockerRepository" : "alpine", "tag" : "latest", "copy": true }

       

      then the command will simply delete your image without copying or promoting it. It's interesting to note that regardless of if "copy" is set to true or false, the image will be deleted without a new one being made.

       

      On different versions, different error messages occur. In earlier versions such as 6.12.2, we actually get a

      Promotion ended successfully

      message even though the file is essentially gone now, which is definitely not a success.

      In later versions such as 6.21.0, there has been some updates to the promote API and it recognizes this self promotion is an issue, so we'll see an error like so: 

      {
      "errors" : [

      { "status" : 404, "message" : "Unable to find docker image 'alpine/latest'. Promotion aborted" }

      ]
      }

      Even though it prints this error, it still performs the same behavior and deletes the image, only the return output is changed.

       

        Attachments

          Activity

              People

              Assignee:
              asafz Asaf Zalcman
              Reporter:
              niro Nir Ovadia
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: