1

Inside any Jenkins job, I have the button "Atom feed for all" at the bottom of the page. It gives an XML with details about the last 10 builds. I need to increase it somehow to get more than 10. Is it possible? Do I require admin user for that?

1 Answer 1

1

The behavior is hardcoded; you cannot change or configure it in vanilla Jenkins (you could conceivably configure this behavior by writing your own plugin). Specifically, the behavior is: as long as there are at least 10 completed builds in your job, the feed should always contain at least 10 builds. There will only be more than 10 builds in the feed if there have been more than 10 completed builds in the past 7 days.

From the source code, the rssAll page fetches all new builds using the newBuilds() method:

    public void doRssAll(StaplerRequest req, StaplerResponse rsp)
            throws IOException, ServletException {
        RSS.rss(req, rsp, "Jenkins:" + getDisplayName() + " (all builds)", getUrl(), getBuilds().newBuilds());
    }

and the newBuilds() method returns all completed builds from the past 7 days, or the 10 most recent builds if there are fewer than 10 builds in the past 7 days:

    /**
     * Reduce the size of the list by only leaving relatively new ones.
     * This also removes on-going builds, as RSS cannot be used to publish information
     * if it changes.
     * <em>Warning:</em> this method mutates the original list and then returns it.
     */
    public RunList<R> newBuilds() {
        GregorianCalendar cal = new GregorianCalendar();
        cal.add(Calendar.DAY_OF_YEAR, -7);
        final long t = cal.getTimeInMillis();

        // can't publish on-going builds
        return filter((Predicate<R>) r -> !r.isBuilding())
        // put at least 10 builds, but otherwise ignore old builds
        .limit(new CountingPredicate<R>() {
            @Override
            public boolean apply(int index, R r) {
                return index < 10 || r.getTimeInMillis() >= t;
            }
        });
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.