Skip to content

Commit

Permalink
ref(15): Start testing wild integration with Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanjerome committed Aug 19, 2023
1 parent 9e90172 commit 5828729
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions vars/logger.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
9 changes: 4 additions & 5 deletions vars/wildPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
}
}

0 comments on commit 5828729

Please sign in to comment.