Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Gradle Enterprise to Develocity #382

Merged
merged 10 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions README.adoc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public void setGradleEnterpriseServerUrl(URI server) {
}

public void clickEnforceUrl() {
clickCheckboxOnConfig("Enforce Gradle Enterprise server url");
clickCheckboxOnConfig("Enforce Develocity server url");
}

public void clickAllowUntrustedServer() {
clickCheckboxOnConfig("Allow untrusted server");
}

public void clickCheckForGradleEnterpriseErrors() {
clickCheckboxOnConfig("Check for the Gradle Enterprise build agent errors");
clickCheckboxOnConfig("Check for the Develocity build agent errors");
}

public void setGradleEnterpriseAccessKey(String accessKey) {
Expand All @@ -73,7 +73,7 @@ public String getGitRepositoryFilters() {
}

public void clickInjectMavenExtension() {
clickCheckboxOnConfig("Enable Gradle Enterprise Maven extension auto-injection");
clickCheckboxOnConfig("Enable Develocity Maven extension auto-injection");
}

private void setBuildScansInjectionFormValue(String field, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public void checkForGradleEnterpriseErrors() {
// single build has the error
build.open();
assertThat(build.find(By.cssSelector(".alert")).getText(),
containsString("Gradle Enterprise Gradle plugin errors detected. Please check the logs for details."));
containsString("Develocity Gradle plugin errors detected. Please check the logs for details."));

jenkins.action(GeErrorPage.class)
.canClickActionButton()
.hasRowForBuild(build);
}

@ActionPageObject("gradle_enterprise")
@ActionPageObject("develocity")
public static class GeErrorPage extends Action {

public GeErrorPage(ContainerPageObject parent, String relative) {
Expand All @@ -74,7 +74,7 @@ public boolean isApplicable(ContainerPageObject po) {
public GeErrorPage canClickActionButton() {
// Go to home page
parent.open();
String label = "Gradle Enterprise";
String label = "Develocity";
find(By.linkText(label)).click();
waitFor(by.xpath("//h1[normalize-space(text()) = '%s']", label));
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public void setEnforceUrlPublishesBuildScan() throws Exception {

// then
build.shouldSucceed();
assertBuildScanPublished(build, false, String.format("Enforcing Gradle Enterprise: %s, allowUntrustedServer: true", mockGeServer.getAddress().toString()));
assertBuildScanPublished(build, false, String.format("Enforcing Develocity: %s, allowUntrustedServer: true", mockGeServer.getAddress().toString()));

MockGeServer.ScanTokenRequest scanTokenRequest = mockGeServer.getLastScanTokenRequest();
assertThat(scanTokenRequest, notNullValue());
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ dependencies {

// Higher versions fail in our tests with ClassNotFoundException during SCM initialization unless Jenkins is updated
"optionalPluginImplementation"("org.jenkins-ci.plugins:git:4.9.4") {
because("VCS repositories filtering is supported for Gradle Enterprise auto-injection")
because("VCS repositories filtering is supported for Develocity auto-injection")
}

implementation("commons-validator:commons-validator:1.8.0") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

@Component(
role = GradleEnterpriseListener.class,
hint = "gradle-enterprise-configurer"
hint = "develocity-configurer"
)
public class GradleEnterpriseConfigurerListener implements GradleEnterpriseListener {
public class DevelocityConfigurerListener implements GradleEnterpriseListener {

private static final Logger LOGGER = LoggerFactory.getLogger(GradleEnterpriseConfigurerListener.class);
private static final Logger LOGGER = LoggerFactory.getLogger(DevelocityConfigurerListener.class);

// Have to be in sync with what is set in MavenBuildScanInjection
private static final String JENKINSGRADLEPLUGIN_MAVEN_PLUGIN_CONFIG_SERVER_URL = "JENKINSGRADLEPLUGIN_MAVEN_PLUGIN_CONFIG_SERVER_URL";
Expand All @@ -22,7 +22,7 @@ public class GradleEnterpriseConfigurerListener implements GradleEnterpriseListe
@Override
public void configure(GradleEnterpriseApi api, MavenSession session) {
if (api.getServer() != null) {
LOGGER.debug("Gradle Enterprise server is already configured");
LOGGER.debug("Develocity server is already configured");
return;
}

Expand All @@ -33,13 +33,13 @@ public void configure(GradleEnterpriseApi api, MavenSession session) {
}

api.setServer(server);
LOGGER.debug("Gradle Enterprise server URL is set to: {}", server);
LOGGER.debug("Develocity server URL is set to: {}", server);

api.getBuildScan().setUploadInBackground(false);

if (Boolean.parseBoolean(System.getenv(JENKINSGRADLEPLUGIN_MAVEN_PLUGIN_CONFIG_ALLOW_UNTRUSTED_SERVER))) {
api.setAllowUntrustedServer(true);
LOGGER.debug("Allow communication with a Gradle Enterprise server using an untrusted SSL certificate");
LOGGER.debug("Allow communication with a Develocity server using an untrusted SSL certificate");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<components>
<component>
<role>com.gradle.maven.extension.api.GradleEnterpriseListener</role>
<role-hint>gradle-enterprise-configurer</role-hint>
<implementation>com.gradle.jenkins.maven.extension.internal.GradleEnterpriseConfigurerListener</implementation>
<role-hint>develocity-configurer</role-hint>
<implementation>com.gradle.jenkins.maven.extension.internal.DevelocityConfigurerListener</implementation>
<isolated-realm>false</isolated-realm>
</component>
</components>
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Binary file modified images/enable-auto-injection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/enriched-build-scans-configuration.png
welandaz marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gradle-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/maven-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</Match>

<Match>
<Class name="hudson.plugins.gradle.injection.GradleEnterpriseExceptionTaskListenerDecoratorFactory$GradleEnterpriseExceptionTaskListenerDecorator"/>
<Class name="hudson.plugins.gradle.injection.DevelocityExceptionTaskListenerDecoratorFactory$DevelocityExceptionTaskListenerDecorator"/>
<Field name="run"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/hudson/plugins/gradle/DevelocityLogger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package hudson.plugins.gradle;

import hudson.model.TaskListener;

public final class DevelocityLogger extends AbstractLogger {

public DevelocityLogger(TaskListener listener) {
super("Develocity", listener);
}
}
10 changes: 0 additions & 10 deletions src/main/java/hudson/plugins/gradle/GradleEnterpriseLogger.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import hudson.model.PasswordParameterValue;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.plugins.gradle.GradleEnterpriseLogger;
import hudson.plugins.gradle.DevelocityLogger;
import hudson.util.Secret;

import javax.annotation.Nonnull;
Expand All @@ -33,37 +33,37 @@ public void buildEnvironmentFor(@Nonnull Run run, @Nonnull EnvVars envs, @Nonnul
return;
}

run.addAction(GradleEnterpriseParametersAction.of(new GradleEnterpriseLogger(listener), secretKey, secretPassword));
run.addAction(DevelocityParametersAction.of(new DevelocityLogger(listener), secretKey, secretPassword));
}

private static boolean alreadyExecuted(@Nonnull Run run) {
return run.getAction(GradleEnterpriseParametersAction.class) != null;
return run.getAction(DevelocityParametersAction.class) != null;
}

public static class GradleEnterpriseParametersAction extends ParametersAction {
public static class DevelocityParametersAction extends ParametersAction {

private static final String GRADLE_ENTERPRISE_ACCESS_KEY = "GRADLE_ENTERPRISE_ACCESS_KEY";
private static final String GRADLE_ENTERPRISE_REPO_PASSWORD = JENKINSGRADLEPLUGIN_GRADLE_PLUGIN_REPOSITORY_PASSWORD;

private static final GradleEnterpriseParametersAction EMPTY = new GradleEnterpriseParametersAction();
private static final DevelocityParametersAction EMPTY = new DevelocityParametersAction();

GradleEnterpriseParametersAction(List<ParameterValue> parameters, Collection<String> additionalSafeParameters) {
DevelocityParametersAction(List<ParameterValue> parameters, Collection<String> additionalSafeParameters) {
super(parameters, additionalSafeParameters);
}

GradleEnterpriseParametersAction() {
DevelocityParametersAction() {
super(Collections.emptyList());
}

static GradleEnterpriseParametersAction empty() {
static DevelocityParametersAction empty() {
return EMPTY;
}

static GradleEnterpriseParametersAction of(GradleEnterpriseLogger logger, @Nullable Secret accessKey, @Nullable Secret repoPassword) {
static DevelocityParametersAction of(DevelocityLogger logger, @Nullable Secret accessKey, @Nullable Secret repoPassword) {
List<ParameterValue> values = new ArrayList<>();
if (accessKey != null) {
if (!GradleEnterpriseAccessKeyValidator.getInstance().isValid(accessKey.getPlainText())) {
logger.error("Gradle Enterprise access key format is not valid");
if (!DevelocityAccessKeyValidator.getInstance().isValid(accessKey.getPlainText())) {
logger.error("Develocity access key format is not valid");
} else {
values.add(new PasswordParameterValue(GRADLE_ENTERPRISE_ACCESS_KEY, accessKey.getPlainText()));
}
Expand All @@ -72,9 +72,9 @@ static GradleEnterpriseParametersAction of(GradleEnterpriseLogger logger, @Nulla
values.add(new PasswordParameterValue(GRADLE_ENTERPRISE_REPO_PASSWORD, repoPassword.getPlainText()));
}
if (values.isEmpty()) {
return GradleEnterpriseParametersAction.empty();
return DevelocityParametersAction.empty();
}
return new GradleEnterpriseParametersAction(
return new DevelocityParametersAction(
values,
Stream.of(GRADLE_ENTERPRISE_ACCESS_KEY, GRADLE_ENTERPRISE_REPO_PASSWORD).collect(Collectors.toSet())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.google.common.base.Strings;

public final class GradleEnterpriseAccessKeyValidator implements Validator<String> {
public final class DevelocityAccessKeyValidator implements Validator<String> {

private static final GradleEnterpriseAccessKeyValidator INSTANCE = new GradleEnterpriseAccessKeyValidator();
private static final DevelocityAccessKeyValidator INSTANCE = new DevelocityAccessKeyValidator();

private GradleEnterpriseAccessKeyValidator() {
private DevelocityAccessKeyValidator() {
}

public static GradleEnterpriseAccessKeyValidator getInstance() {
public static DevelocityAccessKeyValidator getInstance() {
return INSTANCE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
* @see InjectionConfig
*/
@Extension
public class GradleEnterpriseComputerListener extends ComputerListener {
public class DevelocityComputerListener extends ComputerListener {

private static final Logger LOGGER = Logger.getLogger(GradleEnterpriseComputerListener.class.getName());
private static final Logger LOGGER = Logger.getLogger(DevelocityComputerListener.class.getName());

private final GradleEnterpriseInjector injector;
private final DevelocityInjector injector;
private final Supplier<InjectionConfig> injectionConfigSupplier;

public GradleEnterpriseComputerListener() {
this(new GradleEnterpriseInjector(), new JenkinsInjectionConfig());
public DevelocityComputerListener() {
this(new DevelocityInjector(), new JenkinsInjectionConfig());
}

@VisibleForTesting
GradleEnterpriseComputerListener(GradleEnterpriseInjector injector,
Supplier<InjectionConfig> injectionConfigSupplier) {
DevelocityComputerListener(DevelocityInjector injector,
Supplier<InjectionConfig> injectionConfigSupplier) {
this.injector = injector;
this.injectionConfigSupplier = injectionConfigSupplier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
import java.util.stream.Stream;

@Extension
public class GradleEnterpriseErrorsAction implements RootAction, StaplerProxy {
public class DevelocityErrorsAction implements RootAction, StaplerProxy {
@Override
public String getIconFileName() {
return isVisible() && Jenkins.get().hasPermission(Jenkins.ADMINISTER) ? "/plugin/gradle/images/svgs/gradle-build-scan.svg" : null;
}

@Override
public String getDisplayName() {
return "Gradle Enterprise";
return "Develocity";
}

@Override
public String getUrlName() {
return "gradle_enterprise";
return "develocity";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import hudson.plugins.gradle.BuildToolType;

public interface GradleEnterpriseExceptionDetector {
public interface DevelocityExceptionDetector {

BuildToolType getBuildToolType();

boolean detect(String line);

final class ByPrefix implements GradleEnterpriseExceptionDetector {
final class ByPrefix implements DevelocityExceptionDetector {

private final BuildToolType buildToolType;
private final String prefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

@SuppressWarnings("unused")
@Extension
public class GradleEnterpriseExceptionLogFilter extends ConsoleLogFilter implements Serializable {
public class DevelocityExceptionLogFilter extends ConsoleLogFilter implements Serializable {

@Override
public OutputStream decorateLogger(Run build, OutputStream logger) {
InjectionConfig injectionConfig = InjectionConfig.get();
if (injectionConfig.isEnabled() && injectionConfig.isCheckForBuildAgentErrors() && build != null) {
return new GradleEnterpriseExceptionLogProcessor(logger, build);
return new DevelocityExceptionLogProcessor(logger, build);
}
return logger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public final class GradleEnterpriseExceptionLogProcessor extends AbstractGradleLogProcessor {
public final class DevelocityExceptionLogProcessor extends AbstractGradleLogProcessor {

private static final GradleEnterpriseExceptionDetector[] DETECTORS =
private static final DevelocityExceptionDetector[] DETECTORS =
{
new GradleEnterpriseExceptionDetector.ByPrefix(
new DevelocityExceptionDetector.ByPrefix(
BuildToolType.GRADLE,
"Internal error in Gradle Enterprise Gradle plugin:"
),
new GradleEnterpriseExceptionDetector.ByPrefix(
new DevelocityExceptionDetector.ByPrefix(
BuildToolType.MAVEN,
"[ERROR] Internal error in Gradle Enterprise Maven extension:"
)
};

private final BuildAgentErrorListener listener;

public GradleEnterpriseExceptionLogProcessor(OutputStream out, @Nullable Run<?, ?> build) {
public DevelocityExceptionLogProcessor(OutputStream out, @Nullable Run<?, ?> build) {
this(out, build != null ? build.getCharset() : StandardCharsets.UTF_8, build);
}

public GradleEnterpriseExceptionLogProcessor(OutputStream out, Charset charset, Actionable actionable) {
public DevelocityExceptionLogProcessor(OutputStream out, Charset charset, Actionable actionable) {
super(out, charset);
this.listener = new DefaultBuildAgentErrorListener(actionable);
}

@Override
protected void processLogLine(String line) {
line = ConsoleNote.removeNotes(line);
for (GradleEnterpriseExceptionDetector detector : DETECTORS) {
for (DevelocityExceptionDetector detector : DETECTORS) {
if (detector.detect(line)) {
BuildAgentError buildAgentError = new BuildAgentError(detector.getBuildToolType());
listener.onBuildAgentError(buildAgentError);
Expand Down
Loading