support for multi-external env providers

pull/1/head
Brad Rydzewski 5 years ago
parent 6ff9dd11e8
commit 73d2d7d9d2

@ -2,10 +2,15 @@ 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).
## Unreleased
### [1.5.1] - 2019-12-10
### Added
- support for multiple external environment providers
## [1.5.1] - 2019-12-10
### Fixed
- not trimming pipeline history causing memory leak
## [1.5.0] - 2019-12-09
### Added
- support for global environment variables
- support for external environment variables from an external service
- abstraction for pipeline execution

@ -12,6 +12,19 @@ import (
"github.com/drone/runner-go/logger"
)
// MultiExternal returns a new environment provider that
// is comprised of multiple external providers, and
// aggregates their results.
func MultiExternal(endpoints []string, token string, insecure bool) Provider {
var sources []Provider
for _, endpoint := range endpoints {
sources = append(sources, External(
endpoint, token, insecure,
))
}
return Combine(sources...)
}
// External returns a new external environment variable
// provider. This provider makes an external API call to
// list and return environment variables.

@ -80,6 +80,16 @@ func TestExternal_NotFound(t *testing.T) {
}
}
// This test verifies that multiple external providers
// are combined into a single provider that concatenates
// the results.
func TestMultiExternal(t *testing.T) {
provider := MultiExternal([]string{"https://foo", "https://bar"}, "correct-horse-batter-staple", true).(*combined)
if len(provider.sources) != 2 {
t.Errorf("Expect two provider sources")
}
}
type mockPlugin struct {
out map[string]string
err error

Loading…
Cancel
Save