Liquibase shell script for Rollback 90/142290/3
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 20 Oct 2025 13:46:35 +0000 (14:46 +0100)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 21 Oct 2025 11:49:42 +0000 (12:49 +0100)
- add picocli needed for liquibase cli
- add a liquibase shell script to the docker image
- copy liquibase changelogs to the docker image

Issue-ID: POLICY-5451
Change-Id: Ic7a53149a597c4a37de9c3f3fd9908a864453e9e
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
packages/policy-clamp-tarball/pom.xml
packages/policy-clamp-tarball/src/main/package/tarball/assembly.xml
packages/policy-clamp-tarball/src/main/resources/bin/liquibase.sh [new file with mode: 0644]
runtime-acm/pom.xml

index 8e78b54..de895ce 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-liquibase-changelogs</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/liquibase</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.basedir}/../../runtime-acm/src/main/resources/db/changelog</directory>
+                                    <filtering>false</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-assembly-plugin</artifactId>
index 598c0cb..8b7d1ba 100644 (file)
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
     <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/src/main/resources/bin
+            </directory>
+            <includes>
+                <include>*.sh</include>
+            </includes>
+            <outputDirectory>${file.separator}bin</outputDirectory>
+            <lineEnding>unix</lineEnding>
+            <fileMode>0555</fileMode>
+        </fileSet>
         <fileSet>
             <directory>${project.basedir}/src/main/resources/etc
             </directory>
             <outputDirectory>${file.separator}etc${file.separator}ssl</outputDirectory>
             <lineEnding>keep</lineEnding>
         </fileSet>
+        <fileSet>
+            <directory>${project.build.directory}/liquibase</directory>
+            <includes>
+                <include>*.yaml</include>
+            </includes>
+            <outputDirectory>${file.separator}etc${file.separator}liquibase${file.separator}db${file.separator}changelog</outputDirectory>
+            <lineEnding>unix</lineEnding>
+        </fileSet>
     </fileSets>
 </assembly>
diff --git a/packages/policy-clamp-tarball/src/main/resources/bin/liquibase.sh b/packages/policy-clamp-tarball/src/main/resources/bin/liquibase.sh
new file mode 100644 (file)
index 0000000..aa03d5b
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+set -eux
+JAVA_TOOL_OPTIONS='' java -cp /app/app.jar \
+  -Dloader.main=liquibase.integration.commandline.LiquibaseCommandLine \
+  org.springframework.boot.loader.launch.PropertiesLauncher \
+  --show-banner=false \
+  --search-path=/opt/app/policy/clamp/etc/liquibase \
+  --changelog-file=db/changelog/db.changelog-master.yaml \
+  "$@"
index fb98b0e..7e696ef 100644 (file)
             <groupId>org.liquibase</groupId>
             <artifactId>liquibase-core</artifactId>
         </dependency>
+        <dependency>
+            <groupId>info.picocli</groupId>
+            <artifactId>picocli</artifactId>
+            <version>4.7.7</version>
+        </dependency>
         <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>