grim/convey

Port from logrus to log/slog
default tip
4 months ago, Elliott Sales de Andrade
c588f9b3f559
Port from logrus to log/slog

This doesn't really take much advantage of structured logging beyond what is already done (`id` and `idColor`), and consequently the log handler does not try to do any handling of anything more than that (i.e., grouping, or arbitrary attributes beyond those defined).

One should maybe have a `Context` available to pass in, but there isn't one, and anyway, the log handler doesn't use it, so I've passed in a `TODO` instead.

Everything else is just normal import/rename changes.

Testing Done:
Ran `go run . run`

Reviewed at https://reviews.imfreedom.org/r/2871/
package podman
import (
"log/slog"
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
"keep.imfreedom.org/grim/convey/yaml"
)
type Push struct {
Tags yaml.StringOrSlice `yaml:"tags"`
}
func (p *Push) Execute(name string, logger *slog.Logger, stageEnv environment.Environment, rt *runtime.Runtime) error {
env := stageEnv.Copy().Merge(rt.Environment)
tags := env.Expandv(p.Tags)
for _, tag := range tags {
generator := exec.NewGenerator(
"podman",
"push",
tag,
)
err := exec.Run(name, generator.Command(), rt.Timeout)
if err != nil {
return err
}
}
return nil
}
func (p *Push) New() runtime.Task {
return &Push{}
}
func (p *Push) Valid() error {
if len(p.Tags) == 0 {
return ErrNoTags
}
return nil
}
func (p *Push) Deprecated() error {
return nil
}