diff --git a/build.gradle b/build.gradle index 03dffaf..6d6d5b1 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ apply plugin: 'kotlinx-serialization' group = 'org.domaindrivenarchitecture.provs' -version = '0.9.9-SNAPSHOT' +version = 'release-0.9.9' repositories { mavenCentral() diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt index 0fc414e..277e013 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/DesktopService.kt @@ -1,7 +1,6 @@ package org.domaindrivenarchitecture.provs.desktop.domain import org.domaindrivenarchitecture.provs.desktop.infrastructure.* -import org.domaindrivenarchitecture.provs.desktop.infrastructure.getConfig import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.ubuntu.git.provisionGit @@ -129,7 +128,11 @@ fun Prov.provisionWorkplaceSubmodules( ) = task { if (submodules.contains(DesktopSubmodule.PROVSBINARIES.name.lowercase())) { aptInstall("jarwrapper") - installBinariesProvs() + installBinariesProvs(true) + } + if (submodules.contains(DesktopSubmodule.C4KBINARIES.name.lowercase())) { + aptInstall("jarwrapper") + installBinariesC4k(true) } ProvResult(true) } \ No newline at end of file diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/Submodule.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/Submodule.kt index 3d65cbf..df645cc 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/Submodule.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/domain/Submodule.kt @@ -1,5 +1,5 @@ package org.domaindrivenarchitecture.provs.desktop.domain enum class DesktopSubmodule { - PROVSBINARIES + PROVSBINARIES, C4KBINARIES } diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesC4k.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesC4k.kt index c6d6d4b..94cda73 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesC4k.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesC4k.kt @@ -5,37 +5,51 @@ import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL -fun Prov.installBinariesC4k() = task { +fun Prov.installBinariesC4k(reprovision: Boolean = false) = task { val installationPath = " /usr/local/bin/" createDirs(installationPath, sudo = true) - class Binary(val jobId: String, val fileName: String, val sha256sum: String) - - fun downloadC4k(bin : Binary) { - with(bin) { - downloadFromURL( - "https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${jobId}/artifacts/raw/target/uberjar/${fileName}", - path = installationPath, - filename = fileName, - sha256sum = sha256sum, - sudo = true - ) - cmd("chmod 755 $installationPath$fileName", sudo = true) - } - + fun Prov.downloadC4k(jobId: String, c4kName: String, sha256sum: String) = task { + val fileName = "$c4kName-standalone.jar" + downloadFromURL( + "https://gitlab.com/domaindrivenarchitecture/$c4kName/-/jobs/${jobId}/artifacts/raw/target/uberjar/${fileName}", + path = installationPath, + filename = fileName, + sha256sum = sha256sum, + sudo = true, + overwrite = reprovision + ) + // remark: chmod fails if file could not be downloaded (e.g. due to wrong link or checksum) + cmd("chmod 755 $installationPath$fileName", sudo = true) } - downloadC4k(Binary("2138015489", "c4k-nextcloud-standalone.jar", - "47b6f71664903816eab0e4950d4ab0d564ea365ddb2b9c2a7bcb2736a2d941cb")) - downloadC4k(Binary("2136806347", "c4k-jira-standalone.jar", - "585f26e3b70bec32f052f488688718d8c9a6d15222b8a2141a69fa1bea136179")) - downloadC4k(Binary("2136561868", "c4k-keycloak-standalone.jar", - "81bd605b160c3d339cba745433271412eaa716cb7856d0227a1eb063badc9")) - downloadC4k(Binary("2136778473", "c4k-mastodon-bot-standalone.jar", - "9dbf981ce8b4aea92e0f45b182a39d2caffceb6e8f78ddfeeb49e74ca4a8d37d")) - downloadC4k(Binary("2136801572", "c4k-shynet-standalone.jar", - "4fa0d41896f2a9ea89ca70c475f9d1f89edf3fadf82d6b39789b90732f795429")) + + downloadC4k( + "2138015489", + "c4k-nextcloud", + "47b6f71664903816eab0e4950d4ab0d564ea365ddb2b9c2a7bcb2736a2d941cb" + ) + downloadC4k( + "2136806347", + "c4k-jira", + "585f26e3b70bec32f052f488688718d8c9a6d15222b8a2141a69fa1bea136179" + ) + downloadC4k( + "2136561868", + "c4k-keycloak", + "81bd605b160c3d339cba745433271412eaa716cb7856d0227a1eb063badc9d9c" + ) + downloadC4k( + "2136778473", + "c4k-mastodon-bot", + "9dbf981ce8b4aea92e0f45b182a39d2caffceb6e8f78ddfeeb49e74ca4a8d37d" + ) + downloadC4k( + "2136801572", + "c4k-shynet", + "4fa0d41896f2a9ea89ca70c475f9d1f89edf3fadf82d6b39789b90732f795429" + ) ProvResult(true) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesProvs.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesProvs.kt index 41f2264..ba58c26 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesProvs.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/desktop/infrastructure/BinariesProvs.kt @@ -5,7 +5,7 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.creat import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL -fun Prov.installBinariesProvs() = task { +fun Prov.installBinariesProvs(reprovision: Boolean = false) = task { // check for latest stable release on: https://gitlab.com/domaindrivenarchitecture/provs/-/releases // release 0.9.8 val jobId = "2137287031" @@ -15,22 +15,23 @@ fun Prov.installBinariesProvs() = task { createDirs(installationPath, sudo = true) - downloadFromURL( - "https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/$jobId/artifacts/raw/build/libs/provs-server.jar", - path = installationPath, - filename = "provs-server.jar", - sha256sum = provsServerSha256sum, - sudo = true - ) - downloadFromURL( "https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/$jobId/artifacts/raw/build/libs/provs-desktop.jar", path = installationPath, filename = "provs-desktop.jar", sha256sum = provsDesktopSha256sum, - sudo = true + sudo = true, + overwrite = reprovision ) + cmd("chmod 755 /usr/local/bin/provs-desktop.jar", sudo = true) + downloadFromURL( + "https://gitlab.com/domaindrivenarchitecture/provs/-/jobs/$jobId/artifacts/raw/build/libs/provs-server.jar", + path = installationPath, + filename = "provs-server.jar", + sha256sum = provsServerSha256sum, + sudo = true, + overwrite = reprovision + ) cmd("chmod 755 /usr/local/bin/provs-server.jar" , sudo = true) - cmd("chmod 755 /usr/local/bin/provs-desktop.jar", sudo = true) }