From bf716b87182cdc7fad00d27ba163e676e9926119 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 24 Jan 2019 14:47:34 -0800 Subject: [PATCH] bump drone-yaml dependency --- Gopkg.lock | 2 +- .../drone/drone-yaml/yaml/pretty/pipeline.go | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 400c59b6..0fededa3 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -113,7 +113,7 @@ "yaml/pretty", "yaml/signer" ] - revision = "98eb77b4c58a783b3f2efce8fed4e5d9d1f09469" + revision = "b6add0c2d9779b77dd1cfe68a634b05d11304f56" [[projects]] name = "github.com/drone/envsubst" diff --git a/vendor/github.com/drone/drone-yaml/yaml/pretty/pipeline.go b/vendor/github.com/drone/drone-yaml/yaml/pretty/pipeline.go index a982c1d1..874ba6b3 100644 --- a/vendor/github.com/drone/drone-yaml/yaml/pretty/pipeline.go +++ b/vendor/github.com/drone/drone-yaml/yaml/pretty/pipeline.go @@ -189,10 +189,16 @@ func printVolumes(w writer, v []*yaml.Volume) { s.WriteTagValue("name", v.Name) if v := v.EmptyDir; v != nil { s.WriteTag("temp") - s.IndentIncrease() - s.WriteTagValue("medium", v.Medium) - s.WriteTagValue("size_limit", v.SizeLimit) - s.IndentDecrease() + if isEmptyDirEmpty(v) { + w.WriteByte(' ') + w.WriteByte('{') + w.WriteByte('}') + } else { + s.IndentIncrease() + s.WriteTagValue("medium", v.Medium) + s.WriteTagValue("size_limit", v.SizeLimit) + s.IndentDecrease() + } } if v := v.HostPath; v != nil { @@ -263,3 +269,9 @@ func isConditionsEmpty(v yaml.Conditions) bool { func isConditionEmpty(v yaml.Condition) bool { return len(v.Exclude) == 0 && len(v.Include) == 0 } + +// helper function returns true if the emptydir +// object is empty. +func isEmptyDirEmpty(v *yaml.VolumeEmptyDir) bool { + return v.SizeLimit == 0 && len(v.Medium) == 0 +}