Skip to content

Commit

Permalink
Merge pull request #4134 from nscuro/alpine-3.1.0
Browse files Browse the repository at this point in the history
Bump Alpine to 3.1.0 and adopt new framework features
  • Loading branch information
nscuro authored Sep 9, 2024
2 parents f6d9567 + f1f5d76 commit bc14aab
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>us.springett</groupId>
<artifactId>alpine-parent</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -734,7 +734,9 @@
<version>${plugin.jetty.version}</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
<!-- Disable classpath scanning. -->
<containerIncludeJarPattern>^$</containerIncludeJarPattern>
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
</webApp>
</configuration>
</plugin>
Expand Down Expand Up @@ -794,7 +796,9 @@
<version>${plugin.jetty.version}</version>
<configuration>
<webApp>
<contextPath>/</contextPath>
<!-- Disable classpath scanning. -->
<containerIncludeJarPattern>^$</containerIncludeJarPattern>
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
<overrideDescriptor>src/test/webapp/WEB-INF/h2-console-web.xml</overrideDescriptor>
</webApp>
</configuration>
Expand Down
2 changes: 2 additions & 0 deletions src/main/docker/logback-json.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

<appender name="JSON_STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>
Expand Down
1 change: 1 addition & 0 deletions src/main/docker/logback.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/.dependency-track/dependency-track.log</file>
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/org/dependencytrack/upgrade/v4120/v4120Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import alpine.common.logging.Logger;
import alpine.persistence.AlpineQueryManager;
import alpine.server.upgrade.AbstractUpgradeItem;
import alpine.server.util.DbUtil;
import org.dependencytrack.model.BomValidationMode;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import static org.dependencytrack.model.ConfigPropertyConstants.BOM_VALIDATION_MODE;

Expand All @@ -43,6 +45,7 @@ public String getSchemaVersion() {
public void executeUpgrade(final AlpineQueryManager qm, final Connection connection) throws Exception {
removeExperimentalBomUploadProcessingV2ConfigProperty(connection);
migrateBomValidationConfigProperty(connection);
extendTeamNameColumnMaxLength(connection);
}

private static void removeExperimentalBomUploadProcessingV2ConfigProperty(final Connection connection) throws SQLException {
Expand Down Expand Up @@ -143,4 +146,24 @@ private static void migrateBomValidationConfigProperty(final Connection connecti
}
}

private void extendTeamNameColumnMaxLength(final Connection connection) throws SQLException {
LOGGER.info("Extending max length of column TEAM.NAME to 255");

try (final Statement stmt = connection.createStatement()) {
if (DbUtil.isMssql()) {
stmt.executeUpdate("""
ALTER TABLE "TEAM" ALTER COLUMN "NAME" VARChAR(255) NOT NULL
""");
} else if (DbUtil.isMysql()) {
stmt.executeUpdate("""
ALTER TABLE "TEAM" MODIFY "NAME" VARCHAR(255) NOT NULL
""");
} else {
stmt.executeUpdate("""
ALTER TABLE "TEAM" ALTER COLUMN "NAME" TYPE VARCHAR(255)
""");
}
}
}

}
13 changes: 13 additions & 0 deletions src/main/webapp/WEB-INF/jetty-context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext">
<!-- Disable classpath scanning. -->
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>^$</Arg>
</Call>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>^$</Arg>
</Call>
</Configure>
1 change: 1 addition & 0 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
metadata-complete="true"
version="6.0">

<listener>
Expand Down

0 comments on commit bc14aab

Please sign in to comment.