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

Old builds retention is deleting builds unintentionally during buildinfo replication

    XMLWordPrintable

    Details

    • Severity:
      High

      Description

      Problem description:

      JSON schema that we support for buildinfo.json includes the buildRetention block, as below.

      https://www.jfrog.com/confluence/display/JFROG/Build+Integration#BuildIntegration-JSONSchema

       

      "buildRetention" : { // Build retention information
          "deleteBuildArtifacts" : true, // Automatically remove build artifacts stored in Artifactory (true/false)
          "count" : 100, // The maximum number of builds to store in Artifactory.
          "minimumBuildDate" : 1407345768020, // Earliest build date to store in Artifactory
          "buildNumbersNotToBeDiscarded" : [ ] // List of build numbers that should not be removed from Artifactory
        }

       

      Deploying such buildinfo.json to artifactory-build-info repository triggers build retention, i.e it will start deleting "old" builds and will keep the number of builds as it is set in "count", 100 in the example above.

       

      During the replication of buildinfo repository from Artifactory A (source) to Artifactory B (target), buildinfo.json files are not replicated to the target in the same order as they were deployed to the source. For example, buildinfo 25-<timestamp>.json will be likely replicated after buildinfo 14999-<timestamp>.json since the replication feature uses File List API to find which files need to be replicated. It seems that File List return files in lexicographic sorting order, i.e. it compares character by character ("25" is greater than "14999" because '2' is greater than '1').

       

      If one of the "old" buildinfo.json files has the buildRetention.count set, while in the latest builds it's disabled, the "old" buildinfo replicated later triggers retention, i.e. deletes the newer builds up until the buildRetention.count builds are left in the repository. The buildinfo CRON replication will run in an infinite loop trying to complete the replication.

       

      What is the expected behavior?

      1) Buildinfo repository replication will be completed successfully

      2) Build retention triggered by replication is unexpected 

       

      Steps to reproduce: 

       

      1. Deploy 20 builds (overall) to Artifactory A
      2. Include buildRetention in build number 2 json file, eg:
        "buildRetention": {
                "count": 5,
                "deleteBuildArtifacts": true,
                "buildNumbersNotToBeDiscarded": []
            }
      1. Setup replication of buildinfo repository  from Artifactory A to Artifactory B
      2. Check out the contents of Artifactory B once replication is finished

       

      Possible workaround:

      A possible workaround is to download all the builds, update/delete the retention in the buildinfo.json, and deploy back to Artifactory. 

        Attachments

          Activity

              People

              Assignee:
              alexeiv Alexei Vainshtein
              Reporter:
              valeriyp Valeriy Petrov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Sync Status

                  Connection: RTFACT Sync
                  RTMID-23774 -
                  SYNCHRONIZED
                  • Last Sync Date: