2023-05-23 22:03:38 +02:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
|
|
|
|
tools {
|
2023-05-23 23:06:26 +02:00
|
|
|
git 'Default'
|
2023-05-23 22:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2023-05-23 23:12:16 +02:00
|
|
|
stage('Setup Git') {
|
|
|
|
steps {
|
|
|
|
sh """
|
2023-05-23 23:16:29 +02:00
|
|
|
git config user.email "jakzar3@st.amu.edu.pl"
|
|
|
|
git config user.name "s487187"
|
2023-05-23 23:12:16 +02:00
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|
2023-05-23 23:06:26 +02:00
|
|
|
|
2023-05-23 22:03:38 +02:00
|
|
|
stage('Clone Repository') {
|
|
|
|
steps {
|
2023-05-23 23:07:58 +02:00
|
|
|
script {
|
|
|
|
try {
|
2023-05-23 23:17:16 +02:00
|
|
|
git url: 'https://git.wmi.amu.edu.pl/s487187/ium_487187'
|
2023-05-23 23:07:58 +02:00
|
|
|
} catch (Exception err) {
|
|
|
|
error "Failed to clone repository: ${err.message}"
|
|
|
|
}
|
2023-05-23 22:03:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-23 23:20:35 +02:00
|
|
|
stage('Setup Python') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
|
|
|
python3 get-pip.py --user
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
2023-05-24 18:48:02 +02:00
|
|
|
|
2023-05-24 18:49:38 +02:00
|
|
|
stage('Install OpenSSL Locally') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
|
|
|
|
tar -zxf openssl-1.1.1k.tar.gz
|
|
|
|
cd openssl-1.1.1k
|
|
|
|
./config --prefix=$HOME/local/openssl --openssldir=$HOME/local/openssl
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Install Python Dependencies') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
export PATH=$HOME/local/openssl/bin:$PATH
|
|
|
|
export LD_LIBRARY_PATH=$HOME/local/openssl/lib
|
|
|
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
|
|
|
python3 get-pip.py --user
|
|
|
|
python3 -m pip install --user \'dvc[ssh]\'
|
2023-05-24 19:00:50 +02:00
|
|
|
python3 -m pip install --user cryptography==3.4.7 # specify a version here
|
2023-05-24 18:49:38 +02:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-24 18:46:23 +02:00
|
|
|
stage('Update OpenSSL and Cryptography') {
|
|
|
|
steps {
|
|
|
|
sh '''
|
|
|
|
python3 -m pip uninstall -y cryptography
|
|
|
|
python3 -m pip install cryptography
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
2023-05-23 23:20:35 +02:00
|
|
|
|
|
|
|
stage('Install DVC') {
|
|
|
|
steps {
|
2023-05-24 18:44:23 +02:00
|
|
|
sh 'python3 -m pip install --user \'dvc[ssh]\''
|
2023-05-23 23:20:35 +02:00
|
|
|
}
|
|
|
|
}
|
2023-05-23 23:18:50 +02:00
|
|
|
|
2023-05-24 01:16:49 +02:00
|
|
|
stage('Clean DVC Cache') {
|
|
|
|
steps {
|
2023-05-24 18:43:17 +02:00
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc gc -c -w -f'
|
2023-05-24 01:16:49 +02:00
|
|
|
}
|
|
|
|
}
|
2023-05-24 01:18:00 +02:00
|
|
|
|
2023-05-24 18:07:38 +02:00
|
|
|
stage('Configure DVC Remote') {
|
|
|
|
steps {
|
|
|
|
withCredentials(
|
|
|
|
[sshUserPrivateKey(credentialsId: '48ac7004-216e-4260-abba-1fe5db753e18', keyFileVariable: 'IUM_SFTP_KEY', passphraseVariable: '', usernameVariable: '')]) {
|
2023-05-24 18:43:17 +02:00
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc remote add -d ium_ssh_remote ssh://ium-sftp@tzietkiewicz.vm.wmi.amu.edu.pl/ium-sftp'
|
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc remote modify --local ium_ssh_remote keyfile $IUM_SFTP_KEY'
|
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc pull'
|
|
|
|
}
|
2023-05-24 18:07:38 +02:00
|
|
|
}
|
|
|
|
}
|
2023-05-24 01:07:30 +02:00
|
|
|
|
2023-05-24 18:05:58 +02:00
|
|
|
// stage('Pull DVC Files') {
|
|
|
|
// steps {
|
|
|
|
// sh 'PATH=$PATH:~/.local/bin/ dvc pull -f'
|
|
|
|
// }
|
|
|
|
// }
|
2023-05-23 22:03:38 +02:00
|
|
|
|
2023-05-24 01:44:51 +02:00
|
|
|
stage('Run DVC Pipeline') {
|
|
|
|
steps {
|
2023-05-24 18:43:17 +02:00
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc reproduce'
|
2023-05-24 01:44:51 +02:00
|
|
|
}
|
|
|
|
}
|
2023-05-24 01:03:57 +02:00
|
|
|
|
2023-05-24 01:44:51 +02:00
|
|
|
stage('Push DVC Files') {
|
|
|
|
steps {
|
2023-05-24 18:43:17 +02:00
|
|
|
sh 'PATH=$PATH:$HOME/.local/bin/ dvc push'
|
2023-05-24 01:44:51 +02:00
|
|
|
}
|
|
|
|
}
|
2023-05-23 22:03:38 +02:00
|
|
|
}
|
|
|
|
}
|