Skip to content

Commit

Permalink
Merge pull request #3755 from mercedes-benz/feature-3754-fix-daui-fat…
Browse files Browse the repository at this point in the history
…-jar-problem

Fix DAUI fat jar problem #3754
  • Loading branch information
sven-dmlr authored Dec 18, 2024
2 parents cbe6c59 + eb1027e commit 5b0f941
Show file tree
Hide file tree
Showing 20 changed files with 208 additions and 142 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
4 changes: 2 additions & 2 deletions .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 Expand Up @@ -330,7 +330,7 @@ jobs:
mkdir server-release-artifacts
# Collect release artifacts
cp sechub-server/build/libs/sechub-server-${{ inputs.server-version }}.jar \
sechub-developertools/build/libs/sechub-developer-admin-ui-${{ inputs.server-version }}.jar \
sechub-developertools/build/libs/sechub-developertools-${{ inputs.server-version }}.jar \
server-release-artifacts/
cp sechub-doc/build/docs/asciidoc/sechub-architecture.pdf \
server-release-artifacts/sechub-architecture-${{ inputs.server-version }}.pdf
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
45 changes: 18 additions & 27 deletions sechub-developertools/scripts/launch-developer-admin-ui
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash

# This the base template suitable for having a standalone running integrationtest admin ui.
# Howto use when manually created:
# - copy this script to a dedicated folder (X)
# - define system properties and/or environment entries as necessary
# - call ./gradlew buildDeveloperAdminUI
# - copy build/libs/sechub-developer-admin-ui-0.0.0.jar to the folder (X)
# - ensure script is executable and you have a java >=8 available on your system
# - call the script and you are done
#
#

DAUI_VERSION="0.0.0"
# This the base template suitable for having a standalone running SecHub admin ui.
# The sechub-developertools-x.y.z.jar can be downloaded
# from the latest SecHub server release on github.com.
# Alternatively the jar file can be created manually:
# - call ./gradlew :sechub-developertools:bootJar
# - the created file is: build/libs/sechub-developertools-0.0.0.jar
#
# Use:
# - copy this script to a dedicated folder and make it executable: chmod a+x
# - edit the copied script and define your system properties below
# - copy sechub-developertools-x.y.z.jar to the folder
# - call the script and the SecHub Developer Admin UI will open

export SECHUB_ADMIN_USERID=int-test_superadmin # your admin user id
export SECHUB_ADMIN_APITOKEN=int-test_superadmin-pwd
Expand All @@ -26,26 +26,17 @@ export SECHUB_ENABLE_INTEGRATION_TESTSERVER_MENU=true
export SECHUB_DISABLE_CONFIRMATIONS=true
export SECHUB_CHECK_STATUS_ON_STARTUP=false

export SECHUB_ADMIN_ENVIRONMENT=localhost #Use : localhost, no color. Dedicated menu colors for: PROD, INT or TESTxyz
export SECHUB_ADMIN_ENVIRONMENT="localhost" # Use : "localhost", no color. Dedicated menu colors for: "PROD", "INT" or "TESTxyz"

export SECHUB_MASS_OPERATION_PARENTDIRECTORY=/home/$UID/.sechub/inttest/mass-operations #mass operation directory (containign csv files )
export SECHUB_TARGETFOLDER_FOR_SECHUB_CLIENT_SCAN="/home/$USER/.sechub/test-targetfolder1"
export SECHUB_MASS_OPERATION_PARENTDIRECTORY="$HOME/.sechub/inttest/mass-operations" # mass operation directory (containign csv files )
export SECHUB_TARGETFOLDER_FOR_SECHUB_CLIENT_SCAN="$HOME/.sechub/test-targetfolder1"

export SECHUB_PATH_TO_SECHUB_CLIENT_BINARY="/home/$USER/.local/bin/sechub"
export SECHUB_PATH_TO_SECHUB_CLIENT_BINARY="/usr/local/bin/sechub"
export SECHUB_TRUSTALL_DENIED=false; # change this for other environments!

# when next entry is set to true TRUSTALL is denied (currently only at go client)
echo "-------------------------------------------------------------"
echo "Starting DAUI $DAUI_VERSION (Developer Admin UI)"
echo "Starting SecHub Developer Admin UI"
echo "-------------------------------------------------------------"
echo "- SECHUB_TARGETFOLDER_FOR_SECHUB_CLIENT_SCAN:$SECHUB_TARGETFOLDER_FOR_SECHUB_CLIENT_SCAN"
echo "- SECHUB_PATH_TO_SECHUB_CLIENT_BINARY: $SECHUB_PATH_TO_SECHUB_CLIENT_BINARY"
java -jar sechub-developer-admin-ui-$DAUI_VERSION.jar

echo "Press any key to continue"
while [ true ] ; do
read -t 3 -n 1
if [ $? = 0 ] ; then
exit ;
fi
done
java -jar sechub-developertools-*.jar
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 5b0f941

Please sign in to comment.