Skip to content

Commit

Permalink
Merge branch 'matousek-feat-lockable-jenkins-resources' into 'devel'
Browse files Browse the repository at this point in the history
Support for lockable Jenkins resources

See merge request ndk/ndk-app-minimal!55
  • Loading branch information
jakubcabal committed Oct 20, 2023
2 parents a6c0973 + 44ffe3b commit dd0064c
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 128 deletions.
62 changes: 32 additions & 30 deletions app/ver.jenkins
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
/*
* ver.jenkins: Jenkins configuration script
* Copyright (C) 2021 CESNET z. s. p. o.
* Author(s): Radek Iša <[email protected]>
*
* SPDX-License-Identifier: BSD-3-Clause
*/

// Clean previous builds
library 'liberouter'
cleanBuilds()


// /////////////////////////////////////////////////////////////////////////////
// MULTI-VERIFICATION
// /////////////////////////////////////////////////////////////////////////////
// [ 'name' , 'path_to_ver' , 'fdo_file.fdo' , 'test_pkg.sv/.vhd' , 'settings.py' ]
// ['FULL_SPEED' , 'app/uvm' , 'top_level.fdo' , 'test_pkg.vhd' , 'ver_settings.py' ],\
def COMPONENTS_MULTIVER = [\
['BASE' , 'app/uvm' , 'top_level.fdo' , 'test_pkg.sv' , 'ver_settings.py' ],\
]
// /////////////////////////////////////////////////////////////////////////////
// Run component verifications using common script
node('preklad') {
// fetch sources from GIT
checkout scm
def common_run = load "ndk/ofm/tests/jenkins/common.jenkins"
def root_path = pwd()
common_run.commonPrekladMultiVerRun(COMPONENTS_MULTIVER, "$root_path/ndk/ofm")
}
/*
* ver.jenkins: Jenkins configuration script
* Copyright (C) 2021 CESNET z. s. p. o.
* Author(s): Radek Iša <[email protected]>
*
* SPDX-License-Identifier: BSD-3-Clause
*/

// Clean previous builds
library 'liberouter'
cleanBuilds()


