Category "jenkins-groovy"

jenkins declerative pipeline - fail build when coverage drops

using declerative pipeline syntax in a Jenkinsfile and publishing coverage report using cobertura as follows cobertura( coberturaReportFile: 'coverage/cobert

How to import a class from a Jenkins Shared Library into the pipeline

I was using some global methods in the /var directory of the shared library, and everything worked fine. Now I need to keep the state of the process, so I'm wri

How to define a variable in post section of pipeline?

I want to use some common value across different conditions in post section of pipeline hence I tried following - 1. post { script { def va

Jenkins groovy - How to retrieve tag from latest commit?

To fetch the latest commit from branchName, we run below code: treeMapData = git(branch: branchName, credentialsId: credential, url: "${gitLabServer}/${project

groovy jenkinsfile to read a json file before `step` starts

I'm using Jenkins, we want to read a json file to provide necessary details within the jenkins scripts such as IP as an example. Jenkinsfile def getSecrets(json

How do I skip a Jenkins stage after executing some of its steps (like the when directive)?

How do I skip a Jenkins stage partway through its execution? It would be like using when after some steps or in the middle of a step, once the skip condition ha

How to get child job logs in parent job on child job failure?

I want to get child job logs in parent job irrespective of if child job passes or fails. Following code returns child jobs logs in parent job only when child jo