Add ansi color to release output when running on Jenkins (#26)

Co-authored-by: Bernd Ahlers <bernd@graylog.com>
This commit is contained in:
Donald Morton
2021-01-27 11:01:34 -06:00
committed by GitHub
parent 72b8cd19d8
commit a3fc628c71

View File

@@ -2,6 +2,7 @@ package apply
import (
"github.com/Graylog2/graylog-project-cli/project"
"os"
"strings"
)
@@ -13,6 +14,11 @@ type CommonMaven struct {
func (common CommonMaven) MavenRunWithProfiles(profiles []string, args ...string) {
commands := []string{"mvn --show-version --batch-mode --fail-fast"}
// Force maven color output when executed on Jenkins to prettify the logs
if os.Getenv("BUILD_ID") != "" {
commands = append(commands, "-Dstyle.color=always")
}
if len(profiles) > 0 {
commands = append(commands, "--activate-profiles")
commands = append(commands, strings.Join(profiles, ","))