From 062a31de0862e5859ebb73f674ffee8cd88a74e0 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sat, 9 May 2015 12:53:52 -0700 Subject: [PATCH] ability to run a build step conditionally based on matrix --- common/config.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/config.go b/common/config.go index 1d9cf07eb..94b5a8fe0 100644 --- a/common/config.go +++ b/common/config.go @@ -105,3 +105,17 @@ func (c *Condition) MatchOwner(owner string) bool { return c.Owner == owner } } + +// MatchMatrix is a helper function that returns false +// to limit steps to only certain matrix axis. +func (c *Condition) MatchMatrix(matrix map[string]string) bool { + if len(c.Matrix) == 0 { + return true + } + for k, v := range c.Matrix { + if matrix[k] != v { + return false + } + } + return true +}