Skip to content

Commit

Permalink
Fix DAUI fat jar problem #3754
Browse files Browse the repository at this point in the history
- introduced DAUI as Spring Boot Application
- removed old custom gradle tasks to build the DAUI
- updated documentation
- removed every usage of buildDeveloperAdminUI
  • Loading branch information
de-jcup committed Dec 17, 2024
1 parent 31eb09b commit b8a2f78
Show file tree
Hide file tree
Showing 19 changed files with 189 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: ./gradlew :sechub-cli:buildGo :sechub-cli:testGo

- name: Build Server, DAUI and generate OpenAPI file
run: ./gradlew ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-cli:build
run: ./gradlew ensureLocalhostCertificate build generateOpenapi -x :sechub-cli:build

- name: Generate and build Java projects related to SecHub Java API
run: ./gradlew :sechub-api-java:build :sechub-systemtest:build :sechub-pds-tools:buildPDSToolsCLI -Dsechub.build.stage=api-necessary
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-client-server-pds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
# Build SecHub Server + PDS
# ----------------------
- name: Build Server and PDS artifacts
run: ./gradlew ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-cli:build
run: ./gradlew ensureLocalhostCertificate build generateOpenapi -x :sechub-cli:build

# ----------------------
# Build API Java publish
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pds-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
# Build SecHub PDS-Tools
# ----------------------
- name: Build Server, DAUI and generate OpenAPI file
run: ./gradlew ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-integrationtest:test -x :sechub-cli:build
run: ./gradlew ensureLocalhostCertificate build generateOpenapi -x :sechub-integrationtest:test -x :sechub-cli:build

