Zad 03.Jenkins - zapisanie zbioru danych

This commit is contained in:
Cezary Gałązkiewicz 2022-03-27 23:51:53 +02:00
parent a3b169c6fe
commit 66fdb14f15
2 changed files with 78 additions and 2 deletions

11
download.sh Normal file
View File

@ -0,0 +1,11 @@
kaggle datasets download -d csafrit2/steel-industry-energy-consumption
unzip -o steel-industry-energy-consumption.zip
tail -n +2 Steel_industry_data.csv | cut -d, -f8 --complement | shuf > steel_industry_data_shuffled.csv
number_of_lines=$(wc -l steel_industry_data_shuffled.csv | awk '{print $1}')
test_len=$((number_of_lines/10))
dev_len=$((number_of_lines/10))
head -n $test_len steel_industry_data_shuffled.csv > steel_industry_data_test.csv
tail -n +$((test_len+1)) steel_industry_data_shuffled.csv | head -n $dev_len > steel_industry_data_dev.csv
tail -n +$((test_len+dev_len+1)) steel_industry_data_shuffled.csv > steel_industry_data_train.csv
rm steel_industry_data_shuffled.csv

View File

@ -1,10 +1,75 @@
pipeline {
agent any
agent any
parameters {
string(
defaultValue: 'ikami1',
description: 'Kaggle username',
name: 'KAGGLE_USERNAME',
trim: false
),
password(
defaultValue: '17eaeb44a09284608df768f4c9c8c7af',
description: 'Kaggle token taken from kaggle.json file, as described in https://github.com/Kaggle/kaggle-api#api-credentials',
name: 'KAGGLE_KEY'
)
}
environment {
KAGGLE_USERNAME="$params.KAGGLE_USERNAME"
KAGGLE_KEY="$params.KAGGLE_KEY"
}
stages {
stage('Stage 1') {
stage('Test stage') {
steps {
echo 'Hello world! Some test text - added text'
}
}
stage('Checkout') {
steps {
checkout scm
}
}
stage('Shell script') {
steps {
script{
withEnv(["KAGGLE_USERNAME=${params.KAGGLE_USERNAME}",
"KAGGLE_KEY=${params.KAGGLE_KEY}" ]) {
sh 'echo KAGGLE_USERNAME: $KAGGLE_USERNAME'
sh 'kaggle datasets list'
sh './download.sh'
}
}
}
}
}
}
pipeline {
agent any
//Definijuemy parametry, które będzie można podać podczas wywoływania zadania
parameters {
string (
defaultValue: 'Hello World!',
description: 'Tekst, którym chcesz przywitać świat',
name: 'INPUT_TEXT',
trim: false
)
}
stages {
stage('Hello') {
steps {
//Wypisz wartość parametru w konsoli (To nie jest polecenie bash, tylko groovy!)
echo "INPUT_TEXT: ${INPUT_TEXT}"
//Wywołaj w konsoli komendę "figlet", która generuje ASCI-art
sh "figlet \"${INPUT_TEXT}\" | tee output.txt"
}
}
stage('Goodbye!') {
steps {
echo 'Goodbye!'
//Zarchiwizuj wynik
archiveArtifacts 'output.txt'
}
}
}
}