Jenkins : How to retain builds forever

--

In Jenkins, you can retain builds indefinitely by configuring the “Keep this build forever” option for your job or pipeline. By default, Jenkins keeps a limited number of builds, and older builds are automatically deleted to save disk space. To retain a build forever, follow these steps:

If you want to have this option active using code in pipeline, then you can add one stage for the script option.

With these settings in place, Jenkins will not automatically discard or delete old builds, and they will be retained indefinitely unless you manually delete them or change the build settings in the future.

Keep in mind that retaining a large number of builds indefinitely can consume a significant amount of disk space, so be cautious when configuring this option and ensure that you have sufficient storage capacity available for your Jenkins server.

--

--