From 58287294fe812cc824438a6c1abfb5520c3ed225 Mon Sep 17 00:00:00 2001 From: jeanjerome Date: Sat, 19 Aug 2023 10:52:54 +0200 Subject: [PATCH] ref(15): Start testing wild integration with Jenkins --- vars/logger.groovy | 6 +++--- vars/wildPipeline.groovy | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/vars/logger.groovy b/vars/logger.groovy index 42d9320..c4a9330 100644 --- a/vars/logger.groovy +++ b/vars/logger.groovy @@ -61,17 +61,17 @@ private void logger(level, message) { def LOG_LEVEL = 'DEBUG' // Global log colorization enabled flag - def colorization = false + def isColoredXterm = false try { ansiColor('xterm') { - colorization = true + isColoredXterm = true } } catch(Throwable ex) { } if (LOG_LEVELS.indexOf(level) <= LOG_LEVELS.indexOf(LOG_LEVEL)) { def color = COLORS[level] def resetColor = "\u001B[0m" - def logMessage = colorization ? "${color}${message}${resetColor}" : "${message}" + def logMessage = isColoredXterm ? "${color}${message}${resetColor}" : "${message}" println logMessage } } diff --git a/vars/wildPipeline.groovy b/vars/wildPipeline.groovy index 29aa978..296d068 100644 --- a/vars/wildPipeline.groovy +++ b/vars/wildPipeline.groovy @@ -6,12 +6,12 @@ def call() { def k8sinitdefinition = libraryResource('config/k8s/containers-init.yaml') def return_status = true - def LOGGER_COLORIZED_ENABLED = isXtermColorActivated() + def coloredXterm = isColoredXterm() def envtofill = [ "wild_path=./wild-workdir", "log_path=${env.workspace}/log", "current_git_branch=${env.branch_name}", - "LOGGER_COLORIZED_ENABLED=${LOGGER_COLORIZED_ENABLED}", + "coloredXterm=${coloredXterm}", ] podTemplate( @@ -65,13 +65,12 @@ def call() { } } -private Boolean isXtermColorActivated() { +private Boolean isColoredXterm() { try { ansiColor('xterm') { return true } - } - catch (Throwable ex) { + } catch (Throwable ex) { return false } } \ No newline at end of file