added docker to jenkins files (lab4/zad3)

This commit is contained in:
Jakub Pogodziński 2021-05-15 18:39:17 +02:00
parent fa2f7b4d1b
commit 7656ba3dc4
3 changed files with 34 additions and 26 deletions

15
Jenkinsfile vendored
View File

@ -4,15 +4,22 @@ pipeline{
stages{
stage('checkout: Check out from version control'){
steps{
git url: 'https://github.com/jfrogdev/project-examples.git'
git url: 'https://git.wmi.amu.edu.pl/s437622/ium_s437622.git'
}
}
stage('sh: Shell Script'){
stage('docker')
{
steps{
./script.sh
script{
def img = docker.build('jpogodzinski/ium:1')
img.inside{
sh './script.sh'
}
}
}
}
stage('Archive artifacts'){
stage('end'){
steps{
archiveArtifacts 'test.csv'
archiveArtifacts 'dev.csv'

View File

@ -1,29 +1,30 @@
pipeline{
pipeline{
agent any
properties([parameters([
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR')
])])
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'BUILD_SELECTOR')
}
stages{
stage('checkout: Check out from version control'){
steps{
git credentialsId: 'b4ba8ec9-8fc6-4f68-bf24-695634cec73e', url: 'https://git.wmi.amu.edu.pl/s437622/ium_s437622.git'
stage('Copy artifacts'){
copyArtifacts filter: 'dev.csv, train.csv, test.csv', fingerprintArtifacts: false, projectName: 's437622-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
stage('Docker') {
steps {
script {
docker.image("jpogodzinski/ium:1").inside {
sh 'rm -rf ium_s437622'
sh 'git clone https://git.wmi.amu.edu.pl/s437622/ium_s437622.git'
sh "chmod +x ium_s437622/stats.sh"
sh "ium_437622/stats.sh"
}}
}
}
}
stage('copy artifacts'){
copyArtifacts filter: 'dev.csv, train.csv, test.csv', fingerprintArtifacts: true, projectName: 's437622-create-dataset', selector: buildParameter('BUILD_SELECTOR')
}
stage('sh: Shell Script'){
steps{
./stats.sh
}
}
stage('Archive artifacts'){
steps{
archiveArtifacts 'stats.txt'
}
}
}
}
}
}

View File

@ -1,6 +1,6 @@
#!/bin/bash
curl -OL https://git.wmi.amu.edu.pl/s437622/ium_s437622/src/branch/master/games.csv
head -n -1 games.csv | shuf > chess.csv.shuf
tail -n +2 games.csv | shuf > chess.csv.shuf
wc -l chess.csv
head -n 2006 chess.csv.shuf > test.csv
head -n 4012 chess.csv.shuf | tail -n 2006 > dev.csv