Skip to content

Commit

Permalink
Set default file fingerprinting to true (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextu committed Apr 10, 2024
1 parent 80dcc0b commit 840cd9b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.google.common.base.Suppliers;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Util;
import hudson.model.Node;
import hudson.remoting.VirtualChannel;

Expand Down Expand Up @@ -109,10 +108,10 @@ private void injectEnvironmentVariables(InjectionConfig config, Node node) {
EnvUtil.removeEnvVar(node, InitScriptVariables.DEVELOCITY_ENFORCE_URL);
}

if (config.isGradleCaptureTaskInputFiles()) {
EnvUtil.setEnvVar(node, InitScriptVariables.DEVELOCITY_CAPTURE_TASK_INPUT_FILES, "true");
if (config.isGradleCaptureTaskInputFiles() == null || config.isGradleCaptureTaskInputFiles()) {
EnvUtil.setEnvVar(node, InitScriptVariables.DEVELOCITY_CAPTURE_FILE_FINGERPRINTS, "true");
} else {
EnvUtil.removeEnvVar(node, InitScriptVariables.DEVELOCITY_CAPTURE_TASK_INPUT_FILES);
EnvUtil.removeEnvVar(node, InitScriptVariables.DEVELOCITY_CAPTURE_FILE_FINGERPRINTS);
}

String pluginRepositoryUrl = config.getGradlePluginRepositoryUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum InitScriptVariables {
DEVELOCITY_URL("develocity.url"),
DEVELOCITY_ENFORCE_URL("develocity.enforce-url"),
DEVELOCITY_ALLOW_UNTRUSTED_SERVER("develocity.allow-untrusted-server"),
DEVELOCITY_CAPTURE_TASK_INPUT_FILES("develocity.capture-file-fingerprints"),
DEVELOCITY_CAPTURE_FILE_FINGERPRINTS("develocity.capture-file-fingerprints"),
DEVELOCITY_BUILD_SCAN_UPLOAD_IN_BACKGROUND("develocity.build-scan.upload-in-background"),
DEVELOCITY_TERMS_OF_USE_URL("develocity.terms-of-use.url"),
DEVELOCITY_TERMS_OF_USE_AGREE("develocity.terms-of-use.agree");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public class InjectionConfig extends GlobalConfiguration {
private Secret gradlePluginRepositoryPassword;
private ImmutableList<NodeLabelItem> gradleInjectionEnabledNodes;
private ImmutableList<NodeLabelItem> gradleInjectionDisabledNodes;
private boolean gradleCaptureTaskInputFiles;
private Boolean gradleCaptureTaskInputFiles;

private boolean injectMavenExtension;
private boolean injectCcudExtension;
private String mavenExtensionCustomCoordinates;
private String ccudExtensionCustomCoordinates;
private ImmutableList<NodeLabelItem> mavenInjectionEnabledNodes;
private ImmutableList<NodeLabelItem> mavenInjectionDisabledNodes;
private boolean mavenCaptureGoalInputFiles;
private Boolean mavenCaptureGoalInputFiles;

private boolean enforceUrl;
private boolean checkForBuildAgentErrors;
Expand Down Expand Up @@ -230,12 +230,12 @@ public void setGradleInjectionDisabledNodes(List<NodeLabelItem> gradleInjectionD
gradleInjectionDisabledNodes == null ? null : ImmutableList.copyOf(gradleInjectionDisabledNodes);
}

public boolean isGradleCaptureTaskInputFiles() {
public Boolean isGradleCaptureTaskInputFiles() {
return gradleCaptureTaskInputFiles;
}

@DataBoundSetter
public void setGradleCaptureTaskInputFiles(boolean gradleCaptureTaskInputFiles) {
public void setGradleCaptureTaskInputFiles(Boolean gradleCaptureTaskInputFiles) {
this.gradleCaptureTaskInputFiles = gradleCaptureTaskInputFiles;
}

Expand Down Expand Up @@ -299,12 +299,12 @@ public void setMavenInjectionDisabledNodes(List<NodeLabelItem> mavenInjectionDis
mavenInjectionDisabledNodes == null ? null : ImmutableList.copyOf(mavenInjectionDisabledNodes);
}

public boolean isMavenCaptureGoalInputFiles() {
public Boolean isMavenCaptureGoalInputFiles() {
return mavenCaptureGoalInputFiles;
}

@DataBoundSetter
public void setMavenCaptureGoalInputFiles(boolean mavenCaptureGoalInputFiles) {
public void setMavenCaptureGoalInputFiles(Boolean mavenCaptureGoalInputFiles) {
this.mavenCaptureGoalInputFiles = mavenCaptureGoalInputFiles;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -87,8 +88,9 @@ private void inject(InjectionConfig config, Node node, FilePath nodeRootPath) {
systemProperties.add(new SystemProperty(GRADLE_ENTERPRISE_ALLOW_UNTRUSTED_SERVER_PROPERTY_KEY, "true"));
}

systemProperties.add(new SystemProperty(DEVELOCITY_CAPTURE_FILE_FINGERPRINTS_PROPERTY_KEY, Boolean.toString(config.isMavenCaptureGoalInputFiles())));
systemProperties.add(new SystemProperty(GRADLE_ENTERPRISE_CAPTURE_GOAL_INPUT_FILES_PROPERTY_KEY, Boolean.toString(config.isMavenCaptureGoalInputFiles())));
String captureGoalInputFiles = Optional.ofNullable(config.isMavenCaptureGoalInputFiles()).map(b -> Boolean.toString(b)).orElse("true");
systemProperties.add(new SystemProperty(DEVELOCITY_CAPTURE_FILE_FINGERPRINTS_PROPERTY_KEY, captureGoalInputFiles));
systemProperties.add(new SystemProperty(GRADLE_ENTERPRISE_CAPTURE_GOAL_INPUT_FILES_PROPERTY_KEY, captureGoalInputFiles));

EnvUtil.setEnvVar(node, MavenOptsHandler.MAVEN_OPTS, MAVEN_OPTS_HANDLER.merge(node, systemProperties));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ class BuildScanInjectionGradleIntegrationTest extends BaseGradleIntegrationTest
get("DEVELOCITY_ENFORCE_URL") == null
get("GRADLE_PLUGIN_REPOSITORY_URL") == null
get("DEVELOCITY_CCUD_PLUGIN_VERSION") == null
get("DEVELOCITY_CAPTURE_TASK_INPUT_FILES") == null
get("DEVELOCITY_CAPTURE_FILE_FINGERPRINTS") == 'true'
}
}

Expand All @@ -710,7 +710,7 @@ class BuildScanInjectionGradleIntegrationTest extends BaseGradleIntegrationTest
get("DEVELOCITY_ENFORCE_URL") == null
get("GRADLE_PLUGIN_REPOSITORY_URL") == null
get("DEVELOCITY_CCUD_PLUGIN_VERSION") == null
get("DEVELOCITY_CAPTURE_TASK_INPUT_FILES") == null
get("DEVELOCITY_CAPTURE_FILE_FINGERPRINTS") == null
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ class InjectionConfigTest extends BaseJenkinsIntegrationTest {
<label>gradle2</label>
</hudson.plugins.gradle.injection.NodeLabelItem>
</gradleInjectionDisabledNodes>
<gradleCaptureTaskInputFiles>false</gradleCaptureTaskInputFiles>
<injectMavenExtension>true</injectMavenExtension>
<injectCcudExtension>true</injectCcudExtension>
<mavenInjectionEnabledNodes>
Expand All @@ -286,7 +285,6 @@ class InjectionConfigTest extends BaseJenkinsIntegrationTest {
<label>maven2</label>
</hudson.plugins.gradle.injection.NodeLabelItem>
</mavenInjectionDisabledNodes>
<mavenCaptureGoalInputFiles>false</mavenCaptureGoalInputFiles>
<enforceUrl>false</enforceUrl>
<checkForBuildAgentErrors>false</checkForBuildAgentErrors>
<parsedVcsRepositoryFilter>
Expand Down

0 comments on commit 840cd9b

Please sign in to comment.