This commit is contained in:
filnow 2024-03-26 21:15:11 +01:00
parent 134226e251
commit 4cf94b59ae
4 changed files with 88 additions and 2 deletions

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/s464915/ium_464915.git'
}
}
stage('Copy Artifacts') {
steps {
script {
copyArtifacts fingerprintArtifacts: true, projectName: 'z-s464915-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
}
}
stage('Execute Script') {
steps {
sh 'bash calculate.sh'
}
}
stage('Archive Results') {
steps {
archiveArtifacts artifacts: 'stats.txt', onlyIfSuccessful: true
}
}
}
}

45
Jenkinsfile vendored
View File

@ -1,9 +1,50 @@
pipeline { pipeline {
agent any agent any
parameters {
string(
defaultValue: 'filipnowicki',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
)
string(
defaultValue: '100',
description: 'Dataset cutoff parametr',
name: 'CUTOFF',
trim: false
)
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 { stages {
stage('Stage 1') { stage('Download Dataset') {
steps { steps {
echo 'Hello World' script {
def datasetDir = 'data'
if (!fileExists(datasetDir)) {
sh "mkdir ${datasetDir}"
}
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}"]) {
sh "bash ./download.sh"
}
}
}
post {
success {
archiveArtifacts artifacts: 'data/**', onlyIfSuccessful: true
}
}
}
stage('Checkout') {
steps {
git branch: 'main', url: 'https://git.wmi.amu.edu.pl/s464915/ium_464915.git'
} }
} }
} }

1
calculate.sh Normal file
View File

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

6
download.sh Normal file
View File

@ -0,0 +1,6 @@
pip install kaggle
kaggle datasets download -d fanconic/skin-cancer-malignant-vs-benign
mv skin-cancer-malignant-vs-benign.zip ./data/
unzip ./data/skin-cancer-malignant-vs-benign.zip -d ./data/
rm ./data/skin-cancer-malignant-vs-benign.zip