Skip to content

Commit 0f1bb70

Browse files
pr comments fix
1 parent e14e42c commit 0f1bb70

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/main/java/com/cloudbees/jenkins/support/SupportAction.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public void doGenerateAllBundles(StaplerRequest2 req, StaplerResponse2 rsp) thro
348348
* @throws IOException If an input or output exception occurs
349349
*/
350350
@RequirePOST
351-
public HttpRedirect doGenerateAllBundleAsync(StaplerRequest2 req, StaplerResponse2 rsp)
351+
public HttpRedirect doGenerateBundleAsync(StaplerRequest2 req, StaplerResponse2 rsp)
352352
throws ServletException, IOException {
353353
JSONObject json = req.getSubmittedForm();
354354
if (!json.has("components")) {
@@ -374,7 +374,7 @@ public HttpRedirect doGenerateAllBundleAsync(StaplerRequest2 req, StaplerRespons
374374
SupportPlugin.setRequesterAuthentication(Jenkins.getAuthentication2());
375375
try {
376376
try (ACLContext ignored = ACL.as2(ACL.SYSTEM2)) {
377-
SupportPlugin.writeBundle(fileOutputStream, components);
377+
SupportPlugin.writeBundle(fileOutputStream, syncComponent);
378378
} catch (IOException e) {
379379
logger.log(Level.WARNING, e.getMessage(), e);
380380
}
@@ -552,8 +552,17 @@ protected void compute() throws Exception {
552552
}
553553

554554
try (FileOutputStream fileOutputStream = new FileOutputStream(new File(outputDir, supportBundleName))) {
555-
SupportPlugin.writeBundle(
556-
fileOutputStream, components, this::progress, Path.of(outputDir.getAbsolutePath()));
555+
SupportPlugin.setRequesterAuthentication(Jenkins.getAuthentication2());
556+
try {
557+
try (ACLContext ignored = ACL.as2(ACL.SYSTEM2)) {
558+
SupportPlugin.writeBundle(
559+
fileOutputStream, components, this::progress, Path.of(outputDir.getAbsolutePath()));
560+
} catch (IOException e) {
561+
logger.log(Level.FINE, e.getMessage(), e);
562+
}
563+
} finally {
564+
SupportPlugin.clearRequesterAuthentication();
565+
}
557566
} finally {
558567
logger.fine("Processing support bundle async completed");
559568
}

src/main/java/com/cloudbees/jenkins/support/SupportPlugin.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,7 @@ public static void writeBundle(
490490
}
491491

492492
// process for async components
493-
if (!components.stream()
494-
.filter(c -> !c.canBeGeneratedAsync())
495-
.toList()
496-
.isEmpty()
497-
&& outputPath != null) {
493+
if (outputPath != null) {
498494
try {
499495
File zipFile = outputPath.resolve(SYNC_SUPPORT_BUNDLE).toFile();
500496
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile))) {

src/main/resources/com/cloudbees/jenkins/support/SupportAction/index.jelly

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<a href="${rootURL}/configureSecurity">global security</a> under <i>Support Bundle Anonymization</i>.
5151
</p>
5252
</j:if>
53-
<f:form name="bundle-contents" method="POST" action="generateAllBundleAsync">
53+
<f:form name="bundle-contents" method="POST" action="generateBundleAsync">
5454
<j:forEach var="category" items="${it.categorizedComponents.entrySet()}">
5555
<section class="jenkins-section jenkins-section__bottom-padding">
5656
<h2 class="jenkins-section__title">${category.key.label}</h2>

0 commit comments

Comments
 (0)