This commit is contained in:
Karol Cyganik 2024-04-02 23:06:30 +02:00
commit 162c6a9dac
3 changed files with 80 additions and 17 deletions

58
Jenkinsfile vendored
View File

@ -1,27 +1,51 @@
pipeline {
agent any
parameters {
string(
defaultValue: 'karol9',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
)
string(
defaultValue: '100',
description: 'Dataset cutoff size',
name: 'CUTOFF'
)
password(
defaultValue: '',
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
name: 'KAGGLE_KEY'
)
}
stages {
stage('Download Dataset') {
steps {
script {
def datasetDir = 'football-semantic-segmentation'
if (!fileExists(datasetDir)) {
sh "mkdir ${datasetDir}"
}
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}"]) {
sh "kaggle datasets download sadhliroomyprime/football-semantic-segmentation -p ${datasetDir}"
}
}
}
post {
success {
archiveArtifacts artifacts: 'football-semantic-segmentation/**', onlyIfSuccessful: true
}
}
}
stage('Checkout') {
steps {
// Clone the public repository
git url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git'
}
}
stage('Run Python Script') {
steps {
// Execute the main.py script
sh 'python3 main.py'
}
}
stage('Archive Artifacts') {
steps {
// Archive any artifacts generated by the script
// Adjust the path according to your script's output
archiveArtifacts artifacts: './football_dataset/*', fingerprint: true
git branch: 'main', url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git'
}
}
}
}

38
JenkinsfileStats Normal file
View File

@ -0,0 +1,38 @@
pipeline {
agent any
parameters {
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR')
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git'
}
}
stage('Copy Artifacts') {
steps {
script {
copyArtifacts fingerprintArtifacts: true, projectName: 'z-s495715-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
}
}
stage('Execute Script') {
steps {
sh 'chmod +x calculate_stats.sh && ./calculate_stats.sh'
}
}
stage('Archive Results') {
steps {
archiveArtifacts artifacts: 'stats.txt', onlyIfSuccessful: true
}
}
}
}

1
calculate_stats.sh Normal file
View File

@ -0,0 +1 @@
wc -l calculate_stats.sh > stats.txt