Skip to content

Commit

Permalink
Remove spotless - it has been a net productivity loss overall
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann authored and jsenko committed Jan 31, 2025
1 parent 67eb40b commit f795209
Show file tree
Hide file tree
Showing 31 changed files with 3 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
- name: Build Registry
run: |
cd registry
./mvnw clean package -am --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5 -Dspotless.check.skip=true
./mvnw clean package -am --no-transfer-progress -Pprod -DskipTests=true -DskipCommitIdPlugin=false -Dmaven.wagon.httpconnectionManager.maxTotal=30 -Dmaven.wagon.http.retryHandler.count=5
- name: Build Registry UI
working-directory: registry/ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-maven-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
retry_wait_seconds: 120
command: |
cd registry
mvn deploy --batch-mode -Pprod -Prelease -DskipTests -Dspotless.check.skip=true --settings /home/runner/.m2/settings.xml
mvn deploy --batch-mode -Pprod -Prelease -DskipTests --settings /home/runner/.m2/settings.xml
- name: Slack Notification (Always)
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-sboms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Maven Install
run: |
cd registry
mvn install -Pprod -DskipTests -Dspotless.check.skip=true
mvn install -Pprod -DskipTests
- name: Generate Maven SBOMs
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static io.apicurio.registry.operator.resource.ActivationConditions.*;
import static io.apicurio.registry.operator.resource.ResourceKey.*;

// spotless:off
@ControllerConfiguration(
dependents = {
// ===== Registry App
Expand Down Expand Up @@ -77,7 +76,6 @@
)
}
)
// spotless:on
// TODO: When renaming, do not forget to update application.properties (until we have a test for this).
public class ApicurioRegistry3Reconciler implements Reconciler<ApicurioRegistry3>,
ErrorStatusHandler<ApicurioRegistry3>, Cleaner<ApicurioRegistry3> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,31 @@ private Configuration() {
}

public static String getAppImage() {
// spotless:off
return config.getOptionalValue("registry.app.image", String.class)
.or(() -> config.getOptionalValue("related.image.registry.app.image", String.class))
.orElseThrow(() -> new OperatorException("Required configuration option 'registry.app.image' is not set."));
// spotless:on
}

public static String getUIImage() {
// spotless:off
return config.getOptionalValue("registry.ui.image", String.class)
.or(() -> config.getOptionalValue("related.image.registry.ui.image", String.class))
.orElseThrow(() -> new OperatorException("Required configuration option 'registry.ui.image' is not set."));
// spotless:on
}

public static String getStudioUIImage() {
// spotless:off
return config.getOptionalValue("studio.ui.image", String.class)
.or(() -> config.getOptionalValue("related.image.studio.ui.image", String.class))
.orElseThrow(() -> new OperatorException("Required configuration option 'studio.ui.image' is not set."));
// spotless:on
}

public static String getRegistryVersion() {
// spotless:off
return config.getOptionalValue("registry.version", String.class)
.orElseThrow(() -> new OperatorException("Required configuration option 'registry.version' is not set."));
// spotless:on
}

