From d936f5078b9bb76afcc2a3a5e957a0808ff12fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tanguy=20=E2=A7=93=20Herrmann?= Date: Fri, 7 Jul 2017 20:05:08 +0200 Subject: [PATCH 1/2] Support aliases for default pipeline network: pipeline_default --- pipeline/frontend/yaml/compiler/convert.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go index f815057..5244d96 100644 --- a/pipeline/frontend/yaml/compiler/convert.go +++ b/pipeline/frontend/yaml/compiler/convert.go @@ -24,10 +24,18 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section // network = container.Network ) + aliases := []string{container.Name} + for _, n := range container.Networks.Networks { + // currently limited to the default network + if fmt.Sprintf("%s_default", c.prefix) == n.Name { + aliases = append(aliases, n.Aliases...) + } + } + networks := []backend.Conn{ backend.Conn{ Name: fmt.Sprintf("%s_default", c.prefix), - Aliases: []string{container.Name}, + Aliases: aliases, }, } for _, network := range c.networks { From 669c12b1efb836babfda49920269c23d6b99c635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tanguy=20=E2=A7=93=20Herrmann?= Date: Tue, 19 Sep 2017 02:09:09 +0200 Subject: [PATCH 2/2] Use the default network instead of pipeline default the default network for pipeline is named by a random ID when launched by drone. We need a stable name that is going through all drone execution. --- pipeline/frontend/yaml/compiler/convert.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipeline/frontend/yaml/compiler/convert.go b/pipeline/frontend/yaml/compiler/convert.go index 5244d96..241e2c1 100644 --- a/pipeline/frontend/yaml/compiler/convert.go +++ b/pipeline/frontend/yaml/compiler/convert.go @@ -26,8 +26,8 @@ func (c *Compiler) createProcess(name string, container *yaml.Container, section aliases := []string{container.Name} for _, n := range container.Networks.Networks { - // currently limited to the default network - if fmt.Sprintf("%s_default", c.prefix) == n.Name { + // applies aliases only to the network named "default" + if n.Name == "default" { aliases = append(aliases, n.Aliases...) } }