firmware_tools/copy/all.groovy
2022-01-30 00:04:18 +00:00

67 lines
2.3 KiB
Groovy

pipeline {
agent { label AGENT_LABEL }
stages {
stage('Initial setup') {
steps {
script {
// Force workspace to be cleaned
CLEAN_WORKSPACE = "true"
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
artifactarchiver = load("${autobuilder.commonscripts()}/artifacts/archiver.groovy")
}
}
}
stage('Import source artifacts') {
steps {
script {
def copyoptions = importer.getNewImportOptions()
copyoptions.source(
SOURCE_ARTIFACT_LOCATION,
SOURCE_ARTIFACT_BUILD_JOB,
SOURCE_ARTIFACT_BUILD_SELECTOR,
SOURCE_ARTIFACT_RELEASE_REPO,
SOURCE_ARTIFACT_RELEASE_REVISION)
echo "Nested: ${NESTED_COPY}"
copyoptions.setnested(NESTED_COPY == 'true')
importer.artifactimport(meta, copyoptions, "${WORKSPACE}/.")
}
}
}
stage('Archiving artifacts') {
steps {
script {
// Save the imported meta - while the unwanted meta is written to file then deleted
def stashname = 'Imported meta stash'
stash(allowEmpty: true,
includes: 'meta/**',
name: stashname,
useDefaultExcludes: false)
def artifactlist = meta.generateartifacts(['**/*'])
cleaner.clean(['meta', 'autobuild'])
unstash(name: stashname)
artifactarchiver.archive(meta, artifactlist)
}
}
}
}
post {
always {
echo 'Post-build'
}
failure {
echo 'Failed build'
}
unstable {
echo 'Unstable build'
}
success {
echo 'Succeeded build'
}
}
}