// /////////////////////////////////////////////////////////////////////////////
// MULTI-VERIFICATION
// /////////////////////////////////////////////////////////////////////////////
// [ 'name' , 'path_to_ver' , 'fdo_file.fdo' , 'test_pkg.sv/.vhd' , 'settings.py' ]
// ['FULL_SPEED' , 'app/uvm' , 'top_level.fdo' , 'test_pkg.vhd' , 'ver_settings.py' ],\
def COMPONENTS_MULTIVER = [\
['BASE' , 'app/uvm' , 'top_level.fdo' , 'test_pkg.sv' , 'ver_settings.py' ],\
]
// /////////////////////////////////////////////////////////////////////////////
// Run component verifications using common script
node('preklad') {
lock(label:"resources-${env.NODE_NAME}", quantity: 1) {
// fetch sources from GIT
checkout scm
def common_run = load "ndk/ofm/tests/jenkins/common.jenkins"
def root_path = pwd()
common_run.commonPrekladMultiVerRun(COMPONENTS_MULTIVER, "$root_path/ndk/ofm")
}
}
14 changes: 8 additions & 6 deletions tests/jenkins/comp.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ def COMPONENTS_MULTIVER = [\

// Run component verifications using common script
node('preklad') {
// fetch sources from GIT
checkout scm
def common_run = load "ndk/ofm/tests/jenkins/common.jenkins"
common_run.commonPrekladVerRun(COMPONENTS_VER)
def root_path = pwd()
common_run.commonPrekladMultiVerRun(COMPONENTS_MULTIVER, "$root_path/ndk/ofm")
lock(label:"resources-${env.NODE_NAME}", quantity: 1) {
// fetch sources from GIT
checkout scm
def common_run = load "ndk/ofm/tests/jenkins/common.jenkins"
common_run.commonPrekladVerRun(COMPONENTS_VER)
def root_path = pwd()
common_run.commonPrekladMultiVerRun(COMPONENTS_MULTIVER, "$root_path/ndk/ofm")
}
}

93 changes: 47 additions & 46 deletions tests/jenkins/ver_dma_medusa.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,62 @@ properties([

// Jenkins configuration for multiple modules
node('preklad') {
lock(label:"resources-${env.NODE_NAME}", quantity: 1) {
// Clean old builds
cleanBuilds()

// Clean old builds
cleanBuilds()
// fetch sources from GIT
checkout scm
// clean artifacts possibly left by previous builds
sh "git clean -df"

// fetch sources from GIT
checkout scm
// clean artifacts possibly left by previous builds
sh "git clean -df"

def failed = []
// run verification of every component
withEnv(["PATH+VSIM=/usr/local/fpga/Modeltech/linux_x86_64", '[email protected]']) {
for(c in COMPONENTS) {
// parse
def name = c[0]
def path = c[1]
def fdo = c[2]
def pkg = c[3]
def settings = c[4]
def repo_root = pwd()
def multi_ver = "$repo_root/ndk/ofm/build/scripts/multi_ver/multi_ver.py"
// exec vsim
try { // try-catch is a hack to continue even after the first failed verification
timeout(time: 12, unit: 'HOURS') {
stage("$name") {
dir("$path") {
sh "python3 $multi_ver $fdo $pkg $settings"
def failed = []
// run verification of every component
withEnv(["PATH+VSIM=/usr/local/fpga/Modeltech/linux_x86_64", '[email protected]']) {
for(c in COMPONENTS) {
// parse
def name = c[0]
def path = c[1]
def fdo = c[2]
def pkg = c[3]
def settings = c[4]
def repo_root = pwd()
def multi_ver = "$repo_root/ndk/ofm/build/scripts/multi_ver/multi_ver.py"
// exec vsim
try { // try-catch is a hack to continue even after the first failed verification
timeout(time: 12, unit: 'HOURS') {
stage("$name") {
dir("$path") {
sh "python3 $multi_ver $fdo $pkg $settings"
}
}
}
} catch(err) {
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
failed.add("$name")
} finally { // collect interesting files
archiveArtifacts "$path/transcript*" // verification log
}
} catch(err) {
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
failed.add("$name")
} finally { // collect interesting files
archiveArtifacts "$path/transcript*" // verification log
}
}
}

// send out emails if failure is detected
if(currentBuild.result == "FAILURE") {
println "FAILED on components: ${failed}."
emailext \
recipientProviders: [culprits(), developers()],
to: '[email protected]',
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}",
body: """\
The build of the repository ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments.
// send out emails if failure is detected
if(currentBuild.result == "FAILURE") {
println "FAILED on components: ${failed}."
emailext \
recipientProviders: [culprits(), developers()],
to: '[email protected]',
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}",
body: """\
The build of the repository ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments.

For more details see ${env.BUILD_URL}.
For more details see ${env.BUILD_URL}.

Yours sincerely
Jenkins\
""".stripIndent(),
attachLog: true,
compressLog: true
Yours sincerely
Jenkins\
""".stripIndent(),
attachLog: true,
compressLog: true
}
}
}
93 changes: 47 additions & 46 deletions tests/jenkins/ver_dma_medusa_xl.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,62 @@ properties([

// Jenkins configuration for multiple modules
node('preklad') {
lock(label:"resources-${env.NODE_NAME}", quantity: 1) {
// Clean old builds
cleanBuilds()

// Clean old builds
cleanBuilds()
// fetch sources from GIT
checkout scm
// clean artifacts possibly left by previous builds
sh "git clean -df"

// fetch sources from GIT
checkout scm
// clean artifacts possibly left by previous builds
sh "git clean -df"

def failed = []
// run verification of every component
withEnv(["PATH+VSIM=/usr/local/fpga/Modeltech/linux_x86_64", '[email protected]']) {
for(c in COMPONENTS) {
// parse
def name = c[0]
def path = c[1]
def fdo = c[2]
def pkg = c[3]
def settings = c[4]
def repo_root = pwd()
def multi_ver = "$repo_root/ndk/ofm/build/scripts/multi_ver/multi_ver.py"
// exec vsim
try { // try-catch is a hack to continue even after the first failed verification
timeout(time: 4, unit: 'DAYS') {
stage("$name") {
dir("$path") {
sh "python3 $multi_ver $fdo $pkg $settings"
def failed = []
// run verification of every component
withEnv(["PATH+VSIM=/usr/local/fpga/Modeltech/linux_x86_64", '[email protected]']) {
for(c in COMPONENTS) {
// parse
def name = c[0]
def path = c[1]
def fdo = c[2]
def pkg = c[3]
def settings = c[4]
def repo_root = pwd()
def multi_ver = "$repo_root/ndk/ofm/build/scripts/multi_ver/multi_ver.py"
// exec vsim
try { // try-catch is a hack to continue even after the first failed verification
timeout(time: 4, unit: 'DAYS') {
stage("$name") {
dir("$path") {
sh "python3 $multi_ver $fdo $pkg $settings"
}
}
}
} catch(err) {
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
failed.add("$name")
} finally { // collect interesting files
archiveArtifacts "$path/transcript*" // verification log
}
} catch(err) {
currentBuild.result = 'FAILURE' // still propagate failure status to Jenkins
failed.add("$name")
} finally { // collect interesting files
archiveArtifacts "$path/transcript*" // verification log
}
}
}

// send out emails if failure is detected
if(currentBuild.result == "FAILURE") {
println "FAILED on components: ${failed}."
emailext \
recipientProviders: [culprits(), developers()],
to: '[email protected]',
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}",
body: """\
The build of the repository ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments.
// send out emails if failure is detected
if(currentBuild.result == "FAILURE") {
println "FAILED on components: ${failed}."
emailext \
recipientProviders: [culprits(), developers()],
to: '[email protected]',
subject: "[Jenkins] ${currentBuild.currentResult} ${env.JOB_NAME} #${currentBuild.number}",
body: """\
The build of the repository ${env.JOB_NAME} #${currentBuild.number} ends up with status ${currentBuild.currentResult} on components: ${failed}. You can find build log in the attachments.

For more details see ${env.BUILD_URL}.
For more details see ${env.BUILD_URL}.

Yours sincerely
Jenkins\
""".stripIndent(),
attachLog: true,
compressLog: true
Yours sincerely
Jenkins\
""".stripIndent(),
attachLog: true,
compressLog: true
}
}
}

0 comments on commit dd0064c

Please sign in to comment.