firmware_tools/autobuild/Common_scripts/check/build_meta.groovy
2022-01-08 10:20:21 +00:00

87 lines
2.8 KiB
Groovy

pipeline {
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
script {
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
meta = autobuilderscript.startnonbuild(this)
}
}
}
stage('Clean exports') {
steps {
script {
cleanfolders = [
"${WORKSPACE}/build_artifacts",
]
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
cleaner.clean(cleanfolders)
}
}
}
stage('Get build artifact meta') {
steps {
script {
BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts"
copyArtifacts(
projectName: BUILD_JOB,
selector: [
$class: 'ParameterizedBuildSelector',
parameterName: BUILD_JOB_SELECTOR
],
target: BUILD_ARTIFACTS
)
def mfs = autobuilderscript.getmetafolderscript()
buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS)
}
}
}
stage('Check components') {
steps {
script {
def checker = load("${autobuilder.commonscripts()}/check/do_meta.groovy")
(summarystring, markunstable, unstablereason) = checker.checkhierarchy(buildmeta, MAX_META_DEPTH, BUILD_ARTIFACTS)
if (markunstable) {
env.unstablereason = unstablereason
currentBuild.result = 'UNSTABLE'
}
}
}
}
stage('Archiving artifacts') {
steps {
script {
def artifactlist = meta.generateartifacts()
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
artifactarchiver.archive("summary/**,${artifactlist}")
}
}
}
stage('Summarise') {
steps {
script {
echo "Summary:\n${summarystring}\n"
if (env.unstablereason) {
echo "Instability reason: ${env.unstablereason}"
}
}
}
}
}
post {
always {
echo 'Post-build'
}
failure {
echo 'Failed build'
}
unstable {
echo 'Unstable build'
}
success {
echo 'Succeeded build'
}
}
}