sonarqube causing Out Of Memory on jenkins pipeline - jenkins

when we integrate sonar in jenkins pipeline with
withSonarQubeEnv('SonarQube') it causes Out Of Memory issue and when we try with
withSonarQubeEnv(installationName: 'SonarQube', envOnly: true)
the pipeline completes without any issue.
how does the envOnly:true solves the issue on jenkins?
we also tried to integrate sonar in pipeline with
withSonarQubeEnv('SonarQube') with increased memory on jenkins in that case the pipeline gets completed without any issue.

Related

Which Executor is executing the pipeline

is it possible to check in Jenkins pipeline script which executor is executing the job.
Suppose there are two executors (Executor-1 and Executor-2) and JOB-A is triggered. As the Executor-1 is free, execution of JOB-A is started by Executor-1.
I would like to find out in my pipeline script of JOB-A that the execution is currently running on Executor-1.
Is there a way to find this?
I found the answer by going through this issue.
The environment variable EXECUTOR_NUMBER can be used to find on which executor is the job running.

No such DSL method 'rtServer' found among steps in Jenkins job for JFrog Artifactory Plugin

I am trying to run a Jenkins job to publish my war file to Artifactory.
I am using Declarative Pipeline syntax
// ... previous stages
stage('rtServer to Artifactory'){
steps {
rtServer (
id: 'Artifactory-MC',
url: 'http://my-artifactory-domain/artifactory',
credentialsId: 'credentialsID',
timeout = 100
)
}
}
... //rtUpload stages and post block
When I run the Jenkins job I get the following error:
java.lang.NoSuchMethodError: No such DSL method 'rtServer' found among steps
Declarative pipeline in Artifactory Plugin was introduced in version 3.0.0. Upgrade your plugin version if it is lower, preferably to the latest version.
As for the timeout setting, this is currently bugged. This jira issue tracks the fix. The timeout has a default value of 300 if not explicitly set.

How to cofigure jenkins to stop running failed builds?

We using open source Jenkins 2.107.2 on AWS.
We use Jenkins pipeline for all our apps.
We do not use multi-branch pipelines.
For one of the application, Jenkins job was failing due to the post-deploy test cases failures. Because of that the job is continuously executing the job until it succeeds.Can we configure Jenkins to retry failed builds only 1/2 times.
I saw https://wiki.jenkins.io/display/JENKINS/Naginator+Plugin
but this plugin is not supported for pipeline.
Is this what you need?
stage('build') {
if(!isBuildable){
//stop build and jump to next stage
return;
}
//do build tasks
}
isBuildable variable could be the result of other stages or any value that indicates that it should be built or not.

Jenkins pipeline fails without error

My Jenkins Pipeline fails even though no stage has an error:
The console log also shows no problems, but Build status: FAILURE.
Any tips on how to troubleshoot this would be appreciated.
It was a wrong path for a artifactory upload, this let the pipeline silently fail.

Visualizing build steps in Jenkins pipeline

In my Jenkins pipeline, I trigger several other jobs using the build step and pass some parameters to it. I'm having issues visualizing the different jobs I've triggered in addition to my pipeline. I have set up the Jenkins Delivery Pipeline plugin but the documentation for it is extremely vague and I have only been able to visualize the steps within my pipeline, despite tagging the jobs with both a stage and task name.
Example:
I have two jobs in Jenkins as pipelines/workflow jobs with the following pipeline script:
Job Foo:
stage('Building') {
println 'Triggering job'
build 'Bar'
}
Job Bar:
node('master') {
stage('Child job stage') {
println 'Doing stuff in child job'
}
}
When visualizing this with the Jenkins Pipeline Delivery plugin, I only get this:
How do I make it also show the stage in job Bar in a separate box?
Unfortunately, this use case is currently not supported in the Delivery Pipeline plugin version 1.0.0. The delivery pipeline plugin views for Jenkins pipelines are only rendering what is contained within one pipeline definition at this point. This feature request is tracked in JENKINS-43679.

Resources