jenkins-zh/jenkins-cli

Seg fault when trying to edit config

Closed this issue · 4 comments

Describe the bug
Seg fault when trying to edit config
To Reproduce
All i did was follow the readme and then i tried to jcli config edit and thats what happend:

[yair@yairf_lap ~ ]$ jcli config edit
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb3bfa4]

goroutine 1 [running]:
github.com/jenkins-zh/jenkins-cli/app/cmd.glob..func19(0x12a6400, 0x12ed760, 0x0, 0x0, 0x0, 0x0)
        /home/runner/work/jenkins-cli/jenkins-cli/app/cmd/config_edit.go:40 +0x104
github.com/spf13/cobra.(*Command).execute(0x12a6400, 0x12ed760, 0x0, 0x0, 0x12a6400, 0x12ed760)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x12a1a80, 0x0, 0x0, 0x0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
github.com/jenkins-zh/jenkins-cli/app/cmd.Execute()
        /home/runner/work/jenkins-cli/jenkins-cli/app/cmd/root.go:175 +0x2d
main.main()
        /home/runner/work/jenkins-cli/jenkins-cli/main.go:8 +0x25

Expected behavior
well..

Desktop (please complete the following information):

  • wsl1 - Ubuntu 18.04
  • zsh 5.4.2
  • jcli 0.0.34 9e24796
    Additional context
    Add any other context about the problem here.

Thanks for reaching out to us. In order to make this bug not be a blocker for you. There's a temporary solution here:

Please create the config file ~/.jenkins-cli.yaml with the following content:

current: yourServer
jenkins_servers:
- name: yourServer
  url: http://localhost:8080/jenkins
  username: admin
  token: 111e3a2f0231198855dceaff96f20540a9
  insecureSkipVerify: true
mirrors:
- name: default
  url: http://mirrors.jenkins.io/
- name: tsinghua
  url: https://mirrors.tuna.tsinghua.edu.cn/jenkins/
- name: huawei
  url: https://mirrors.huaweicloud.com/jenkins/
- name: tencent
  url: https://mirrors.cloud.tencent.com/jenkins/

I managed to fix it by changing the current, for somereason it was still on 'yourServer', maybe i mistakenly left it there

yJunS commented

@Fongeme I think maybe you can try by jcli config select [otherServerName] to fix it

yJunS commented

And I not found the err message in the same environment, maybe your description not clear