public static String getDefaultBaseHost() {
// spotless:off
return config.getOptionalValue("apicurio.operator.default-base-host", String.class)
.map(v -> "." + v)
.orElse("");
// spotless:on
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class KafkaSqlTLS {
public static boolean configureKafkaSQLTLS(ApicurioRegistry3 primary, Deployment deployment,
String containerName, Map<String, EnvVar> env) {

// spotless:off
var keystore = new SecretKeyRefTool(getKafkaSqlTLSSpec(primary)
.map(KafkaSqlTLSSpec::getKeystoreSecretRef)
.orElse(null), "user.p12");
Expand All @@ -41,7 +40,6 @@ public static boolean configureKafkaSQLTLS(ApicurioRegistry3 primary, Deployment
var truststorePassword = new SecretKeyRefTool(getKafkaSqlTLSSpec(primary)
.map(KafkaSqlTLSSpec::getTruststorePasswordSecretRef)
.orElse(null), "ca.password");
// spotless:on

if (truststore.isValid() && truststorePassword.isValid() && keystore.isValid()
&& keystorePassword.isValid()) {
Expand All @@ -68,13 +66,11 @@ public static boolean configureKafkaSQLTLS(ApicurioRegistry3 primary, Deployment
}

private static Optional<KafkaSqlTLSSpec> getKafkaSqlTLSSpec(ApicurioRegistry3 primary) {
// spotless:off
return ofNullable(primary)
.map(ApicurioRegistry3::getSpec)
.map(ApicurioRegistry3Spec::getApp)
.map(AppSpec::getStorage)
.map(StorageSpec::getKafkasql)
.map(KafkaSqlSpec::getTls);
// spotless:on
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ public static class AppDeploymentDiscriminator extends LabelDiscriminator<Deploy
public static final ResourceDiscriminator<Deployment, ApicurioRegistry3> INSTANCE = new AppDeploymentDiscriminator();

public AppDeploymentDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_APP
));
// spotless:on
}
}

Expand All @@ -36,12 +34,10 @@ public static class AppServiceDiscriminator extends LabelDiscriminator<Service>
public static final ResourceDiscriminator<Service, ApicurioRegistry3> INSTANCE = new AppServiceDiscriminator();

public AppServiceDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_APP
));
// spotless:on
}
}

Expand All @@ -50,12 +46,10 @@ public static class AppIngressDiscriminator extends LabelDiscriminator<Ingress>
public static final ResourceDiscriminator<Ingress, ApicurioRegistry3> INSTANCE = new AppIngressDiscriminator();

public AppIngressDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_APP
));
// spotless:on
}
}

Expand All @@ -66,12 +60,10 @@ public static class UIDeploymentDiscriminator extends LabelDiscriminator<Deploym
public static final ResourceDiscriminator<Deployment, ApicurioRegistry3> INSTANCE = new UIDeploymentDiscriminator();

public UIDeploymentDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_UI
));
// spotless:on
}
}

Expand All @@ -80,12 +72,10 @@ public static class UIServiceDiscriminator extends LabelDiscriminator<Service> {
public static ResourceDiscriminator<Service, ApicurioRegistry3> INSTANCE = new UIServiceDiscriminator();

public UIServiceDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_UI
));
// spotless:on
}
}

Expand All @@ -94,12 +84,10 @@ public static class UIIngressDiscriminator extends LabelDiscriminator<Ingress> {
public static ResourceDiscriminator<Ingress, ApicurioRegistry3> INSTANCE = new UIIngressDiscriminator();

public UIIngressDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_UI
));
// spotless:on
}
}

Expand All @@ -110,12 +98,10 @@ public static class StudioUIDeploymentDiscriminator extends LabelDiscriminator<D
public static final ResourceDiscriminator<Deployment, ApicurioRegistry3> INSTANCE = new StudioUIDeploymentDiscriminator();

public StudioUIDeploymentDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_STUDIO_UI
));
// spotless:on
}
}

Expand All @@ -124,12 +110,10 @@ public static class StudioUIServiceDiscriminator extends LabelDiscriminator<Serv
public static ResourceDiscriminator<Service, ApicurioRegistry3> INSTANCE = new StudioUIServiceDiscriminator();

public StudioUIServiceDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_STUDIO_UI
));
// spotless:on
}
}

Expand All @@ -138,12 +122,10 @@ public static class StudioUIIngressDiscriminator extends LabelDiscriminator<Ingr
public static ResourceDiscriminator<Ingress, ApicurioRegistry3> INSTANCE = new StudioUIIngressDiscriminator();

