-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkinsfile
More file actions
55 lines (52 loc) · 1.97 KB
/
jenkinsfile
File metadata and controls
55 lines (52 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pipeline {
agent any
environment {
LABS = credentials('labcreds')
JAVA_HOME = '/opt/bitnami/java' // Set your JAVA_HOME path here.
PATH = "${env.JAVA_HOME}/bin:${env.PATH}" // Add Java binaries to PATH
}
stages {
stage('Setup Virtual Environment') {
steps {
script {
// Create a virtual environment with the project name (Retail pipeline)
sh 'python3 -m venv retail_pipeline_venv'
// Upgrade pip and install pipenv in the virtual environment
sh './retail_pipeline_venv/bin/pip install --upgrade pip'
sh './retail_pipeline_venv/bin/pip install pipenv'
}
}
}
stage('Install Dependencies') {
steps {
script {
// Install your project dependencies (e.g., requirements.txt or Pipfile)
sh './retail_pipeline_venv/bin/pipenv install'
}
}
}
stage('Test') {
steps {
script {
// Ensure JAVA_HOME is set for PySpark to work
sh 'echo $JAVA_HOME'
sh 'echo $PATH'
// Run tests (assuming you are using pytest for tests)
sh './retail_pipeline_venv/bin/pipenv run pytest'
}
}
}
stage('Package') {
steps {
// Create the zip file but exclude the venv directory
sh 'zip -r retailproject.zip . -x "retail_pipeline_venv/*"'
}
}
stage('Deploy') {
steps {
// Add deployment steps here (e.g., deploy to a server or cloud)
sh 'sshpass -p $LABS_PSW scp -o StrictHostKeyChecking=no -r retailproject.zip $LABS_USR@g02.itversity.com:/home/itv012419/retailproject'
}
}
}
}