This project demonstrates a Jenkins Multibranch Pipeline setup for a Python application.
app.py
: Main application script.test_app.py
: Contains unit tests forapp.py
.Jenkinsfile
: Configuration for Jenkins pipeline.README.md
: Project documentation.
- Python 3.x
- Jenkins with Multibranch Pipeline Plugin
-
Clone the Repository:
git clone https://github.com/KevDen01/Jenkins-Python-Multibranch-Pipeline.git cd Jenkins-Python-Multibranch-Pipeline
-
Create and Activate a Virtual Environment:
python3 -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
Note: Ensure
requirements.txt
lists all necessary packages.
python app.py
python -m unittest test_app.py
-
Create a Multibranch Pipeline Job:
- In Jenkins, create a new Multibranch Pipeline job.
- Set the repository URL to this project's GitHub repository.
-
Configure Branch Sources:
- Add the repository as a branch source.
- Set up credentials if necessary.
-
Define Build Triggers:
- Configure triggers as per your requirements (e.g., periodic scans, webhook triggers).
-
Pipeline Execution:
- Jenkins will automatically detect branches with a
Jenkinsfile
and execute the defined pipeline.
- Jenkins will automatically detect branches with a
Contributions are welcome! Please fork the repository and submit a pull request.