conan-extensions icon indicating copy to clipboard operation
conan-extensions copied to clipboard

"conan art:build-info upload" is using wrong file path and fails

Open AndreyGranovsky opened this issue 1 year ago • 3 comments

When using the "conan art:build-info upload", according to the documentation, we should provide the repository where the packages were uploaded in Artifactory (which is not the same one as the Conan remote name, which is a virtual repository).

Once we run the "conan art:build-info upload" command, it fails due to the package not being found as it is not stored in the virtual repository location (please note that adding properties is supported only for local and local-cache repositories). This occurs because, during the build upload process, it attempts to use the path of the virtual repository rather than the local repository where the packages were initially uploaded. For example: image

AndreyGranovsky avatar Mar 14 '24 15:03 AndreyGranovsky

hi @AndreyGranovsky, thanks for the report.

Indeed, virtual and remote repositories in Artifactory work a bit different and they are not so tested from our side.

Have you tried the local Artifactory repository to create the build info instead of the virtual one? That might solve the issue.

Thanks

danimtb avatar Mar 15 '24 08:03 danimtb

Hi @danimtb, The Conan remote that is configured is a Virtual repository on Artifactory that contains a local+remote repositories.

During the "conan art:build-info create" a local repository was passed under the parameter, as the artifacts were uploaded to this repository. However, when running "conan art:build-info create" the command searches under the path of the Virtual repository not the local, and fails.

AndreyGranovsky avatar Mar 17 '24 09:03 AndreyGranovsky

Hi @AndreyGranovsky,

Thanks for reporting. I have been checking this and apparently it works fine for me as long as I pass the local repository to the art:build-info commands. I'm providing here the instructions for a minimal working example with the BuildInfo, can you check if there are any steps that you are doing in a different way?

This is what I did:

  • I have a virtual repo with a remote + local
  • The local repo name in conan is develop, the repo name in Arfifactory is conan-local. So I did:
conan remote add develop http://localhost:8081/artifactory/api/conan/conan-local

# create a package with a dependency for the build info
mkdir liba
cd liba
conan new cmake_lib -d name=liba -d version=1.0
cd ..
mkdir mypkg 
cd mypkg
conan new cmake_lib -d name=mypkg -d version=1.0 -d requires=liba/1.0
cd ..

# start with a clean repo
conan remove "*" -r=develop -c
conan remove "liba*" -c
conan remove "mypkg*" -c

conan create liba -s build_type=Release --build="liba*"
conan upload "liba*" -r=develop -c

# this is just to ensure that it will check for the liba info in the repo
conan remove "liba*" -c

conan create mypkg --format=json -s build_type=Release --build="mypkg*" -r=develop > create_release.json
conan upload "mypkg*" -r=develop -c

# IMPORTANT! It's very important to pass there conan-local, that is the name of the repo in artifactory 
# and will provide the path to set the property, not develop (that is the name of the conan remote)

conan art:build-info create create_release.json release_build 1 conan-local --url=http://localhost:8081/artifactory --user=admin --password=password --with-dependencies > release_build.json

conan art:build-info upload release_build.json --url=http://localhost:8081/artifactory --user=admin --password=password

# the BuildInfo is uploaded fine

Could you please check?

czoido avatar Mar 19 '24 10:03 czoido