remove install binaries

This commit is contained in:
ansgarz 2022-04-18 17:12:49 +02:00
parent 436a6fa2c8
commit 7eb7494fad
9 changed files with 2 additions and 200 deletions

View file

@ -18,7 +18,7 @@ apply plugin: "kotlinx-serialization"
group = "org.domaindrivenarchitecture.provs" group = "org.domaindrivenarchitecture.provs"
version = "0.10.2-release" version = "0.10.2-SNAPSHOT"
repositories { repositories {
mavenCentral() mavenCentral()

View file

@ -44,17 +44,10 @@ open class CliArgumentsParser(name: String) : CliTargetParser(name) {
"c", "c",
"the filename containing the yaml config", "the filename containing the yaml config",
) )
val only by option(
ArgType.String,
"only",
"o",
"provisions only parts (currently possible: provsbinaries)",
)
override fun execute() { override fun execute() {
configFileName = cliConfigFileName?.let { ConfigFileName(it) } configFileName = cliConfigFileName?.let { ConfigFileName(it) }
parsed = true parsed = true
submodules = only?.split(",")
} }
} }

View file

@ -17,11 +17,7 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami
fun provisionDesktop(prov: Prov, cmd: DesktopCliCommand) { fun provisionDesktop(prov: Prov, cmd: DesktopCliCommand) {
// retrieve config // retrieve config
val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig() val conf = if (cmd.configFile != null) getConfig(cmd.configFile.fileName) else DesktopConfig()
if (cmd.submodules == null) {
prov.provisionWorkplace(cmd.type, conf.ssh?.keyPair(), conf.gpg?.keyPair(), conf.gitUserName, conf.gitEmail) prov.provisionWorkplace(cmd.type, conf.ssh?.keyPair(), conf.gpg?.keyPair(), conf.gitUserName, conf.gitEmail)
} else {
prov.provisionWorkplaceSubmodules(cmd.submodules)
}
} }
@ -90,9 +86,6 @@ fun Prov.provisionWorkplace(
installRedshift() installRedshift()
configureRedshift() configureRedshift()
installBinariesProvs()
installBinariesC4k()
} }
if (desktopType == DesktopType.IDE) { if (desktopType == DesktopType.IDE) {
@ -118,23 +111,3 @@ fun Prov.provisionWorkplace(
} }
ProvResult(true) ProvResult(true)
} }
/**
* Provisions submodules for a personal workplace.
*
* Prerequisites: module must already been installed
*/
fun Prov.provisionWorkplaceSubmodules(
submodules: List<String>
) = task {
if (submodules.contains(DesktopSubmodule.PROVSBINARIES.name.lowercase())) {
aptInstall("jarwrapper")
installBinariesProvs(true)
}
if (submodules.contains(DesktopSubmodule.C4KBINARIES.name.lowercase())) {
aptInstall("jarwrapper")
installBinariesC4k(true)
}
ProvResult(true)
}

View file

@ -1,5 +0,0 @@
package org.domaindrivenarchitecture.provs.desktop.domain
enum class DesktopSubmodule {
PROVSBINARIES, C4KBINARIES
}

View file

@ -1,56 +0,0 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
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(reprovision: Boolean = false) = task {
val installationPath = " /usr/local/bin/"
createDirs(installationPath, 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(
"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)
}

View file

@ -1,37 +0,0 @@
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.installBinariesProvs(reprovision: Boolean = false) = task {
// check for latest stable release on: https://gitlab.com/domaindrivenarchitecture/provs/-/releases
// release 0.9.9
val jobId = "2138969146"
val installationPath = " /usr/local/bin/"
val provsDesktopSha256sum = "e309ea598234c5128095d554dad569fcad26e054431cdebbcd50b7c40ee5276f"
val provsServerSha256sum = "659e3d8c08166288aa5c376194f28e19cbc401edbd9af4225d76c0880bc8518e"
createDirs(installationPath, 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,
overwrite = false // don't overwrite, as code always refers to an older version, for which the checksum is known
)
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)
}

View file

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

View file

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

View file

@ -2,9 +2,7 @@ package org.domaindrivenarchitecture.provs.framework.extensions.workplace
import org.domaindrivenarchitecture.provs.desktop.domain.DesktopType import org.domaindrivenarchitecture.provs.desktop.domain.DesktopType
import org.domaindrivenarchitecture.provs.desktop.domain.provisionWorkplace import org.domaindrivenarchitecture.provs.desktop.domain.provisionWorkplace
import org.domaindrivenarchitecture.provs.desktop.domain.provisionWorkplaceSubmodules
import org.domaindrivenarchitecture.provs.desktop.infrastructure.getConfig import org.domaindrivenarchitecture.provs.desktop.infrastructure.getConfig
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
import org.domaindrivenarchitecture.provs.test.defaultTestContainer import org.domaindrivenarchitecture.provs.test.defaultTestContainer
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Assertions.assertTrue
@ -48,24 +46,6 @@ internal class ProvisionWorkplaceKtTest {
// then // then
assertTrue(res.success) assertTrue(res.success)
} }
@ExtensiveContainerTest
fun provision_submodule_provsbinaries() {
// given
val prov = defaultTestContainer()
// when
val res = prov.provisionWorkplaceSubmodules(
listOf("provsbinaries")
)
// then
assertTrue(res.success)
assertTrue(defaultTestContainer().checkFile(" /usr/local/bin/provs-server.jar", sudo = true))
assertTrue(defaultTestContainer().checkFile(" /usr/local/bin/provs-desktop.jar", sudo = true))
}
} }