Giter Site home page Giter Site logo

Comments (9)

aelsabbahy avatar aelsabbahy commented on June 12, 2024 1

Fixed in pr, will be in the next release.

from goss.

xescab avatar xescab commented on June 12, 2024

Issue was due to a comment in vars.yaml

from goss.

aelsabbahy avatar aelsabbahy commented on June 12, 2024

If you don't mind, can you provide the exact vars.yaml and goss.yaml to reproduce this?

Goss should not panic, this is definitely a bug.

from goss.

xescab avatar xescab commented on June 12, 2024

Yes, sure! :)

Our vars.yaml starts with:

domain_name: #DOMAIN#
k8s_version: 1.25

and then on a pipeline we replace #DOMAIN# by a proper string, but when I was testing locally I forgot to change the value and that is why I got the segfault. Maybe it could be detected and show a proper error message when the variables are not well declared.

Thanks for looking into this, @aelsabbahy !

from goss.

aelsabbahy avatar aelsabbahy commented on June 12, 2024

Just following up on this, I think I'm doing something wrong while trying to reproduce, can you also provide the matching goss.yaml that causes it to panic.

$ cat vars.yaml 
domain_name: #DOMAIN#
k8s_version: 1.25

$ cat goss.yaml
command:
  echo "hi":
    exit-status: 0
    stdout:
    - {{.Vars.domain_name}}
    stderr: []
    timeout: 10000

$ goss.3.18 --vars vars.yaml render
command:
  echo "hi":
    exit-status: 0
    stdout:
    - <no value>
    stderr: []
    timeout: 10000

$ goss.3.18 --vars vars.yaml v
.F

Failures/Skipped:

Command: echo "hi": stdout: patterns not found: [<no value>]

Total Duration: 0.002s
Count: 2, Failed: 1, Skipped: 0

from goss.

xescab avatar xescab commented on June 12, 2024

Sorry, I am also unable to reproduce with the previous goss.yaml that caused the segfault. I think we can close it.

from goss.

aelsabbahy avatar aelsabbahy commented on June 12, 2024

It's okay, I have some theories on how it may have happened, but can't reproduce it.

I'll roll out those "fixes" in a future PR. We can leave the ticket open for that, I won't know for sure I fixed the problem, but should help.

Thank you for following back up.

from goss.

xescab avatar xescab commented on June 12, 2024

Got it again! It's related with the http module:

$ ./goss --version
goss version v0.4.1
		
$ cat goss.yaml
http:
  # Ensure argocd is available and redirected to HTTPS
  http://argocd.mgmt.{{ .Vars.domain_name }}/:
    status: 302
    no-follow-redirects: true
    headers:
    - "Location: https://argocd"
	
$ cat vars.yaml
domain_name: #DOMAIN#
k8s_version: 1.25

$ ./goss -g goss.yaml --vars vars.yaml render
http:
  http://argocd.mgmt.<no value>/:
    status: 302
    allow-insecure: false
    no-follow-redirects: true
    headers:
    - 'Location: https://argocd'
	
$ ./goss -g goss.yaml --vars vars.yaml  validate
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7ac440]

goroutine 69 [running]:
github.com/goss-org/goss/system.(*DefHTTP).Status(0xc00012b380)
        /home/travis/gopath/src/github.com/goss-org/goss/system/http.go:186 +0x40
github.com/goss-org/goss/resource.ValidateGomegaValue({_, _}, {_, _}, {_, _}, {_, _}, _)
        /home/travis/gopath/src/github.com/goss-org/goss/resource/validate.go:160 +0x3f6
github.com/goss-org/goss/resource.ValidateValue({_, _}, {_, _}, {_, _}, {_, _}, _)
        /home/travis/gopath/src/github.com/goss-org/goss/resource/validate.go:130 +0x195
github.com/goss-org/goss/resource.(*HTTP).Validate(0xc000460a20, 0xc000330370?)
        /home/travis/gopath/src/github.com/goss-org/goss/resource/http.go:81 +0x305
github.com/goss-org/goss.validate.func2()
        /home/travis/gopath/src/github.com/goss-org/goss/validate.go:184 +0x91
created by github.com/goss-org/goss.validate
        /home/travis/gopath/src/github.com/goss-org/goss/validate.go:181 +0x190

Hope that with this new info you can fix it :)

from goss.

aelsabbahy avatar aelsabbahy commented on June 12, 2024

Awesome, I was able to reproduce it! Will fix it in the next goss release.. surprised not too many people ran into this.

from goss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.