conan-extensions
conan-extensions copied to clipboard
Build info upload failing in case the recipe upload was skipped, but a new package has been uploaded
I tried the art:build-info in our project to upload the build info to Artifactory for the new Conan2 builds, like:
conan create . --format json --channel $channel --user $user --version $version --profile:build $profile --profile:host $profile > create.json
conan upload xtea/$version@$user/$channel --remote $remote --confirm
conan config install https://git-url.com/conan-extensions.git --source-folder=extensions/commands/art --target-folder=extensions/commands/art
conan art:build-info create create.json ${JOB_NAME:-local} ${BUILD_NUMBER:-666} $remote --url https://articatory-url.com/artifactory > build_info.json
sed -ie "2i \ \ \ \ \"url\": \"${BUILD_URL:-https://foo}\"," $(pwd)/build_info.json
conan art:build-info upload build_info.json --url https://articatory-url.com/artifactory --user $CONAN_LOGIN_USERNAME --password $CONAN_PASSWORD
If I do not use --force in conan upload, for subsequent calls it will not re-upload the recipe, but upload a new package revision. The build info upload will fail with the following error message:
Upload summary:
conan-repo
package/1.2.3@user/channel
revisions
a258c816cd0fe01b0e3f1b7b23150160 (Skipped, already in server)
packages
a7977d43447e716bc7861543ecdf642b7cc66708
revisions
df1ca62616cc0c83ac397c4e21dbbf86 (Uploaded)
....
ERROR: There are no artifacts for the package/1.2.3@user/channel#a258c816cd0fe01b0e3f1b7b23150160 recipe. Probably the package was not uploaded before creating the Build Info.Please upload the package to the server and try again.
I checked the source code. Looks like the following line returns no results in this case: https://github.com/conan-io/conan-extensions/blob/51933583b210ed8d2137276d081252a2b801f3b4/extensions/commands/art/cmd_build_info.py#L144C13-L144C23
the d directory is empty, resp. only contains an empty subfolder called metadata.
could be that this is a side-effect of a previous issue with inconsisten packages hashes we saw. Will check. After conan remove -c '*' it seems to work.
unfortunately it will not always work like this. Still trying to figure out why sometimes it is working, sometimes (most of the times) not.
Was able to fix it by specifying --user and --passoword arguments to conan art:build-info create. It would be great to add this to the error message, that you might need to specify user and password in case the artifact info was not found...
Hi @schwaerz, thanks for reporting the issue.
You mention that you need to add --user and --password arguments to conan art:build-info create. However, this is what you were doing already, right? Could you please add the steps to reproduce your issue? I would like to understand it well to try to work on a fix.
Thanks! 😄
Hi, initially, I was only added --user and --password to the upload step. That way the build info create failed under certain (not exactly sure which) conditions. I suppose as soon as some information has to be fetched from Artifactory by create it would fail. Probably if the recipe was already uploaded by a different job?
In any case, what needs to be done to reproduce the issue: Re-build of the Conan package itself, with the recipe upload being skipped as the recipe itself is already existing on Artifactory. Only the package got uploaded. But still, sometimes the build info create worked. Unfortunately I cannot exactly tell what to do to make it always fail.
In Jenkins, it failed in 99,9% of all cases. Locally it started working when I did a force upload of the conan recipe to Artifactory. Still little bit strange. Not sure whether I can supply more information, please let me know in case you need more info.
In any case, with --user and --password it is now always working.
Hi @schwaerz, Thanks a lot for reporting. I think the error was a bit misleading but in fact the real issue was that you needed to pass those arguments to create the BuildInfo, I will open an issue to check if the raised errors are consistent with the potential problems.