In jenkins, you can create a jenkins pipeline using a script that is written in a Jenkins file.
We are writing a script using "steps" and "node" as a building block. These building blocks allow you to specify instructions to be executed as part of the jenkins pipeline.
To complete the gradle build using the JenkinsFile, first check the operating system and invoke the appropriate shell that can perform the gradle task, as shown below:
Jenkinsfile
stage 'build_Project' node{ if(isUnix()){ sh 'gradle build --info' } else{ bat 'gradle build --info' } }
Above the code snippet, create a step called build_project and run the gradle build script of the current project.
Vaijnath polsane
source share