Merge pull request #569 from vdemeester/compose-multiple-version-mergo

Add support for multiple composefile when deploying
This commit is contained in:
Sebastiaan van Stijn
2018-02-06 00:41:43 -08:00
committed by GitHub
17 changed files with 1638 additions and 117 deletions

View File

@ -16,8 +16,8 @@ import (
func RunDeploy(dockerCli *KubeCli, opts options.Deploy) error {
cmdOut := dockerCli.Out()
// Check arguments
if opts.Composefile == "" {
return errors.Errorf("Please specify a Compose file (with --compose-file).")
if len(opts.Composefiles) == 0 {
return errors.Errorf("Please specify only one compose file (with --compose-file).")
}
// Initialize clients
stacks, err := dockerCli.stacks()
@ -37,7 +37,7 @@ func RunDeploy(dockerCli *KubeCli, opts options.Deploy) error {
}
// Parse the compose file
stack, cfg, err := LoadStack(opts.Namespace, opts.Composefile)
stack, cfg, err := LoadStack(opts.Namespace, opts.Composefiles)
if err != nil {
return err
}

View File

@ -18,10 +18,11 @@ import (
// LoadStack loads a stack from a Compose file, with a given name.
// FIXME(vdemeester) remove this and use cli/compose/loader for both swarm and kubernetes
func LoadStack(name, composeFile string) (*apiv1beta1.Stack, *composetypes.Config, error) {
if composeFile == "" {
return nil, nil, errors.New("compose-file must be set")
func LoadStack(name string, composeFiles []string) (*apiv1beta1.Stack, *composetypes.Config, error) {
if len(composeFiles) != 1 {
return nil, nil, errors.New("compose-file must be set (and only one)")
}
composeFile := composeFiles[0]
workingDir, err := os.Getwd()
if err != nil {