fix for issue #42

This commit is contained in:
Brad Rydzewski 2019-05-30 08:14:47 -07:00
parent c40f261f00
commit 8ea6eb1cc3
2 changed files with 12 additions and 0 deletions

View File

@ -5,10 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Added
### Fixed
## [1.1.0] - 2019-05-30
### Fixed ### Fixed
- Support for yaml merge keys, by [@bradrydzewski](https://github.com/bradrydzewski). - Support for yaml merge keys, by [@bradrydzewski](https://github.com/bradrydzewski).
- Improve how colon characters are escaped, by [@bradrydzewski](https://github.com/bradrydzewski). Issue [#45](https://github.com/drone/drone-yaml/issues/45). - Improve how colon characters are escaped, by [@bradrydzewski](https://github.com/bradrydzewski). Issue [#45](https://github.com/drone/drone-yaml/issues/45).
- Improve how pipe and caret characters are escaped, by [@bradrydzewski](https://github.com/bradrydzewski). Issue [#44](https://github.com/drone/drone-yaml/issues/44). - Improve how pipe and caret characters are escaped, by [@bradrydzewski](https://github.com/bradrydzewski). Issue [#44](https://github.com/drone/drone-yaml/issues/44).
- Error when empty document or missing kind attribute, by [@bradrydzewski](https://github.com/bradrydzewski). Issue [#42](https://github.com/drone/drone-yaml/issues/42).
## [1.0.9] - 2019-05-20 ## [1.0.9] - 2019-05-20
### Added ### Added

View File

@ -17,6 +17,7 @@ package yaml
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"errors"
"io" "io"
"os" "os"
"strings" "strings"
@ -24,6 +25,8 @@ import (
"github.com/buildkite/yaml" "github.com/buildkite/yaml"
) )
var errorMissingKind = errors.New("yaml: missing kind attribute")
// Parse parses the configuration from io.Reader r. // Parse parses the configuration from io.Reader r.
func Parse(r io.Reader) (*Manifest, error) { func Parse(r io.Reader) (*Manifest, error) {
resources, err := ParseRaw(r) resources, err := ParseRaw(r)
@ -39,6 +42,9 @@ func Parse(r io.Reader) (*Manifest, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if resource.GetKind() == "" {
return nil, errorMissingKind
}
manifest.Resources = append( manifest.Resources = append(
manifest.Resources, manifest.Resources,
resource, resource,