Pavan Bhandari
Pavan Bhandari

Reputation: 11

Jenkins Slave on Windows

I have a new requirement to configure a Windows 10 VM as Jenkins Slave and run certain python scripts. I am currently using multi-branch pipeline and use Jenkins file to define different stages.

Issue : Jenkins is not able to recognize where python is : F:\Jenkins\workspace\test>python --version
Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640

Python works from the command line but not from Jenkins.. F:\Jenkins\workspace\test>python --version Python 3.8.5

I tried defining PYTHONPATH variable in the manage node section of Jenkins ( Under the windows configuration ), but it is still not able to recognize it.

any suggestions ??

jenkinsfile : 
 stage('Lint') {
            steps {
                script {
                    bat '''
                      python --version
                      // C:\Python\python.exe --version  
                      // Tried to run the executable but no luck 
                      '''
                }

Upvotes: 1

Views: 348

Answers (1)

Márcio Costa
Márcio Costa

Reputation: 11

Since on windows after the installation of something (ex.: java) requires the restart of the command line to call it successfully, my bet would be on restarting Jenkins.

Upvotes: 1

Related Questions