VM-Operator/org.jdrupes.vmoperator.manager/build.gradle

131 lines
4.2 KiB
Groovy

/*
* This file was generated by the Gradle 'init' task.
*
* This project uses @Incubating APIs which are subject to change.
*/
plugins {
id 'org.jdrupes.vmoperator.java-application-conventions'
}
dependencies {
implementation project(':org.jdrupes.vmoperator.manager.events')
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'org.jgrapes:org.jgrapes.util:[1.38.1,2)'
implementation 'org.jgrapes:org.jgrapes.io:[2.12.1,3)'
implementation 'org.jgrapes:org.jgrapes.http:[3.5.0,4)'
implementation 'org.jgrapes:org.jgrapes.webconsole.base:[2.3.0,3)'
implementation 'org.jgrapes:org.jgrapes.webconsole.vuejs:[1.8.0,2)'
implementation 'org.jgrapes:org.jgrapes.webconsole.rbac:[1.4.0,2)'
implementation 'org.jgrapes:org.jgrapes.webconlet.oidclogin:[1.7.0,2)'
implementation 'org.jgrapes:org.jgrapes.webconlet.markdowndisplay:[1.2.0,2)'
runtimeOnly 'org.jgrapes:org.jgrapes.webconlet.sysinfo:[1.4.0,2)'
runtimeOnly 'org.jgrapes:org.jgrapes.webconlet.logviewer:[0.2.0,2)'
runtimeOnly 'com.electronwill.night-config:yaml:[3.6.7,3.7)'
runtimeOnly 'org.eclipse.angus:angus-activation:[1.0.0,2.0.0)'
runtimeOnly 'org.slf4j:slf4j-jdk14:[2.0.7,3)'
runtimeOnly 'org.apache.logging.log4j:log4j-to-jul:2.20.0'
runtimeOnly project(':org.jdrupes.vmoperator.vmmgmt')
runtimeOnly project(':org.jdrupes.vmoperator.vmaccess')
}
application {
applicationName = 'vm-manager'
applicationDefaultJvmArgs = ['-Xmx128m', '-XX:+UseParallelGC',
'-Djava.util.logging.manager=org.jdrupes.vmoperator.util.LongLoggingManager'
]
// Define the main class for the application.
mainClass = 'org.jdrupes.vmoperator.manager.Manager'
}
project.ext.gitBranch = grgit.branch.current.name.replace('/', '-')
def registry = "${project.rootProject.properties['docker.registry']}"
def rootVersion = rootProject.version
task buildImage(type: Exec) {
dependsOn installDist
inputs.files 'src/org/jdrupes/vmoperator/manager/Containerfile'
commandLine 'podman', 'build', '--pull',
'-t', "${project.name}:${project.gitBranch}",\
'-f', 'src/org/jdrupes/vmoperator/manager/Containerfile', '.'
}
task pushImage(type: Exec) {
dependsOn buildImage
// Don't push without testing first
dependsOn test
commandLine 'podman', 'push', '--tls-verify=false', \
"${project.name}:${project.gitBranch}", \
"${registry}/${project.name}:${project.gitBranch}"
}
task tagWithVersion(type: Exec) {
dependsOn pushImage
enabled = !rootVersion.contains("SNAPSHOT")
commandLine 'podman', 'push', \
"${project.name}:${project.gitBranch}",\
"${registry}/${project.name}:${project.version}"
}
task tagAsLatest(type: Exec) {
dependsOn tagWithVersion
enabled = !rootVersion.contains("SNAPSHOT")
&& !rootVersion.contains("alpha") \
&& !rootVersion.contains("beta") \
|| project.rootProject.properties['docker.testRegistry'] \
&& project.rootProject.properties['docker.registry'] \
== project.rootProject.properties['docker.testRegistry']
commandLine 'podman', 'push', \
"${project.name}:${project.gitBranch}",\
"${registry}/${project.name}:latest"
}
task publishImage {
dependsOn pushImage
dependsOn tagWithVersion
dependsOn tagAsLatest
}
task pushForTest(type: Exec) {
dependsOn buildImage
commandLine 'podman', 'push', '--tls-verify=false', \
"${project.name}:${project.gitBranch}", \
"${project.rootProject.properties['docker.testRegistry']}" \
+ "/${project.name}:test"
}
test {
enabled = project.hasProperty("k8s.testCluster")
if (enabled) {
dependsOn project.tasks["pushForTest"]
}
useJUnitPlatform()
testLogging {
showStandardStreams = true
}
systemProperty "k8s.testCluster", project.hasProperty("k8s.testCluster")
? project.getProperty("k8s.testCluster") : null
}
// Update favicon:
// # Convert with inkscape to png because convert cannot handle svg
// # background transparency, then
// convert VM-Operator.png -background transparent \
// -define icon:auto-resize=256,64,48,32,16 favicon.ico