64 lines
1.8 KiB
Plaintext
64 lines
1.8 KiB
Plaintext
pipeline {
|
|
agent any
|
|
|
|
parameters {
|
|
choice(
|
|
name: 'BUILD_SELECTOR',
|
|
choices: ['lastSuccessful', 'specificBuild'],
|
|
description: 'Select build'
|
|
)
|
|
string(
|
|
name: 'SPECIFIC_BUILD',
|
|
defaultValue: '',
|
|
description: 'Specific build to copy artifacts from',
|
|
trim: true
|
|
)
|
|
}
|
|
|
|
stages {
|
|
stage('Copy Artifacts') {
|
|
steps {
|
|
script {
|
|
def buildSelector
|
|
if (params.BUILD_SELECTOR == 'lastSuccessful') {
|
|
buildSelector = lastSuccessful()
|
|
} else if (params.BUILD_SELECTOR == 'specificBuild') {
|
|
buildSelector = build(params.SPECIFIC_BUILD)
|
|
} else {
|
|
error('Invalid build selector')
|
|
}
|
|
|
|
def copyArtifactParams = [
|
|
projectName: 's487177-create-dataset',
|
|
selector: buildSelector,
|
|
filter: 'output.txt.gz',
|
|
flatten: true
|
|
]
|
|
|
|
copyArtifacts(copyArtifactParams)
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Calculate Dataset Statistics') {
|
|
steps {
|
|
sh '''
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
# Count the number of lines in the input file
|
|
zcat output.txt.gz | wc -l > stats
|
|
|
|
# Archive the stats file
|
|
tar czvf stats.tar.gz stats
|
|
'''
|
|
}
|
|
post {
|
|
always {
|
|
archiveArtifacts artifacts: 'stats.tar.gz', fingerprint: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|