mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-11 14:39:28 +02:00
feat: allow to always log signing output (#2731)
* feat: allow to always log signing output Signed-off-by: Carlos A Becker <caarlos0@gmail.com> * fix: improve code a bit Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
parent
f0c0ba5720
commit
7c2a93cfaa
@ -22,7 +22,12 @@ const (
|
|||||||
|
|
||||||
// NewWriter creates a new log writer.
|
// NewWriter creates a new log writer.
|
||||||
func NewWriter(fields log.Fields, out Output) io.Writer {
|
func NewWriter(fields log.Fields, out Output) io.Writer {
|
||||||
if isDebug() {
|
return NewConditionalWriter(fields, out, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConditionalWriter creates a new log writer that only writes when the given condition is met or debug is enabled.
|
||||||
|
func NewConditionalWriter(fields log.Fields, out Output, condition bool) io.Writer {
|
||||||
|
if condition || isDebug() {
|
||||||
return logWriter{
|
return logWriter{
|
||||||
ctx: newLogger(fields),
|
ctx: newLogger(fields),
|
||||||
out: out,
|
out: out,
|
||||||
|
@ -185,8 +185,8 @@ func signone(ctx *context.Context, cfg config.Sign, art *artifact.Artifact) ([]*
|
|||||||
cmd := exec.CommandContext(ctx, cfg.Cmd, args...)
|
cmd := exec.CommandContext(ctx, cfg.Cmd, args...)
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
w := gio.Safe(&b)
|
w := gio.Safe(&b)
|
||||||
cmd.Stderr = io.MultiWriter(logext.NewWriter(fields, logext.Error), w)
|
cmd.Stderr = io.MultiWriter(logext.NewConditionalWriter(fields, logext.Error, cfg.Output), w)
|
||||||
cmd.Stdout = io.MultiWriter(logext.NewWriter(fields, logext.Info), w)
|
cmd.Stdout = io.MultiWriter(logext.NewConditionalWriter(fields, logext.Info, cfg.Output), w)
|
||||||
if stdin != nil {
|
if stdin != nil {
|
||||||
cmd.Stdin = stdin
|
cmd.Stdin = stdin
|
||||||
}
|
}
|
||||||
|
@ -631,6 +631,7 @@ type Sign struct {
|
|||||||
StdinFile string `yaml:"stdin_file,omitempty"`
|
StdinFile string `yaml:"stdin_file,omitempty"`
|
||||||
Env []string `yaml:"env,omitempty"`
|
Env []string `yaml:"env,omitempty"`
|
||||||
Certificate string `yaml:"certificate,omitempty"`
|
Certificate string `yaml:"certificate,omitempty"`
|
||||||
|
Output bool `yaml:"output,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapcraftAppMetadata for the binaries that will be in the snap package.
|
// SnapcraftAppMetadata for the binaries that will be in the snap package.
|
||||||
|
@ -61,6 +61,12 @@ docker_signs:
|
|||||||
env:
|
env:
|
||||||
- FOO=bar
|
- FOO=bar
|
||||||
- HONK=honkhonk
|
- HONK=honkhonk
|
||||||
|
|
||||||
|
# By default, the stdout and stderr of the signing cmd are discarded unless GoReleaser is running with `--debug` set.
|
||||||
|
# You can set this to true if you want them to be displayed regardless.
|
||||||
|
#
|
||||||
|
# Defaults to false
|
||||||
|
output: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Available variable names
|
### Available variable names
|
||||||
|
@ -97,6 +97,12 @@ signs:
|
|||||||
env:
|
env:
|
||||||
- FOO=bar
|
- FOO=bar
|
||||||
- HONK=honkhonk
|
- HONK=honkhonk
|
||||||
|
|
||||||
|
# By default, the stdout and stderr of the signing cmd are discarded unless GoReleaser is running with `--debug` set.
|
||||||
|
# You can set this to true if you want them to be displayed regardless.
|
||||||
|
#
|
||||||
|
# Defaults to false
|
||||||
|
output: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Available variable names
|
### Available variable names
|
||||||
|
Loading…
x
Reference in New Issue
Block a user