Python build using Jenkins

Nandhabalan Marimuthu
Nerd For Tech
Published in
3 min readMay 11, 2021

--

In this story, we are going to see how to install Jenkins, and running a python job in Jenkins.

Installation

  1. You can install jenkins directly from their official website and there will be a file called jenkins.war download that file.
  2. After downloading open your command prompt and direct it to the file where you saved the jenkins.rar file
  3. Then run the below command java -jar jenkins.war
  4. After that, you can see it loading so many files and there will be a password in that copy that
  5. Open your browser and paste the link or simply type localhost:8080 and hit enter
  6. It will show you something like this in this you have to paste that password that you copied and hit enter Once all the plugins installed you are good to go.

Note: Don’t close the command prompt

Defining environment variable for python

Manage Jenkins → global tool configuration → and set the path for python

Creating a new project

Create a python file on your pc and write some code in it and then follow the below steps

Click that new item and it will show you the below tab

Enter your project name and save it as a freestyle project, After that, you have to configure the project

you have to give some description and click on the Add build and choose the mentioned one

Inside that give the below command

SET PATH = %your_path_name%python your_file_location\filename.py

Build

After saving that, run the build and the blue color round indicates the success of your build. click that build and check the console your output will be there

Build
console

Python plugin

Instead of using the window terminal, we can use the python terminal directly by installing the python plugin.

Manage jenkins → Manage plugins → Available → Search for python and install that

After that, the add build option in the configure project will be like

And you can write and build your code directly there!

--

--