Hello!
First of all, thank you for your amazing work on conan, it really enables CI with c++ at my company.
Currently I am building a jenkins pipeline with conan and sometimes the conan client fails with an error code. When it failes on a console it's no problem, because I have an error output.
e.g.
# conan info . --profile "deb64" --build-order="util/0.0.0@kamocuvao/testing"
serial/0.0.0@kamocuvao/testing: Not found in local cache, looking in remotes...
serial/0.0.0@kamocuvao/testing: Trying with 'artifactory'...
ERROR: Failed requirement 'serial/0.0.0@kamocuvao/testing' from 'PROJECT'
ERROR: Unable to find 'serial/0.0.0@kamocuvao/testing' in remotes
But when I run this same command with the Artifactory conan client in the Jenkins pipeline, I just get an exception.
e.g.
client.run(command: "info . --json bo.json --profile deb64 --build-order=util/0.0.0@kamocuvao/testing")
[Pipeline] runConanCommand
hudson.model.Run$RunnerAbortedException
at org.jfrog.hudson.pipeline.Utils.exeConan(Utils.java:274)
at org.jfrog.hudson.pipeline.steps.conan.RunCommandStep$Execution.execConanCommand(RunCommandStep.java:114)
at org.jfrog.hudson.pipeline.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:88)
at org.jfrog.hudson.pipeline.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:60)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
When an error occurs, I would like to see the conan command itself and the error output it produced, so that I can quickly get to the bottom of the error.
The exception its thrown here.
Aside from changing the jenkins plugin itself, is there another way to print the output of the command that I missed?
Conan Version: 1.9.1
OS: Linux/Debian9
Jenkins: 2.150
Jenkins Artifactory Plugin 2.16.2
To help us debug your issue please explain:
I'm running into this too, and my guess is that because the artifactory plugin immediately throws an exception when it sees a non-zero return code, it is stopping everything before stderr is pushed to the master (Utils.java:264). Perhaps a call to listener.error("An unknown error occured") would help here.
A hacky workaround I've done to help with debugging is to force giving it some time to flush. But this isn't quite right..
try {
...
def b = conanClient.run(command: "install ..")
server.publishBuildInfo b
} catch (Exception e) {
sleep(10)
throw e
}
Maybe the conan trace could be useful: https://docs.conan.io/en/latest/reference/env_vars.html#conan-trace-file. Not exactly a clean output, but the logged file might be used to learn what failed.
Otherwise, yes, I think there is little we could do in conan itself, I am going to label this as "Artifactory".
First of all, thank you for your amazing work on conan, it really enables CI with c++ at my company.
Thanks to you for your kind words, and reporting this issue! :)
I didn't even mention how awesome Conan is! It's a game changer.
Jumping on a followup, because I think I see the issue. The main bug here is the artifactory plugin killing the job before the error logging makes it back to master. (Though, that said, I'm not sure if this is an artifactory problem, or jenkins core?). In my case, I have one package (I anonymized it to CCC) which is not avaiable on the server. In the basic case, where I just run conan install with the artifactory plugin it dies without any mention of the failing package at all.
def conanClient = Artifactory.newConanClient()
String remoteName = conanClient.remote.add server: server, repo: "FFF"
def b = conanClient.run(command: "install .. -s build_type=Release -scppstd=11 -scompiler.libcxx=libstdc++11 -scompiler.version=5 -r " + remoteName)
server.publishBuildInfo b
KKK/7.52.1@deepcore/third_party: Package installed 4b07d420fda0ebba9951ebca86b525e647a8ef6c
LLL/2.9.1@deepcore/third_party: Retrieving package c487c264606e52ca5cf34361e396c8e9ebdc73a7 from remote 'ab8d95de-ddf7-47e7-85fb-2977e84fff13'
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
.[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
hudson.model.Run$RunnerAbortedException
at org.jfrog.hudson.pipeline.common.Utils.exeConan(Utils.java:264)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.execConanCommand(RunCommandStep.java:114)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:88)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:60)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
When you hackily add a sleep in a catch, it forces it some time to get the logging to the server. In this case, the server mentioned what and why it failed.
try {
def conanClient = Artifactory.newConanClient()
String remoteName = conanClient.remote.add server: server, repo: "FFF"
def b = conanClient.run(command: "install .. -s build_type=Release -scppstd=11 -scompiler.libcxx=libstdc++11 -scompiler.version=5 -r " + remoteName)
server.publishBuildInfo b
} catch (Exception e) {
sleep(10)
throw e
}
AAA/1.4.2@DDD/third_party: Package installed 683d5a375e1a57470895b2a39db2c12b3a608a91
BBB/3.4.3@DDD/third_party: Retrieving package 361b881dcc47c729830d6304e4a9d74dfc42cef6 from remote 'b1b3fce1-9364-4477-b9f5-654db0a0f4fc'
Downloading conanmanifest.txt
Downloading conaninfo.txt
Downloading conan_package.tgz
....
BBB/3.4.3@DDD/third_party: Package installed 361b881dcc47c729830d6304e4a9d74dfc42cef6
CCC/1.12.0@DDD/third_party: WARN: Can't find a 'CCC/1.12.0@DDD/third_party' package for the specified settings, options and dependencies:
- Settings: arch=x86_64, build_type=Release, compiler=gcc, compiler.libcxx=libstdc++11, compiler.version=5, os=Linux
- Options: GGG:shared=False, III:shared=False, HHH:shared=False
- Dependencies: GGG/8.0.61@DDD/third_party, HHH/7.1.3@DDD/third_party, III/2.2.13@DDD/third_party
- Package ID: 833e370abc69ea9e95988dc279d6e8165f72f3e5
ERROR: Missing prebuilt package for 'CCC/1.12.0@DDD/third_party'
Try to build it from sources with "--build CCC"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"
To the question of the trace log, the Artifactory plugin automatically creates and places one at build@tmp/artifactory/conan.tmp6596375303614302085/conan_log.log in the workspace (where the tmp name changes from run to run). I don't see an mention of what failed in it (below are the last dozen calls):
{"_action": "REST_API_CALL", "duration": 0.015619754791259766, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.06135, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/AAA/1.4.2/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conaninfo.txt"}
{"_action": "DOWNLOAD", "duration": 0.016032934188842773, "time": 1546531683.061748, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/AAA/1.4.2/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conaninfo.txt"}
{"_action": "REST_API_CALL", "duration": 0.017440319061279297, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.079419, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/AAA/1.4.2/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conan_package.tgz"}
{"_action": "DOWNLOAD", "duration": 0.025837182998657227, "time": 1546531683.0878024, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/AAA/1.4.2/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conan_package.tgz"}
{"_action": "DOWNLOADED_PACKAGE", "_id": "AAA/1.4.2@DDD/third_party:683d5a375e1a57470895b2a39db2c12b3a608a91", "duration": 0.07842564582824707, "files": [{"md5": "266898691f13359c4200801c872c0c44", "name": "conaninfo.txt", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/AAA/1.4.2/DDD/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conaninfo.txt", "sha1": "85f8a83a09404dc306fb86d4528a982e52a9ec73"}, {"md5": "ef52bfb620e378367106eba7e1042d13", "name": "conan_package.tgz", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/AAA/1.4.2/DDD/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conan_package.tgz", "sha1": "8b30b2e8da48d938699cf7d1af300cd0feb81e15"}, {"md5": "e2cf2452a163c9866cbe0e401c036e7f", "name": "conanmanifest.txt", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/AAA/1.4.2/DDD/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conanmanifest.txt", "sha1": "35a55de64409bf78f0bcb620bc4c13d7f1b6bf0d"}], "remote": "b1b3fce1-9364-4477-b9f5-654db0a0f4fc", "time": 1546531683.092886}
{"_action": "UNZIP", "dst": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/AAA/1.4.2/DDD/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91", "duration": 0.05467391014099121, "src": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/AAA/1.4.2/DDD/third_party/package/683d5a375e1a57470895b2a39db2c12b3a608a91/conan_package.tgz", "time": 1546531683.1477852}
{"_action": "REST_API_CALL", "duration": 0.01609492301940918, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Client-Id": "rdesmond", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.1670532, "url": "http://EEE/artifactory/api/conan/FFF/v1/conans/BBB/3.4.3/DDD/third_party/packages/361b881dcc47c729830d6304e4a9d74dfc42cef6/download_urls"}
{"_action": "REST_API_CALL", "duration": 0.017088890075683594, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.184694, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conanmanifest.txt"}
{"_action": "DOWNLOAD", "duration": 0.017633914947509766, "time": 1546531683.1852243, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conanmanifest.txt"}
{"_action": "REST_API_CALL", "duration": 0.015365123748779297, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.2008471, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conaninfo.txt"}
{"_action": "DOWNLOAD", "duration": 0.015800952911376953, "time": 1546531683.201269, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conaninfo.txt"}
{"_action": "REST_API_CALL", "duration": 0.016898632049560547, "headers": {"Authorization": "**********", "User-Agent": "Conan/1.11.1 (Python 3.5.2) python-requests/2.9.1", "X-Client-Anonymous-Id": "**********", "X-Conan-Client-Version": "1.11.1"}, "method": "GET", "time": 1546531683.2184052, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conan_package.tgz"}
{"_action": "DOWNLOAD", "duration": 0.09638381004333496, "time": 1546531683.297878, "url": "http://EEE/artifactory/api/conan/FFF/v1/files/DDD/BBB/3.4.3/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conan_package.tgz"}
{"_action": "DOWNLOADED_PACKAGE", "_id": "BBB/3.4.3@DDD/third_party:361b881dcc47c729830d6304e4a9d74dfc42cef6", "duration": 0.14774465560913086, "files": [{"md5": "b5269dbf7a0dc35e6befbf000853fe82", "name": "conaninfo.txt", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/BBB/3.4.3/DDD/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conaninfo.txt", "sha1": "bc8cfde0d9e8e28162e4359b1c5ef174952465f6"}, {"md5": "822d415a4df912233b3eed80f8a9a792", "name": "conan_package.tgz", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/BBB/3.4.3/DDD/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conan_package.tgz", "sha1": "fbebd2cd1f7aa3f23136ea290c828a31517e34f3"}, {"md5": "a66606e458ae0ec03cf05d7617be9e03", "name": "conanmanifest.txt", "path": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/BBB/3.4.3/DDD/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conanmanifest.txt", "sha1": "45fa0f34a9abd494cae1986ba3419d41debe9272"}], "remote": "b1b3fce1-9364-4477-b9f5-654db0a0f4fc", "time": 1546531683.3371716}
{"_action": "UNZIP", "dst": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/BBB/3.4.3/DDD/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6", "duration": 0.3475663661956787, "src": "/home/ubuntu/workspace/JJJ/build@tmp/artifactory/conan.tmp1947537770445790364/.conan/data/BBB/3.4.3/DDD/third_party/package/361b881dcc47c729830d6304e4a9d74dfc42cef6/conan_package.tgz", "time": 1546531683.6850002}
I think that fixing this could be as easy as calling flush somewhere in the plugin (this is what I understand from similar errors/fixes here and there). I'll try to reproduce this behavior and I'll dive into the plugin sources to check if a simple flush fixes the problem.
Thanks for all your patience, and thanks for your kind words 鉂わ笍
Hello again
I'm trying it with Artifactory-Jenkins-plugin v3.3.x and Jenkins 2.176.2 and I'm able to see all the expected output from a failing Conan build:
....
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
....
bzip2/1.0.6@conan/stable: Downloaded recipe revision 0
core-communications/0.0@sword/sorcery: Not found in local cache, looking in remotes...
core-communications/0.0@sword/sorcery: Trying with 'conan-center'...
core-communications/0.0@sword/sorcery: Trying with '05aa0d6a-5c20-41a4-b9f8-d487f6186490'...
ERROR: Failed requirement 'core-communications/0.0@sword/sorcery' from 'ui-board_game/0.0@sword/sorcery'
ERROR: Unable to find 'core-communications/0.0@sword/sorcery' in remotes
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 93de89957ace7625b233cf34ca1620763ab19c4a86aac9509eef41a221ae819f
$ docker rm -f 93de89957ace7625b233cf34ca1620763ab19c4a86aac9509eef41a221ae819f
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
hudson.model.Run$RunnerAbortedException
at org.jfrog.hudson.pipeline.common.Utils.exeConan(Utils.java:271)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.execConanCommand(RunCommandStep.java:114)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:88)
at org.jfrog.hudson.pipeline.scripted.steps.conan.RunCommandStep$Execution.run(RunCommandStep.java:60)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
at hudson.security.ACL.impersonate(ACL.java:290)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
Can you (@kamocuvao @rddesmond ) please check that this is still a problem with a newer version of the plugin? Thanks!
Yeah, it looks good to me now. Thank you!
Thanks for updating the status! 馃槉
Most helpful comment
Hello again
I'm trying it with Artifactory-Jenkins-plugin v3.3.x and Jenkins 2.176.2 and I'm able to see all the expected output from a failing Conan build:
Can you (@kamocuvao @rddesmond ) please check that this is still a problem with a newer version of the plugin? Thanks!