- name: Generate and build Java projects related to SecHub Java API
run: ./gradlew :sechub-api-java:build :sechub-systemtest:build :sechub-pds-tools:buildPDSToolsCLI -Dsechub.build.stage=api-necessary
Expand Down
2 changes: 1 addition & 1 deletion continous-integration-multibranch-pipeline.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pipeline {
// We do NOT build sechub-integrationtest
// Reason: because we do NOT want to have the integration tests executed, otherwise gradle will not execute them
// on integration phase again (because nothing has changed, so gradle will cache the results which are ignored ...
callGradleWrapper("ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-cli:build -Psechub.test.wiremock.https_port=${env.SECHUB_TEST_WIREMOCK_HTTPS_PORT} -Psechub.test.wiremock.http_port=${env.SECHUB_TEST_WIREMOCK_HTTP_PORT} --console=plain")
callGradleWrapper("ensureLocalhostCertificate build generateOpenapi -x :sechub-cli:build -Psechub.test.wiremock.https_port=${env.SECHUB_TEST_WIREMOCK_HTTPS_PORT} -Psechub.test.wiremock.http_port=${env.SECHUB_TEST_WIREMOCK_HTTP_PORT} --console=plain")
callGradleWrapper(":sechub-api-java:build :sechub-systemtest:build :sechub-pds-tools:buildPDSToolsCLI -Dsechub.build.stage=api-necessary --console=plain")
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/sechub-developer-quickstart-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ <h3 id="run-integration-tests-from-intellij-ide">5.2. Run Integration Tests From
</div>
<div class="listingblock">
<div class="content">
<pre>./gradlew ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-cli:build</pre>
<pre>./gradlew ensureLocalhostCertificate build generateOpenapi -x :sechub-cli:build</pre>
</div>
</div>
<div class="listingblock">
Expand Down
5 changes: 4 additions & 1 deletion gradle/projects.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ projectType = [
project(':sechub-wrapper-secretvalidation'),

/* archUnit */
project(':sechub-archunit-test')
project(':sechub-archunit-test'),

/* developerTools */
project(':sechub-developertools') // to have DAUI available by build and a working fat jar provided by spring boot
],

/* adapter projects - have simple spring dependencies, but know only sechub-adapter as base */
Expand Down
2 changes: 1 addition & 1 deletion release-pipeline.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pipeline {
* Reason: because we do NOT want to have the integration tests executed, otherwise gradle will not execute them
* on integration phase again (because nothing has changed, so gradle will cache the results which are ignored ...
*/
callGradleWrapper("ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-integrationtest:test -x :sechub-cli:build -Psechub.test.wiremock.https_port=${env.SECHUB_TEST_WIREMOCK_HTTPS_PORT} -Psechub.test.wiremock.http_port=${env.SECHUB_TEST_WIREMOCK_HTTP_PORT}")
callGradleWrapper("ensureLocalhostCertificate build generateOpenapi -x :sechub-integrationtest:test -x :sechub-cli:build -Psechub.test.wiremock.https_port=${env.SECHUB_TEST_WIREMOCK_HTTPS_PORT} -Psechub.test.wiremock.http_port=${env.SECHUB_TEST_WIREMOCK_HTTP_PORT}")
callGradleWrapper(":sechub-api-java:build :sechub-systemtest:build :sechub-pds-tools:buildPDSToolsCLI -Dsechub.build.stage=api-necessary")
}
}
Expand Down
50 changes: 50 additions & 0 deletions sechub-developertools/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: MIT
:toc:

== About
`sechub-developertools` is a gradle subprojects
only containing tools for SecHub development. It is not intended to be used in production.

WARNING: No other gradle submodule shall have this project as a dependency!


== Content

=== DAUI
The Developer Administration UI (DAUI) is a simple quick and dirty administration client which will reuse parts
from `sechub-integration--test` (for example REST api access, URL building).

Every single feature we implement, is available at this simple UI from the beginning.
It is extreme simple to extend.

[TIP]
====
Look into
`/sechub-developertools/src/main/java/com/mercedesbenz/sechub/developertools/admin/ui/action/job/GetJobStatusAction.java`
for an example how you can simply implement a feature.
====

===== Build
Inside sechub root folder execute:

[source, bash]
----
./gradlew :sechub-developertools:bootJar
----

This will build
`/sechub-developertools/build/libs/sechub-developertools-0.0.0.jar`


===== Start
[source, bash]
----
export SECHUB_ADMIN_APITOKEN=int-test_superadmin-pwd
export SECHUB_ADMIN_ENVIRONMENT=localhost
export SECHUB_ADMIN_USERID=int-test_superadmin
export SECHUB_ADMIN_SERVER=localhost
export SECHUB_ADMIN_SERVER_PORT=8443
java -jar ./sechub-developertools/build/libs/sechub-developertools-0.0.0.jar
----

13 changes: 0 additions & 13 deletions sechub-developertools/README.md

This file was deleted.

41 changes: 2 additions & 39 deletions sechub-developertools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/
plugins {
id 'java-library'
id 'org.springframework.boot' apply true
}

dependencies {

implementation project(':sechub-testframework')
Expand All @@ -23,48 +25,9 @@ dependencies {

}

task startIntegrationTestAdminUI(type: JavaExec){

group 'sechub'
description 'Starts developer admin ui ready to use with for a server started by gradle task <startIntegrationTestServer>'

classpath = sourceSets.main.runtimeClasspath

mainClass = 'com.mercedesbenz.sechub.developertools.admin.ui.DeveloperAdministrationUI'

jvmArgs = ['-Dsechub.developertools.admin.integrationtestserver=true',
'-Dsechub.developertools.admin.server=localhost',
'-Dsechub.developertools.admin.serverport=8443',
'-Dsechub.developertools.admin.userid=int-test_superadmin',
'-Dsechub.developertools.admin.apitoken=int-test_superadmin-pwd']

}

task buildDeveloperAdminUI(type: Jar, dependsOn: build) {
group 'sechub'
description 'Builds the SecHub Developer Admin tool as standalone executable jar. Use launch-developer-admin-ui script to execute'
archiveBaseName = 'sechub-developer-admin-ui'
/* TODO: This is a 'dirty' fix for the standard archive entries limit of 64K. We should refactor this module to make it leaner */
zip64 = true

manifest {
attributes 'Main-Class': 'com.mercedesbenz.sechub.developertools.admin.ui.DeveloperAdministrationUI'
}

from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
with jar
}


task importEclipseProjectsNeedingOpenApiFile(type: Exec){
workingDir "$rootDir"
commandLine './gradlew', ':sechub-systemtest:cleanEclipse',':sechub-systemtest:eclipse', ':sechub-web-server:cleanEclipse',':sechub-web-server:eclipse', ':sechub-api-java:cleanEclipse',':sechub-api-java:eclipse', ':sechub-pds-tools:cleanEclipse',':sechub-pds-tools:eclipse',':sechub-examples:example-sechub-api-java:cleanEclipse',':sechub-examples:example-sechub-api-java:eclipse','-Dsechub.build.stage=all'

}

/*
Expand Down
2 changes: 1 addition & 1 deletion sechub-developertools/scripts/sdc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ if [[ "$FULL_BUILD" = "YES" ]]; then
./gradlew spotlessCheck :sechub-cli:buildGo :sechub-cli:testGo

step "Build Server, DAUI and generate OpenAPI file"
./gradlew ensureLocalhostCertificate build generateOpenapi buildDeveloperAdminUI -x :sechub-cli:build
./gradlew ensureLocalhostCertificate build generateOpenapi -x :sechub-cli:build

step "Generate and build Java projects related to SecHub Java API"
./gradlew :sechub-api-java:build :sechub-systemtest:build :sechub-pds-tools:buildPDSToolsCLI :sechub-web-server:build -Dsechub.build.stage=api-necessary
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.mercedesbenz.sechub.developertools;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication(exclude = RepositoryRestMvcAutoConfiguration.class) // we do not want to have automatic resources in HAL & co
public class DAUIApplication {

public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(DAUIApplication.class);
builder.headless(false);

builder.run(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.mercedesbenz.sechub.developertools;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.mercedesbenz.sechub.developertools.admin.ui.DeveloperAdministrationUI;

@Component
public class DAUICLIRunner implements CommandLineRunner {

@Override
public void run(String... args) throws Exception {
DeveloperAdministrationUI.main(args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ private void createIntegrationTestServerMenu() {

if (!ConfigurationSetup.isIntegrationTestServerMenuEnabled()) {
menu.setEnabled(false);
menu.setToolTipText("Not enabled, use \"-D" + ConfigurationSetup.SECHUB_ENABLE_INTEGRATION_TESTSERVER_MENU.getSystemPropertyid()
menu.setToolTipText("Not enabled, use \"-D" + ConfigurationSetup.SECHUB_ENABLE_INTEGRATION_TESTSERVER_MENU.getSystemPropertyId()
+ "=true\" to enable it and run an integration test server!");
return;
}
Expand Down
Loading

0 comments on commit b8a2f78

Please sign in to comment.