Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-24391

'Destination already contains component' error when using staging API for docker repo.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.23.0
    • Fix Version/s: None
    • Component/s: Staging
    • Labels:
    • Notability:
      2

      Description

      When a docker tag/version with same version exist in the staged docker hosted repo then the staging API fails to move the docker images. Even when the target docker hosted repository has "Deployment Policy = Allow Redeploy"

      Steps to reproduce the issue.

      Step-1). Create docker image and then push it to the "docker-hosted" repo.

      cat > Dockerfile << EOF 
      FROM alpine
      RUN echo "v1.0.0" > /tmp/version.txt
      EOF
      
      docker build -t buildtoolstest:v1.0.0 .
      
      docker tag buildtoolstest:v1.0.0 node1.example.com:5000/buildtoolstest:v1.0.0
      docker tag buildtoolstest:v1.0.0 node1.example.com:5000/buildtoolstest:v1.0
      docker tag buildtoolstest:v1.0.0 node1.example.com:5000/buildtoolstest:v1
      
      docker push node1.example.com:5000/buildtoolstest:v1.0.0
      docker push node1.example.com:5000/buildtoolstest:v1.0
      docker push node1.example.com:5000/buildtoolstest:v1
      

      Step-2). Using Staging API move these docker images from "docker-hosted" to "docker-hosted-test" docker repo.

      curl -u admin:admin123 -X POST "http://node1.example.com:8081/service/rest/v1/staging/move/docker-hosted-test?docker.imageName=buildtoolstest&repository=docker-hosted"
      
      {
        "status" : 200,
        "message" : "Move Successful",
        "data" : {
          "destination" : "docker-hosted-test",
          "components moved" : [ {
            "name" : "buildtoolstest",
            "version" : "v1.0.0"
          }, {
            "name" : "buildtoolstest",
            "version" : "v1.0"
          }, {
            "name" : "buildtoolstest",
            "version" : "v1"
          } ]
        }
      }
      

      Step-3). Now Create another docker image and push it again to "docker-hosted".

      cat > Dockerfile << EOF 
      FROM alpine
      RUN echo "v1.0.1" > /tmp/version.txt
      EOF
      
      docker build -t buildtoolstest:v1.0.1 .
      
      docker tag buildtoolstest:v1.0.1 node1.example.com:5000/buildtoolstest:v1.0.1
      docker tag buildtoolstest:v1.0.1 node1.example.com:5000/buildtoolstest:v1.0
      docker tag buildtoolstest:v1.0.1 node1.example.com:5000/buildtoolstest:v1
      
      docker push node1.example.com:5000/buildtoolstest:v1.0.1
      docker push node1.example.com:5000/buildtoolstest:v1.0
      docker push node1.example.com:5000/buildtoolstest:v1
      

      Step-4). Using Staging API now move

      curl -u admin:admin123 -X POST "http://node1.example.com:8081/service/rest/v1/staging/move/docker-hosted-test?docker.imageName=buildtoolstest&docker.imageTag=v1.0.1&repository=docker-hosted"
      
      {
        "status" : 200,
        "message" : "Move Successful",
        "data" : {
          "destination" : "docker-hosted-test",
          "components moved" : [ {
            "name" : "buildtoolstest",
            "version" : "v1.0.1"
          } ]
        }
      } 
      

      However, other move fails which already has the same :

      curl -u admin:admin123 -X POST "http://node1.example.com:8081/service/rest/v1/staging/move/docker-hosted-test?docker.imageName=buildtoolstest&docker.imageTag=v1.0&repository=docker-hosted"
      
      {
        "status" : 400,
        "message" : "Destination already contains component: group=null, name=buildtoolstest, version=v1.0, format=docker",
        "data" : {
          "source" : {
            "repository" : "docker-hosted",
            "format" : "docker"
          },
          "destination" : {
            "repository" : "docker-hosted-test",
            "format" : "docker"
          }
        }
      }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            jsensharma Jay Kumar SenSharma
            CC:
            Richard Bywater
            Last Updated By:
            Rich Seddon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Date of First Response:

                tigCommentSecurity.panel-title