How do i turn a build&test_job into a scripted pipeline as a jenkinsfile

51 Views Asked by At

I'm tasked with setting up a Jenkins pipeline using a scripted Jenkinsfile to compile code using Maven. The project properties and necessary information are stored in a pom.xml file within our Bitbucket repository. The main goals are:

1 .Compile the code: Using Maven to compile the codebase. As someone who hasn't worked with Maven, I'll need guidance on common Maven sh commands for this purpose.

  1. Run JUnit tests: Following code compilation, i need to execute JUnit tests to ensure the code's functionality. I'm looking for advice on how to integrate and execute these tests within the Jenkins pipeline.

  2. Store test reports: After running the tests,my aim is to store the generated test reports in a directory for future reference and analysis. I plan to structure the pipeline with separate stages for building and testing, each performing their own tasks.

Additionally, I need to learn how to use Maven commands and execute them within the Jenkinsfile. While we already have existing build and test jobs set up in our Jenkins environment, I'm tasked with rewriting these as a scripted pipeline within a Jenkinsfile. It is important that the Jenkinsfile triggers the pipeline execution only when changes are made to the codebase. It would be great if you guys have some ideas where i can find how to the pipline stages and steps for building and testing using maven. Links, Tutorials specifice to my task would be great. Even better if you have your own suggestions. Thank you in advance for your help!

Building jenkins jobs, started my own jenkinsjob for understanding created own repo of our productive code repo.

0

There are 0 best solutions below