firmware_tools/autobuild/Common_scripts/copy/all.groovy
2020-11-09 08:15:16 +00:00

86 lines
No EOL
2.8 KiB
Groovy

pipeline {
agent { label "${AGENT_LABEL}" }
stages {
stage('Initial setup') {
steps {
script {
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
}
}
}
stage('Clean exports') {
steps {
script {
IMPORTS = 'imports'
cleanfolders = [
IMPORTS,
]
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
cleaner.clean(cleanfolders)
}
}
}
stage('Import source artifacts') {
steps {
script {
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
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, IMPORTS)
}
}
}
stage('Copy source artifacts') {
steps {
script {
dir(IMPORTS) {
fileOperations([
fileCopyOperation(excludes: '',
flattenFiles: false,
includes: '**/*',
targetLocation: WORKSPACE)
])
}
}
}
}
stage('Archiving artifacts') {
steps {
script {
def includes = '**/*'
def excludes = "${IMPORTS}/*"
echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}"
// This does not work: archiveArtifacts artifacts: includes, excludes: excludes
// so
cleanfolders = [
IMPORTS,
'autobuild',
]
cleaner.clean(cleanfolders)
archiveArtifacts artifacts: includes
}
}
}
}
post {
always {
echo 'Post-build'
}
failure {
echo 'Failed build'
}
unstable {
echo 'Unstable build'
}
success {
echo 'Succeeded build'
}
}
}