Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unmarshal Panic on PipelineType mismatch with stages #962

Open
ecrupper opened this issue Mar 28, 2024 · 0 comments
Open

Unmarshal Panic on PipelineType mismatch with stages #962

ecrupper opened this issue Mar 28, 2024 · 0 comments
Labels
bug Indicates a bug

Comments

@ecrupper
Copy link
Contributor

Description

If a repository has a pipeline type set to yaml and attempt to use Go syntax in their pipeline, the compiler will panic during parsing.

This only happens with stages according to my limited testing.

Steps (OK)

version: "1"

steps:
  - name: example
    image: {{ default "alpine:latest" .image }}
    commands:
      - echo "Hello World"

This pipeline will give an appropriate error:

unable to unmarshal yaml: yaml: unmarshal errors:
  line 5: cannot unmarshal !!map into string 

Stages (Not OK)

version: "1"

stages:
  test:
    steps:
      - name: example
        image: {{ default "alpine:latest" .image }}
        commands:
          - echo "Hello World"

Panic:

panic: runtime error: hash of unhashable type yaml.MapSlice [recovered]
	panic: runtime error: hash of unhashable type yaml.MapSlice [recovered]
	panic: runtime error: hash of unhashable type yaml.MapSlice [recovered]
	panic: runtime error: hash of unhashable type yaml.MapSlice

goroutine 1 [running]:
github.com/buildkite/yaml.handleErr(0xc0005ed028)
	/home/runner/go/pkg/mod/github.com/buildkite/yaml@v0.0.0-20230306222819-0e4e032d4835/yaml.go:249 +0x6d
panic({0x297a400?, 0xc0001fcde0?})
	/opt/hostedtoolcache/go/1.21.8/x64/src/runtime/panic.go:914 +0x21f
github.com/buildkite/yaml.handleErr(0xc0005ecd80)
	/home/runner/go/pkg/mod/github.com/buildkite/yaml@v0.0.0-20230306222819-0e4e032d4835/yaml.go:249 +0x6d
panic({0x297a400?, 0xc0001fcde0?})
	/opt/hostedtoolcache/go/1.21.8/x64/src/runtime/panic.go:914 +0x21f
github.com/buildkite/yaml.handleErr(0xc0005ec6f0)
	/home/runner/go/pkg/mod/github.com/buildkite/yaml@v0.0.0-20230306222819-0e4e032d4835/yaml.go:249 +0x6d
panic({0x297a400?, 0xc0001fcde0?})
	/opt/hostedtoolcache/go/1.21.8/x64/src/runtime/panic.go:914 +0x21f
github.com/buildkite/yaml.(*decoder).mappingSlice(0xc0000bd620, 0xc0004a6ee0, {0x28a67a0?, 0xc0005f7ef0?, 0xc0005eb6e8?})
	/home/runner/go/pkg/mod/github.com/buildkite/yaml@v0.0.0-20230306222819-0e4e032d4835/decode.go:725 +0x54f

.......

This appears to be a potential issue with the buildkite yaml library rather than our code, but given that that library is completely deprecated, we might have to get creative with how we address this.

Value

Avoids server panics

Useful Information

In description

  1. What is the output of vela --version?

v0.23.4

@ecrupper ecrupper added the bug Indicates a bug label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a bug
Projects
None yet
Development

No branches or pull requests

1 participant