public StudioUIIngressDiscriminator() {
// spotless:off
super(Map.of(
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", COMPONENT_STUDIO_UI
));
// spotless:on
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public Deployment getDefaultAppDeployment(ApicurioRegistry3 primary) {
.map(AppSpec::getPodTemplateSpec).orElse(null)); // TODO:
// Replicas
mergeDeploymentPodTemplateSpec(
// spotless:off
r.getSpec().getTemplate(),
REGISTRY_APP_CONTAINER_NAME,
Configuration.getAppImage(),
Expand All @@ -55,7 +54,6 @@ public Deployment getDefaultAppDeployment(ApicurioRegistry3 primary) {
new ProbeBuilder().withHttpGet(new HTTPGetActionBuilder().withPath("/health/live").withPort(new IntOrString(8080)).withScheme("HTTP").build()).build(),
Map.of("cpu", new Quantity("500m"), "memory", new Quantity("512Mi")),
Map.of("cpu", new Quantity("1"), "memory", new Quantity("1Gi"))
// spotless:on
);
addDefaultLabels(r.getMetadata().getLabels(), primary, COMPONENT_APP);
addSelectorLabels(r.getSpec().getSelector().getMatchLabels(), primary, COMPONENT_APP);
Expand All @@ -71,7 +69,6 @@ public Deployment getDefaultUIDeployment(ApicurioRegistry3 primary) {
.map(UiSpec::getPodTemplateSpec).orElse(null)); // TODO:
// Replicas
mergeDeploymentPodTemplateSpec(
// spotless:off
r.getSpec().getTemplate(),
REGISTRY_UI_CONTAINER_NAME,
Configuration.getUIImage(),
Expand All @@ -80,7 +77,6 @@ public Deployment getDefaultUIDeployment(ApicurioRegistry3 primary) {
new ProbeBuilder().withHttpGet(new HTTPGetActionBuilder().withPath("/config.js").withPort(new IntOrString(8080)).withScheme("HTTP").build()).build(),
Map.of("cpu", new Quantity("100m"), "memory", new Quantity("256Mi")),
Map.of("cpu", new Quantity("200m"), "memory", new Quantity("512Mi"))
// spotless:on
);
addDefaultLabels(r.getMetadata().getLabels(), primary, COMPONENT_UI);
addSelectorLabels(r.getSpec().getSelector().getMatchLabels(), primary, COMPONENT_UI);
Expand All @@ -96,7 +92,6 @@ public Deployment getDefaultStudioUIDeployment(ApicurioRegistry3 primary) {
.map(StudioUiSpec::getPodTemplateSpec).orElse(null)); // TODO:
// Replicas
mergeDeploymentPodTemplateSpec(
// spotless:off
r.getSpec().getTemplate(),
STUDIO_UI_CONTAINER_NAME,
Configuration.getStudioUIImage(),
Expand All @@ -105,7 +100,6 @@ public Deployment getDefaultStudioUIDeployment(ApicurioRegistry3 primary) {
new ProbeBuilder().withHttpGet(new HTTPGetActionBuilder().withPath("/config.js").withPort(new IntOrString(8080)).withScheme("HTTP").build()).build(),
Map.of("cpu", new Quantity("100m"), "memory", new Quantity("256Mi")),
Map.of("cpu", new Quantity("200m"), "memory", new Quantity("512Mi"))
// spotless:on
);
addDefaultLabels(r.getMetadata().getLabels(), primary, COMPONENT_STUDIO_UI);
addSelectorLabels(r.getSpec().getSelector().getMatchLabels(), primary, COMPONENT_STUDIO_UI);
Expand Down Expand Up @@ -135,7 +129,6 @@ private static Deployment initDefaultDeployment(ApicurioRegistry3 primary, Strin
* Merge default values for a Deployment into the target PTS (from spec).
*/
private static void mergeDeploymentPodTemplateSpec(
// spotless:off
PodTemplateSpec target,
String containerName,
String image,
Expand All @@ -144,7 +137,6 @@ private static void mergeDeploymentPodTemplateSpec(
Probe livenessProbe,
Map<String, Quantity> requests,
Map<String, Quantity> limits
// spotless:on
) {
if (target.getMetadata() == null) {
target.setMetadata(new ObjectMeta());
Expand Down Expand Up @@ -241,7 +233,6 @@ private <T extends HasMetadata> T getDefaultResource(ApicurioRegistry3 primary,
}

private void addDefaultLabels(Map<String, String> labels, ApicurioRegistry3 primary, String component) {
// spotless:off
labels.putAll(Map.of(
"app", primary.getMetadata().getName(),
"app.kubernetes.io/name", "apicurio-registry",
Expand All @@ -251,19 +242,16 @@ private void addDefaultLabels(Map<String, String> labels, ApicurioRegistry3 prim
"app.kubernetes.io/part-of", "apicurio-registry",
"app.kubernetes.io/managed-by", "apicurio-registry-operator"
));
// spotless:on
}

private void addSelectorLabels(Map<String, String> labels, ApicurioRegistry3 primary, String component) {
// spotless:off
labels.putAll(Map.of(
"app", primary.getMetadata().getName(),
"app.kubernetes.io/name", "apicurio-registry",
"app.kubernetes.io/component", component,
"app.kubernetes.io/instance", primary.getMetadata().getName(),
"app.kubernetes.io/part-of", "apicurio-registry"
));
// spotless:on
}

public static <T> T deserialize(String path, Class<T> klass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
@ToString(onlyExplicitlyIncluded = true)
public class ResourceKey<R> {

// spotless:off
public static final String REGISTRY_ID = "ApicurioRegistry3Reconciler";

public static final String APP_DEPLOYMENT_ID = "AppDeploymentResource";
Expand Down Expand Up @@ -93,7 +92,6 @@ public class ResourceKey<R> {
StudioUIIngressDiscriminator.INSTANCE, ResourceFactory.INSTANCE::getDefaultStudioUIIngress
);

// spotless:on

@EqualsAndHashCode.Include
@ToString.Include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@
import static java.util.Objects.requireNonNull;
import static java.util.Optional.ofNullable;

// spotless:off
@KubernetesDependent(
labelSelector = "app.kubernetes.io/name=apicurio-registry,app.kubernetes.io/component=" + COMPONENT_APP,
resourceDiscriminator = AppDeploymentDiscriminator.class
)
// spotless:on
public class AppDeploymentResource extends CRUDKubernetesDependentResource<Deployment, ApicurioRegistry3> {

private static final Logger log = LoggerFactory.getLogger(AppDeploymentResource.class);
Expand All @@ -58,7 +56,6 @@ protected Deployment desired(ApicurioRegistry3 primary, Context<ApicurioRegistry
ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getApp).map(AppSpec::getEnv)
.ifPresent(env -> env.forEach(e -> envVars.put(e.getName(), e)));

// spotless:off
addEnvVar(envVars, new EnvVarBuilder().withName(EnvironmentVariables.QUARKUS_PROFILE).withValue("prod").build());
addEnvVar(envVars, new EnvVarBuilder().withName(EnvironmentVariables.QUARKUS_HTTP_ACCESS_LOG_ENABLED).withValue("true").build());

Expand Down Expand Up @@ -86,8 +83,6 @@ protected Deployment desired(ApicurioRegistry3 primary, Context<ApicurioRegistry
.withValue("true").build());
});

// spotless:on

// Configure the storage (Postgresql or KafkaSql).
ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getApp).map(AppSpec::getStorage)
.map(StorageSpec::getType).ifPresent(storageType -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
import static io.apicurio.registry.operator.utils.IngressUtils.withIngressRule;
import static io.apicurio.registry.operator.utils.Mapper.toYAML;

// spotless:off
@KubernetesDependent(
labelSelector = "app.kubernetes.io/name=apicurio-registry,app.kubernetes.io/component=" + COMPONENT_APP,
resourceDiscriminator = AppIngressDiscriminator.class
)
// spotless:on
public class AppIngressResource extends CRUDKubernetesDependentResource<Ingress, ApicurioRegistry3> {

private static final Logger log = LoggerFactory.getLogger(AppIngressResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
import static io.apicurio.registry.operator.resource.ResourceKey.APP_SERVICE_KEY;
import static io.apicurio.registry.operator.utils.Mapper.toYAML;

// spotless:off
@KubernetesDependent(
labelSelector = "app.kubernetes.io/name=apicurio-registry,app.kubernetes.io/component=" + COMPONENT_APP,
resourceDiscriminator = AppServiceDiscriminator.class
)
// spotless:on
public class AppServiceResource extends CRUDKubernetesDependentResource<Service, ApicurioRegistry3> {

private static final Logger log = LoggerFactory.getLogger(AppServiceResource.class);
Expand Down
Loading

0 comments on commit f795209

Please sign in to comment.