From 7388a031ddc3ffdca41120b107dd30feac755d88 Mon Sep 17 00:00:00 2001
From: Felix Reichenbach <felix.reichenbach@mgm-tp.com>
Date: Mon, 24 Mar 2025 12:47:35 +0100
Subject: [PATCH] OZG-7573 build forwarder as own image

---
 Jenkinsfile                                   |  3 ++
 enterprise-adapter/pom.xml                    |  4 ---
 fim-adapter/pom.xml                           |  4 ---
 formcycle-adapter/pom.xml                     |  4 ---
 forwarder/pom.xml                             | 26 ++++++++++++++++
 .../src/main/resources/application-local.yml  | 21 +++++++++++++
 forwarder/src/main/resources/application.yml  | 31 +++++++++++++++++++
 7 files changed, 81 insertions(+), 12 deletions(-)
 create mode 100644 forwarder/src/main/resources/application-local.yml
 create mode 100644 forwarder/src/main/resources/application.yml

diff --git a/Jenkinsfile b/Jenkinsfile
index 5ff66e125..b5e12d24f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -142,14 +142,17 @@ pipeline {
 
                     tagAndPushDockerImage('formcycle-adapter', IMAGE_TAG)
                     tagAndPushDockerImage('enterprise-adapter', IMAGE_TAG)
+                    tagAndPushDockerImage('forwarder', IMAGE_TAG)
 
                     if (env.BRANCH_NAME == 'main') {
                         tagAndPushDockerImage('formcycle-adapter', 'snapshot-latest')
                         tagAndPushDockerImage('enterprise-adapter', 'snapshot-latest')
+                        tagAndPushDockerImage('forwarder', 'snapshot-latest')
                     }
                     else if (env.BRANCH_NAME == 'release') {
                         tagAndPushDockerImage('formcycle-adapter', 'latest')
                         tagAndPushDockerImage('enterprise-adapter', 'latest')
+                        tagAndPushDockerImage('forwarder', 'latest')
                     }
                 }
             }
diff --git a/enterprise-adapter/pom.xml b/enterprise-adapter/pom.xml
index 9e3d45ca7..109660c3b 100644
--- a/enterprise-adapter/pom.xml
+++ b/enterprise-adapter/pom.xml
@@ -46,10 +46,6 @@
 			<groupId>de.ozgcloud.eingang</groupId>
 			<artifactId>common</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>de.ozgcloud.eingang</groupId>
-			<artifactId>forwarder</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>de.ozgcloud.eingang</groupId>
 			<artifactId>semantik-adapter</artifactId>
diff --git a/fim-adapter/pom.xml b/fim-adapter/pom.xml
index bac822463..e672e58fb 100644
--- a/fim-adapter/pom.xml
+++ b/fim-adapter/pom.xml
@@ -45,10 +45,6 @@
             <groupId>de.ozgcloud.eingang</groupId>
             <artifactId>semantik-adapter</artifactId>
         </dependency>
-        <dependency>
-            <groupId>de.ozgcloud.eingang</groupId>
-            <artifactId>forwarder</artifactId>
-        </dependency>
 
         <!--test -->
         <dependency>
diff --git a/formcycle-adapter/pom.xml b/formcycle-adapter/pom.xml
index 8c249502d..19cc12fb2 100644
--- a/formcycle-adapter/pom.xml
+++ b/formcycle-adapter/pom.xml
@@ -50,10 +50,6 @@
 
 	<dependencies>
 		<!-- OZG-Cloud -->
-		<dependency>
-			<groupId>de.ozgcloud.eingang</groupId>
-			<artifactId>forwarder</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>de.ozgcloud.vorgang</groupId>
 			<artifactId>vorgang-manager-utils</artifactId>
diff --git a/forwarder/pom.xml b/forwarder/pom.xml
index 4fabecd6a..afd9753ee 100644
--- a/forwarder/pom.xml
+++ b/forwarder/pom.xml
@@ -124,4 +124,30 @@
 			</plugin>
 		</plugins>
 	</build>
+
+	<profiles>
+		<profile>
+			<id>ci-build</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.springframework.boot</groupId>
+						<artifactId>spring-boot-maven-plugin</artifactId>
+						<configuration>
+							<mainClass>de.ozgcloud.eingang.formcycle.FormcycleAdapterApplication</mainClass>
+						</configuration>
+						<executions>
+							<execution>
+								<id>build-image</id>
+								<phase>install</phase>
+								<goals>
+									<goal>build-image-no-fork</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
 </project>
\ No newline at end of file
diff --git a/forwarder/src/main/resources/application-local.yml b/forwarder/src/main/resources/application-local.yml
new file mode 100644
index 000000000..1a493ac91
--- /dev/null
+++ b/forwarder/src/main/resources/application-local.yml
@@ -0,0 +1,21 @@
+logging:
+  config: classpath:log4j2-local.xml
+
+server:
+  port: 9293
+  error:
+    include-stacktrace: always
+    
+management:
+  server.port: 8084
+
+ozgcloud:
+  adapter:
+    targetVorgangManagerName: local
+    fallbackStrategy: DENY
+
+grpc:
+  client:
+    vorgang-manager-local:
+      address: static://127.0.0.1:9090
+      negotiationType: PLAINTEXT
diff --git a/forwarder/src/main/resources/application.yml b/forwarder/src/main/resources/application.yml
new file mode 100644
index 000000000..3a1d31c30
--- /dev/null
+++ b/forwarder/src/main/resources/application.yml
@@ -0,0 +1,31 @@
+logging:
+  level:
+    ROOT: WARN
+    '[de.ozgcloud]': INFO
+
+management:
+  server:
+    port: 8081
+  health:
+    livenessState:
+      enabled: true
+    readinessState:
+      enabled: true
+  endpoint:
+    health:
+      group:
+        exploratory:
+          include: livenessState,readinessState,ping
+          show-details: always
+      probes:
+        enabled: true
+    prometheus:
+      enabled: true
+  endpoints:
+    web:
+      exposure:
+        include: health,prometheus
+
+ozgcloud:
+  adapter:
+    routingStrategy: SINGLE
\ No newline at end of file
-- 
GitLab