jenkins-zh/jenkins-cli

Error: Get /job/.../api/json: unsupported protocol scheme ""

gocruncher opened this issue · 8 comments

Describe the bug

jcli job build "manual-deploy config-deploy-manual"  --logger-level debug
Error: Get /job/manual-deploy/job/config-deploy-manual/api/json: unsupported protocol scheme ""

I suppose it might be a proxy issue.
I found this from the documentation:
...
Jenkins might be stay in behind a firewall. So we cannot connect it directly. You can give jcli a proxy setting....
...

But anyway is there any way to run a job without proxy settings?

To Reproduce
Steps to reproduce the behavior:

  1. Set config file without proxy settings
    ➜ ~ cat .jenkins-cli.yaml
    jenkins_servers:
  1. jcli job build "manual-deploy config-deploy-manual"
  2. See error
    Error: Get /job/manual-deploy/job/config-deploy-manual/api/json: unsupported protocol scheme ""

Logs

jcli job build "manual-deploy config-deploy-manual" --logger-level debug
{"level":"debug","message":"read config file","path":""}
? Are you sure to build job manual-deploy config-deploy-manual Yes
{"level":"debug","message":"send HTTP request","URL":"/job/manual-deploy/job/config-deploy-manual/api/json","method":"GET"}
Error: Get /job/manual-deploy/job/config-deploy-manual/api/json: unsupported protocol scheme ""

Thank you!

What is the version of jcli? You can get the version via jcli version.

I've just installed it

➜  ~ jcli version
'Jenkins CLI (jcli) manage your Jenkins
Version: 0.0.28
Last Commit: dc2749c
Build Date: 2020-04-27T01:22:46Z

Please try to use the latest one which is v0.0.31

I've cloned this code and build by myself

➜ jenkins-cli git:(master) ✗ git rev-parse HEAD 7b2ed8b2fa918313913b1f2df3797410d01edafd

`
➜ jenkins-cli git:(master) ✗ ./jenkins-cli job build "manual-deploy config-deploy-manual" --logger-level debug

{"level":"debug","message":"read config file","path":""}
? Are you sure to build job manual-deploy config-deploy-manual Yes
{"level":"debug","message":"send HTTP request","URL":"/job/manual-deploy/job/config-deploy-manual/api/json","method":"GET"}
{"level":"debug","message":"HTTP request as curl","cmd":"curl -X 'GET' -H 'User-Agent: jcli; ; ' '/job/manual-deploy/job/config-deploy-manual/api/json'"}
Error: Get "/job/manual-deploy/job/config-deploy-manual/api/json": unsupported protocol scheme ""'

`
probably, it something wrong with my laptop or there are specific things. I will try to investigate it

I think the problem could be the config file. Because as we can see in the log, the URL is incorrect. You can remove your current config file. Then generate it again via jcli confi gen.

How are you?
You know what? You're right. I've just tried to start using it but I did not find any information about how to put my credentials and so on. I looked at this https://jcli.jenkins-zh.cn/english/credential but unfortunately , there is a very very small piece of instruction. I found this and just put it in my config file. Yeap, I have no clue that it also should have "current" option.

I would like to see what exactly was wrong. So I created PR regarding this #474

Sorry about that. There're so many details that need to be documented. Your PR #474 should fix it.

Thanks for that. Give this issue already be fixed. I'm going to close this.