{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/comments/50522241","id":50522241,"diff_hunk":"@@ -55,57 +58,30 @@ public boolean isApplicable(Class<? extends Job> jobType) {\n \n         @Override\n         public void onFinalized(Run run) {\n-            File log = run.getLogFile();\n-            if (log.getName().endsWith(\".gz\")) {\n-                // ignore already compressed log\n-                LOGGER.log(Level.FINER, String.format(\"Skipping %s because the log is already compressed\", run));\n-                return;\n-            }\n \n             if (run.getParent().getProperty(BuildLogCompressor.class) == null) {\n                 LOGGER.log(Level.FINER, String.format(\"Skipping %s because the project is not configured to have compressed logs\", run));\n                 return;\n             }\n \n-            String gzippedLogName = log.getName() + \".gz\";\n-\n-            if (log.getName().equals(\"log\")) {\n-                LOGGER.log(Level.FINE, String.format(\"Compressing build log of %s\", run));\n-\n-                // regular, expected log file\n-                FileInputStream fis = null;\n-                FileOutputStream fos = null;\n-                GZIPOutputStream gzos = null;\n-\n-                try {\n-                    fis = new FileInputStream(log);\n-                    fos = new FileOutputStream(new File(log.getParentFile(), gzippedLogName));\n-                    gzos = new GZIPOutputStream(fos);\n-                    int copiedBytes = IOUtils.copy(fis, gzos);\n-\n-                    if (copiedBytes != log.length()) {\n-                        LOGGER.log(Level.WARNING, String.format(\"Expected to copy %d bytes but copied %d from %s\", copiedBytes, log.length(), log.getAbsolutePath()));\n-                    }\n-\n-                    gzos.finish();\n-                    LOGGER.log(Level.FINE, String.format(\"Finished compressing build log of %s\", run));\n-                } catch (IOException e) {\n-                    LOGGER.log(Level.WARNING, String.format(\"Failed to compress build log of %s to %s\", run, gzippedLogName));\n-                    return;\n-                } finally {\n-                    IOUtils.closeQuietly(fis);\n-                    IOUtils.closeQuietly(fos);\n-                    IOUtils.closeQuietly(gzos);\n-                }\n-\n-                // XXX try multiple times because Windows?\n-                if (!log.delete()) {\n-                    LOGGER.log(Level.WARNING, String.format(\"Failed to delete build log of %s after compression\", run));\n-                }\n+            Util.compressLogFile(run);\n+\n+            Plugin mvn = Jenkins.getInstance().getPlugin(\"maven-plugin\");\n+            if (mvn!= null) {\n+                // compress module logs, if this is a maven reactor build\n+                Class<?> c;\n+\t\t\t\ttry {","path":"src/main/java/org/jenkinsci/plugins/compressbuildlog/BuildLogCompressor.java","position":91,"original_position":91,"commit_id":"1d32578a4740006a396da1628afd911784b7382b","original_commit_id":"1d32578a4740006a396da1628afd911784b7382b","user":{"login":"daniel-beck","id":1831569,"avatar_url":"https://avatars.githubusercontent.com/u/1831569?v=3","gravatar_id":"","url":"https://api.github.com/users/daniel-beck","html_url":"https://github.com/daniel-beck","followers_url":"https://api.github.com/users/daniel-beck/followers","following_url":"https://api.github.com/users/daniel-beck/following{/other_user}","gists_url":"https://api.github.com/users/daniel-beck/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-beck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-beck/subscriptions","organizations_url":"https://api.github.com/users/daniel-beck/orgs","repos_url":"https://api.github.com/users/daniel-beck/repos","events_url":"https://api.github.com/users/daniel-beck/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-beck/received_events","type":"User","site_admin":false},"body":"Messy indentation.","created_at":"2016-01-22T10:28:35Z","updated_at":"2016-01-22T10:28:35Z","html_url":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2#discussion_r50522241","pull_request_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/comments/50522241"},"html":{"href":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2#discussion_r50522241"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2","id":48861521,"html_url":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2","diff_url":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2.diff","patch_url":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2.patch","issue_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/2","number":2,"state":"open","locked":false,"title":"Added compression for maven module build logs","user":{"login":"uweschaefer","id":546815,"avatar_url":"https://avatars.githubusercontent.com/u/546815?v=3","gravatar_id":"","url":"https://api.github.com/users/uweschaefer","html_url":"https://github.com/uweschaefer","followers_url":"https://api.github.com/users/uweschaefer/followers","following_url":"https://api.github.com/users/uweschaefer/following{/other_user}","gists_url":"https://api.github.com/users/uweschaefer/gists{/gist_id}","starred_url":"https://api.github.com/users/uweschaefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uweschaefer/subscriptions","organizations_url":"https://api.github.com/users/uweschaefer/orgs","repos_url":"https://api.github.com/users/uweschaefer/repos","events_url":"https://api.github.com/users/uweschaefer/events{/privacy}","received_events_url":"https://api.github.com/users/uweschaefer/received_events","type":"User","site_admin":false},"body":"We're making massive use of maven reactor builds and compression of the logs reduces the jenkins master's disk usage by about 50%. This however is only true if all the module logs are compressed as well, hence this pull-request.\r\n\r\nIn order to be able to detect maven-reactor builds, **i added a dependency to maven-plugin**. I guess this is not critical as maven plugin is part of the distribution of jenkins, right?\r\n\r\nPlease review this change, and let me know if i could change anything.","created_at":"2015-10-27T12:03:20Z","updated_at":"2016-01-22T10:28:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b02584411768954d7e6f6d24ce8db6bea73a176","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/2/comments","statuses_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/statuses/1d32578a4740006a396da1628afd911784b7382b","head":{"label":"uweschaefer:master","ref":"master","sha":"1d32578a4740006a396da1628afd911784b7382b","user":{"login":"uweschaefer","id":546815,"avatar_url":"https://avatars.githubusercontent.com/u/546815?v=3","gravatar_id":"","url":"https://api.github.com/users/uweschaefer","html_url":"https://github.com/uweschaefer","followers_url":"https://api.github.com/users/uweschaefer/followers","following_url":"https://api.github.com/users/uweschaefer/following{/other_user}","gists_url":"https://api.github.com/users/uweschaefer/gists{/gist_id}","starred_url":"https://api.github.com/users/uweschaefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uweschaefer/subscriptions","organizations_url":"https://api.github.com/users/uweschaefer/orgs","repos_url":"https://api.github.com/users/uweschaefer/repos","events_url":"https://api.github.com/users/uweschaefer/events{/privacy}","received_events_url":"https://api.github.com/users/uweschaefer/received_events","type":"User","site_admin":false},"repo":{"id":45037729,"name":"compress-buildlog-plugin","full_name":"uweschaefer/compress-buildlog-plugin","owner":{"login":"uweschaefer","id":546815,"avatar_url":"https://avatars.githubusercontent.com/u/546815?v=3","gravatar_id":"","url":"https://api.github.com/users/uweschaefer","html_url":"https://github.com/uweschaefer","followers_url":"https://api.github.com/users/uweschaefer/followers","following_url":"https://api.github.com/users/uweschaefer/following{/other_user}","gists_url":"https://api.github.com/users/uweschaefer/gists{/gist_id}","starred_url":"https://api.github.com/users/uweschaefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uweschaefer/subscriptions","organizations_url":"https://api.github.com/users/uweschaefer/orgs","repos_url":"https://api.github.com/users/uweschaefer/repos","events_url":"https://api.github.com/users/uweschaefer/events{/privacy}","received_events_url":"https://api.github.com/users/uweschaefer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uweschaefer/compress-buildlog-plugin","description":"Jenkins plugin to compress the log file after build completion (JENKINS-2551)","fork":true,"url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin","forks_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/forks","keys_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/teams","hooks_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/hooks","issue_events_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/events","assignees_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/tags","blobs_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/languages","stargazers_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/stargazers","contributors_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/contributors","subscribers_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/subscribers","subscription_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/subscription","commits_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/merges","archive_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/downloads","issues_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/labels{/name}","releases_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/uweschaefer/compress-buildlog-plugin/deployments","created_at":"2015-10-27T11:53:32Z","updated_at":"2015-10-27T11:53:32Z","pushed_at":"2015-10-27T14:58:24Z","git_url":"git://github.com/uweschaefer/compress-buildlog-plugin.git","ssh_url":"git@github.com:uweschaefer/compress-buildlog-plugin.git","clone_url":"https://github.com/uweschaefer/compress-buildlog-plugin.git","svn_url":"https://github.com/uweschaefer/compress-buildlog-plugin","homepage":"","size":90,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"5259dfe95906ba634ab138c397cbb96221ed7369","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":25171887,"name":"compress-buildlog-plugin","full_name":"jenkinsci/compress-buildlog-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/compress-buildlog-plugin","description":"Jenkins plugin to compress the log file after build completion (JENKINS-2551)","fork":true,"url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin","forks_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/deployments","created_at":"2014-10-13T18:30:54Z","updated_at":"2016-01-12T08:59:05Z","pushed_at":"2015-10-27T14:58:25Z","git_url":"git://github.com/jenkinsci/compress-buildlog-plugin.git","ssh_url":"git@github.com:jenkinsci/compress-buildlog-plugin.git","clone_url":"https://github.com/jenkinsci/compress-buildlog-plugin.git","svn_url":"https://github.com/jenkinsci/compress-buildlog-plugin","homepage":"","size":179,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2"},"html":{"href":"https://github.com/jenkinsci/compress-buildlog-plugin/pull/2"},"issue":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/2"},"comments":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/compress-buildlog-plugin/statuses/1d32578a4740006a396da1628afd911784b7382b"}}}}