From 1dc3f6b532c44198267797264ae445717e947f86 Mon Sep 17 00:00:00 2001 From: Karol Cyganik Date: Tue, 26 Mar 2024 19:09:12 +0100 Subject: [PATCH 1/4] try downloading kaggle dataset --- Jenkinsfile | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8472f6..c3ec310 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,27 +1,44 @@ pipeline { agent any + parameters { + string( + defaultValue: 'karol9', + description: 'Kaggle username', + name: 'KAGGLE_USERNAME', + 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 { + stage('Download Dataset') { + steps { + script { + def datasetDir = 'football-semantic-segmentation' + sh "mkdir ${datasetDir}" + + // Download the dataset + withCredentials([string(value: params.KAGGLE_KEY, variable: 'KAGGLE_API_TOKEN')]) { + sh "KAGGLE_CONFIG_DIR=. 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 - } - } } } + From b24acb3c0adde433244745f2bc1a45c36a04bc4f Mon Sep 17 00:00:00 2001 From: Karol Cyganik Date: Tue, 26 Mar 2024 19:51:03 +0100 Subject: [PATCH 2/4] repair jenkins --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c3ec310..c8c3d0f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,11 +20,13 @@ pipeline { steps { script { def datasetDir = 'football-semantic-segmentation' - sh "mkdir ${datasetDir}" + if (!fileExists(datasetDir)) { + sh "mkdir ${datasetDir}" + } - // Download the dataset - withCredentials([string(value: params.KAGGLE_KEY, variable: 'KAGGLE_API_TOKEN')]) { - sh "KAGGLE_CONFIG_DIR=. kaggle datasets download sadhliroomyprime/football-semantic-segmentation -p ${datasetDir}" + withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}", + "KAGGLE_KEY=${params.KAGGLE_KEY}"]) { + sh "kaggle datasets download sadhliroomyprime/football-semantic-segmentation -p ${datasetDir}" } } } @@ -36,7 +38,7 @@ pipeline { } stage('Checkout') { steps { - git url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git' + git branch: 'main', url: 'https://git.wmi.amu.edu.pl/s495715/iumKC.git' } } } From d6946ea0da9765fd1236ede849bfb80fdcfa3ce3 Mon Sep 17 00:00:00 2001 From: Karol Cyganik Date: Tue, 26 Mar 2024 19:59:52 +0100 Subject: [PATCH 3/4] add cutoff --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index c8c3d0f..9d7cd32 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,11 @@ pipeline { 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', From 7c185b12ca574b24d2c2e708efc7e4f7169750f5 Mon Sep 17 00:00:00 2001 From: Karol Cyganik Date: Tue, 26 Mar 2024 20:14:31 +0100 Subject: [PATCH 4/4] add stats --- JenkinsfileStats | 38 ++++++++++++++++++++++++++++++++++++++ calculate_stats.sh | 1 + 2 files changed, 39 insertions(+) create mode 100644 JenkinsfileStats create mode 100644 calculate_stats.sh diff --git a/JenkinsfileStats b/JenkinsfileStats new file mode 100644 index 0000000..b6cdf5c --- /dev/null +++ b/JenkinsfileStats @@ -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 + } + } + } +} diff --git a/calculate_stats.sh b/calculate_stats.sh new file mode 100644 index 0000000..f622b7b --- /dev/null +++ b/calculate_stats.sh @@ -0,0 +1 @@ +wc -l calculate_stats.sh > stats.txt \ No newline at end of file