Changes stay on Failed Jenkins build - jenkins

In my Jenkins pipeline I do a checkout, after that checkout something happens that causes the build to fail. The changes/commits stay attached to that failed build. The next build doesn't show the changes that were reported on the failed build. From the below I would like to see the 3 commits to show on build #76.

Related

Commits in changes sometimes disappear in Pipeline Stage View

When a commit is pushed on our Bitbucket server, a Jenkins pipeline is triggered.
The picture below shows 2 executions of the pipeline, each one triggered by 1 commit.
As you can see, the build #6722 shows "1 commit" which is fine. The build #6723 doesn't show anything whereas it was triggered by one commit.
The changes are detected by Jenkins :
When the pipelines starts, commit information are show but they disappear when the pipeline ends.
When I restart Jenkins, these commit informations appear well on previous executed builds.
I don't see any relevant information in the logs (don't know how to set log level to debug for Stage View plugin).
Any idea about this behavior ?
Versions installed:
Jenkins: 2.361.1
Pipeline Stage View plugin: 2.24
Pipeline REST API plugin: 2.24
JQuery3 API: 3.6.1-1

Show live state of Jenkins build in Github PR

After diving into this post: Show current state of Jenkins build on GitHub repo
I still haven't found a way to show the current status of the build (last Jenkins run result) in every PR.
Meaning that every PR will show the status of the build and not just the specific commit that broke it.
This will make the team more aware of the build status and will prevent merging when the build is broken.

Prevent Release Trigger on Gated Check-in build

How to stop the release trigger on Gated check-in build which doesn;t produce any artifact?
I have a build definition with Gated check-in enabled. In Publish and Publish Artifact Steps I have set the condition as following:
ne(variables['Build.Reason'],'CheckInShelveset')
which means - if the build was triggered by Gated check-in, do not run this step.
I do not see any files in drop folder of this build run but the release is being triggered as soon the gated build completes running.
I've added images for reference purposes.
Image 1 shows the configuration of build definition.
Image 2 shows the "publish" steps are not running as it's a gated build.
Image 3 shows the release being triggered from the same build even when there is nothing in drop (output) folder!
This is very surprising to me. Any help?
Thanks!
There is an option on the first environment where you can set an Artifact filter, enter Include TriggerRelease:
By tagging your build (in case it's not a gated check-in), you can prevent the release from triggering. You can run a small magic log command to set the tag in the build:
Write-Host "##vso[build.addbuildtag]TriggerRelease"
Or you can use a build task from the following extension to have a build tag itself:

Openshift Jenkins build pending until it fails after long inactivity

I'm trying to make sure that all tests complete before making a deployment. For this I have enabled Jenkins for my app. I can run builds successfully from git push and from Jenkins UI if myapp-bldr node is up and running, however if I try to run a build after a period of inactivity (basically wait for myapp-bldr to go down and free up a gear in my account), Jenkins build fails with below details:
> rhc app-deploy HEAD --app myapp
Deployment of git ref 'HEAD' in progress for application myapp ...
Executing Jenkins build.
You can track your build at https://jenkins-mydomain.rhcloud.com/job/myapp-build
Waiting for build to schedule............................................................................................
**BUILD FAILED/CANCELLED**
Please see the Jenkins log for more details via 'rhc tail'
!!!!!!!!
Deployment Halted!
If the build failed before the deploy step, your previous
build is still running. Otherwise, your application may be
partially deployed or inaccessible.
Fix the build and try again.
!!!!!!!!
An error occurred executing 'gear deploy' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control post-receive' for /var/lib/openshift/581e42c10c1e6666270001d8/jenkins-client
While Waiting for build to schedule... line is displayed in console, I can see build being queued in Jenkins UI, but since no builder nodes are available, it doesn't get picked up.
I'm guessing the issue is related to some timeout setting somewhere, but I can't tell for sure which one and whether I have the ability to tweak it.
I found this bug reported linking to the following pull request but I don't know if this is related and how to check if my app has the above config change applied to it.
I'm using "old" console (v2, not "NextGen" v3) with Jenkins ver. 1.642.2

How to prevent older builds from entering stage with concurrency 1

We've setup a Jenkins build pipeline that uses Maven to build a large project, including stages for update, compile, unit test and deploy (to Nexus). The "deploy to Nexus" stage has concurrency 1 to ensure that no more than one build is in this stage at any point in time. However, this setting does not prevent older builds from entering that stage after a later build has finished it.
For instance, if build #2 is startet after build #1 and hits a fast node, it may outrun build #1 and enter the "deploy to Nexus" stage first. Build #1 cannot enter this stage at the same time, so it waits until build #2 is finished; but then build #1 enters this stage and thus overrides the Maven artifacts deployed by the later build, which is not what you want.
There must be a way to avoid this, i.e. to prevent older builds from entering a stage that was already executed successfully by later builds. I just could not find a solution for this problem... Any thoughts?
The upcoming milestone step is supposed to solve this.
Send the current build number of the job and add a simple condition to test it with the latest successful build number of the job using the following Jenkins URL:
http://JenkinsMaster:Port/job/MyJob/lastSuccessfulBuild/buildNumber
If the current build number is smaller than the last successful one then skip the upload.
Good Luck!

Resources