conan-package-tools: ERROR: Remote recipe is newer than local recipe

Getting this with Jenkins, I thought I remember seeing that CPT had a force built in to override this error but I guess not. Should it?

conans.errors.ConanException: Remote recipe is newer than local recipe: 
 Remote date: 1524688506
 Local date: 1524688499

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 30 (16 by maintainers)

Most upvoted comments

I would try to explain what is this issue about and why we don’t force the uploads by default.

Conan, when you upload a recipe or a package, check the manifest containing the checksums of the recipe files (usually just a conanfile.py). If the contents are the same, Conan doesn’t care about the dates, because, actually will skip the real upload as it is already there.

But if the recipe is different, by default, we want to warn the user if you are trying to overwrite a newer recipe. How can it happen? well, if a slave takes less time to build a package than others, it could happen that the recipe uploaded is newer than the local one.

But why are they different? Usually, this is an issue with the CRLF characters. If you see some traces like the following you have the answer:

Local 'conanfile.py' using '\r\n' line-ends
Remote 'conanfile.py' using '\n' line-ends

Here are some docs about it: https://docs.conan.io/en/latest/faq/using.html?highlight=crlf#packages-got-outdated-when-uploading-an-unchanged-recipe-from-a-different-machine

Otherwise, if they are different, maybe you are mixing or overriding on purpose different recipes in the CI? Several consecutive pushes? Should it be happening? These are some questions to clarify before take the decission of forcing an upload. Please, shed some light about you use case and we could enable a configuration to opt-in the package overwritting.

@michaelmaguire you mentioned a promotion process, could you explain a bit more?

No thanks, I just ran into these line ending issues

In this example I use the --json argument to conan create to get the created reference with an auxiliary function. I will add this to the Conan => integrations => jenkins:

def created_ref(a_json){
    def ref
    a_json["installed"].each { item ->
        def exported = item['recipe']['exported']
        if(exported){
            ref = item["recipe"]["id"]
            return ref
        }
    }
    ref
}

node("Linux") {
    sh "docker pull conanio/gcc7"
    docker.image("conanio/gcc7").inside {
        def server = Artifactory.server "ArtifactoryConan"
        def client = Artifactory.newConanClient()
    
        stage("Get project"){
            git branch: "release/1.2.11", url: "https://github.com/conan-community/conan-zlib.git"
        }
    
        stage("Create"){
            client.run(command: "--version")
            client.run(command: 'create . PORT/stable --json create.json')
            def my_json = readJSON file: "create.json"
            def ref = created_ref(my_json)
            echo "REF INSTALLED => ${ref}"
            //client.run(command: 'upload ${ref} --all -r ${remoteNameConanNxStable} --confirm')
    
        }
    }
}