add install BinariesC4k.kt

This commit is contained in:
ansgarz 2022-02-25 09:46:30 +01:00
parent 32e4c04175
commit baf9e19c86
5 changed files with 74 additions and 3 deletions

View file

@ -91,7 +91,7 @@ fun Prov.provisionWorkplace(
installRedshift() installRedshift()
configureRedshift() configureRedshift()
installProvsBinaries() installBinariesProvs()
} }
if (desktopType == DesktopType.IDE) { if (desktopType == DesktopType.IDE) {
@ -129,7 +129,7 @@ fun Prov.provisionWorkplaceSubmodules(
) = task { ) = task {
if (submodules.contains(DesktopSubmodule.PROVSBINARIES.name.lowercase())) { if (submodules.contains(DesktopSubmodule.PROVSBINARIES.name.lowercase())) {
aptInstall("jarwrapper") aptInstall("jarwrapper")
installProvsBinaries() installBinariesProvs()
} }
ProvResult(true) ProvResult(true)
} }

View file

@ -0,0 +1,26 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
fun Prov.installBinariesC4k() = task {
// check for latest stable release on: https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/releases
// release 1.0.2
val jobId = "1824231745"
val installationPath = " /usr/local/bin/"
val fileName = "c4k-nextcloud-standalone.jar"
val c4kNextcloudSha256sum = "5b7eeecf745c720184be4fccdd61a49509ae5e322558506eb6bc3c3ed680c23f"
createDirs(installationPath, sudo = true)
downloadFromURL(
"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/$jobId/artifacts/raw/target/uberjar/$fileName",
path = installationPath,
filename = fileName,
sha256sum = c4kNextcloudSha256sum,
sudo = true
)
cmd("chmod 755 $installationPath$fileName", sudo = true)
}

View file

@ -5,7 +5,7 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.creat
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
fun Prov.installProvsBinaries() = task { fun Prov.installBinariesProvs() = task {
// check for latest stable release on: https://gitlab.com/domaindrivenarchitecture/provs/-/releases // check for latest stable release on: https://gitlab.com/domaindrivenarchitecture/provs/-/releases
// release 0.9.6 // release 0.9.6
val jobId = "2083873496" val jobId = "2083873496"
@ -30,4 +30,7 @@ fun Prov.installProvsBinaries() = task {
sha256sum = provsDesktopSha256sum, sha256sum = provsDesktopSha256sum,
sudo = true sudo = true
) )
cmd("chmod 755 /usr/local/bin/provs-server.jar" , sudo = true)
cmd("chmod 755 /usr/local/bin/provs-desktop.jar", sudo = true)
} }

View file

@ -0,0 +1,19 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileExists
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
internal class BinariesC4kKtTest {
@ContainerTest
fun downloadC4kBinaries() {
// when
val res = defaultTestContainer().installBinariesC4k()
// then
assertTrue(res.success)
assertTrue(defaultTestContainer().fileExists(" /usr/local/bin/c4k-nextcloud-standalone.jar", sudo = true))
}
}

View file

@ -0,0 +1,23 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileExists
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
import org.junit.jupiter.api.Assertions.assertTrue
internal class BinariesProvsKtTest {
@ContainerTest
fun installBinariesProvs() {
// given
val prov = defaultTestContainer()
// when
val res = prov.installBinariesProvs()
// then
assertTrue(res.success)
assertTrue(defaultTestContainer().fileExists(" /usr/local/bin/provs-server.jar", sudo = true))
assertTrue(defaultTestContainer().fileExists(" /usr/local/bin/provs-desktop.jar", sudo = true))
}
}