I am new to Jenkins, And need to execute some python scripts stored in my local machine through maven in Jenkins. Could some one guide me about this.
Asked
Active
Viewed 355 times
0
-
Are you looking for something like this: https://stackoverflow.com/questions/13974445/maven-exec-plugin-executing-a-python-script ? – Franck Jun 09 '22 at 07:13
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jun 09 '22 at 08:31
1 Answers
0
If you want to execute a python script through maven you don't have to worry about Jenkins. Because from Jenkins you will be executing maven commands and maven will take care of executing the Python script. For this you can use something like the maven exec plugin. But if you want to execute a python command before executing the maven command you can use a shell executor for this. Following is a sample pipeline for this.
pipeline {
agent any
stages {
stage('Sample') {
steps {
script {
git branch: 'master'
url: 'git@github.com:ycr/sample.git'
}
sh """
python hello.py // Execute python
mvn clean install // Execute maven
"""
}
}
}
}

ycr
- 12,828
- 2
- 25
- 45