Skip to content

Conversation

@ThyRex
Copy link

@ThyRex ThyRex commented Jul 11, 2018

See JENKINS-51229.

Proposed changelog entries

  • Add parameters to LogRotator to configure the deletion of logs in parallel with builds and artifacts.

Submitter checklist

  • JIRA issue is well described
  • Changelog entry appropriate for the audience affected by the change (users or developer, depending on the change). Examples
    * Use the Internal: prefix if the change has no user-visible impact (API, test frameworks, etc.)
  • Appropriate autotests or explanation to why this change has no tests
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@oleg-nenashev

@daniel-beck daniel-beck added the needs-more-reviews Complex change, which would benefit from more eyes label Jul 12, 2018
@daniel-beck
Copy link
Member

I'm not sure about this one, but cannot put my finger on exactly why. The implementation looks sound.

Is removal of logs, frequently considered essential, something we should encourage by options in the out of the box UI? Or should we rather encourage use of e.g. compress-buildlog and other ways to handle logs that become too large?

Regarding this being a potential breaking change: Are we confident nothing breaks if there's no log file? Would it perhaps be better to replace the file contents with a message that said that (and perhaps when) the log was removed?

@daniel-beck
Copy link
Member

@jenkinsci/code-reviewers I think more feedback here would be useful.

File rootDir = getRootDir();
LOGGER.log(FINE, "{0}: {1} logs successfully deleted", new Object[] { this, rootDir });
synchronized (this) {
Util.deleteFile(getLogFile());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes an assumption that the logs are stored on the disk.
Some plugins like Logstash plugin do not actually do that, especially if there is External Logging implementation like jenkinsci/logstash-plugin#18 in place

Not a big problem for this PR as long as the method is overridable.
But it would great to ensure it does not blow up if the log file does not exist


@DataBoundConstructor
public LogRotator (String daysToKeepStr, String numToKeepStr, String artifactDaysToKeepStr, String artifactNumToKeepStr) {
public LogRotator (String daysToKeepStr, String numToKeepStr, String artifactDaysToKeepStr, String artifactNumToKeepStr, String logDaysToKeepStr, String logNumToKeepStr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 this method is a part of public API, so this change breaks binary compatibility. The original method should be retained OR you could use @DataBoundSetters

@oleg-nenashev
Copy link
Member

@ThyRex I like the idea, but we need to ensure it is binary compatible. Making sure that it does not blow up on missing file is also important IMHO

@oleg-nenashev oleg-nenashev added the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Jul 14, 2018
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend closing this PR and just creating a plugin with this option, as

  • I do not see the functionality as being broadly desirable: there is little value in a build record with no log. (Whereas it is perfectly normal to not care about artifacts from old builds.) There seems to be no compelling reason to make Jenkins core more complicated for this, when an extension point already exists for fine-tuning build cleanup behavior.
  • There is already work underway to switch log storage to an external (cloud) service, which would undercut the principal motivation for deleting log files to begin with: saving disk space on $JENKINS_HOME.

@ThyRex ThyRex closed this Jul 19, 2018
@oleg-nenashev
Copy link
Member

@ThyRex Thanks for the contribution anyway. Likely I will integrate the API in #3557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging needs-more-reviews Complex change, which would benefit from more eyes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants