Hi, I have come across a peculiar issue where I am trying to rebuild a failed build. The origin build failed due to a setup failure which is normal to me. The Jenkins log:
Started by upstream project “daily-asic-setup-sum” build number 1269
originally caused by: Started by user xxxx
java.lang.NullPointerException Finished: FAILURE
Please let me know if you need any other informations.
It seems like the original build failed due to a NullPointerException, which is a Java exception that occurs when the code tries to access an object or variable that is null.
To rebuild a failed build in Jenkins, you can follow these steps:
Go to the Jenkins dashboard and find the failed build that you want to rebuild.
Click on the failed build to open its details page.
On the left side of the page, you should see a menu. Click on the “Rebuild” option.
In the “Rebuild” page, you can choose to rebuild the failed build with the same parameters, or modify the parameters if needed. Click on “Rebuild with Parameters” to proceed.
Jenkins should start a new build with the same configuration as the failed build. If the issue that caused the original build to fail is fixed, the new build should complete successfully.
However, in your case, the error message suggests that the problem is with the code itself rather than the build configuration. You may need to fix the code that caused the NullPointerException before attempting to rebuild the build. You can check the build log to see if there are any clues about what part of the code is causing the problem. Once you have identified and fixed the problem, you can proceed with rebuilding the build as described above.
Thanks for your reply.
I can confirm my code has no issue. The real situation is I got the NullPointerException when I tried to rebuild the "failed build" with the same parameters. However, it still works if I tried to run build with parameters or rebuild a successful build with exactly the same parameters, the same Jenkinsfile.
This pipeline is to set up the SSD card for the agent itself, so it is normal that this pipeline fails sometimes. So what I mean the "failed build" here is a kind of normal fail instead of the pipeline code issues.