From 4aa47c586643aeb647d66a4dbfd463c01aef0ead Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Fri, 21 Apr 2017 11:48:00 -0300 Subject: [PATCH] logging the reasons why a pipe is being skipped --- pipeline/brew/brew.go | 7 ++++++- pipeline/env/env.go | 6 ++++-- pipeline/git/git.go | 2 ++ pipeline/release/release.go | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pipeline/brew/brew.go b/pipeline/brew/brew.go index 02a2c298e..eb2057933 100644 --- a/pipeline/brew/brew.go +++ b/pipeline/brew/brew.go @@ -103,7 +103,12 @@ func doRun(ctx *context.Context, client client.Client) error { Name: ss[1], } } - if ctx.Config.Brew.GitHub.Name == "" || !ctx.Publish { + if !ctx.Publish { + log.Println("Skipped because --skip-publish is set") + return nil + } + if ctx.Config.Brew.GitHub.Name == "" { + log.Println("Skipped because brew section is not configured") return nil } path := filepath.Join(ctx.Config.Brew.Folder, ctx.Config.Build.Binary+".rb") diff --git a/pipeline/env/env.go b/pipeline/env/env.go index e2d0e350f..67f6e5c71 100644 --- a/pipeline/env/env.go +++ b/pipeline/env/env.go @@ -4,13 +4,14 @@ package env import ( "errors" + "log" "os" "github.com/goreleaser/goreleaser/context" ) // ErrMissingToken indicates an error when GITHUB_TOKEN is missing in the environment -var ErrMissingToken = errors.New("Missing GITHUB_TOKEN") +var ErrMissingToken = errors.New("missing GITHUB_TOKEN") // Pipe for env type Pipe struct{} @@ -22,10 +23,11 @@ func (Pipe) Description() string { // Run the pipe func (Pipe) Run(ctx *context.Context) (err error) { + ctx.Token = os.Getenv("GITHUB_TOKEN") if !ctx.Validate { + log.Println("Skipped validations because --skip-validate is set") return nil } - ctx.Token = os.Getenv("GITHUB_TOKEN") if ctx.Token == "" { return ErrMissingToken } diff --git a/pipeline/git/git.go b/pipeline/git/git.go index a3e4cf467..3c6bf9097 100644 --- a/pipeline/git/git.go +++ b/pipeline/git/git.go @@ -4,6 +4,7 @@ package git import ( "fmt" + "log" "regexp" "strings" @@ -65,6 +66,7 @@ func (Pipe) Run(ctx *context.Context) (err error) { // removes usual `v` prefix ctx.Version = strings.TrimPrefix(tag, "v") if !ctx.Validate { + log.Println("Skipped validation because --skip-validate is set") return nil } return validate(commit, tag, ctx.Version) diff --git a/pipeline/release/release.go b/pipeline/release/release.go index f9b670c1b..0799c3186 100644 --- a/pipeline/release/release.go +++ b/pipeline/release/release.go @@ -27,6 +27,7 @@ func (Pipe) Run(ctx *context.Context) error { func doRun(ctx *context.Context, client client.Client) error { if !ctx.Publish { + log.Println("Skipped because --skip-publish is set") return nil } log.Println("Creating or updating release", ctx.Git.CurrentTag, "on", ctx.Config.Release.GitHub.String())