move VSCode installation from IDE desktop to office desktop
This commit is contained in:
parent
e14db18eb7
commit
de7c1225b9
3 changed files with 28 additions and 20 deletions
|
@ -137,7 +137,10 @@ fun Prov.provisionOfficeDesktop() {
|
|||
// installNextcloudClient() might not install - might need fix and working test
|
||||
aptInstall(COMPARE_TOOLS)
|
||||
|
||||
// optional, as installation of these tools often fail and as they are not considered mandatory
|
||||
// VSCode is also required in office VM (not only in IDE desktop) e.g. as editor
|
||||
installVSCode("python", "clojure")
|
||||
|
||||
// optional, as installation of these tools often fail and as they are not mandatory
|
||||
optional {
|
||||
aptInstall(DRAWING_TOOLS)
|
||||
}
|
||||
|
@ -159,7 +162,6 @@ fun Prov.provisionIdeDesktop() {
|
|||
installHugoByDeb()
|
||||
|
||||
// IDEs
|
||||
installVSC("python", "clojure")
|
||||
installIntelliJ()
|
||||
|
||||
installKubeconform()
|
||||
|
|
|
@ -6,33 +6,33 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInsta
|
|||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
|
||||
|
||||
|
||||
fun Prov.installVSC(vararg options: String) = task {
|
||||
fun Prov.installVSCode(vararg options: String) = task {
|
||||
val clojureExtensions = setOf("betterthantomorrow.calva", "DavidAnson.vscode-markdownlint")
|
||||
val pythonExtensions = setOf("ms-python.python")
|
||||
|
||||
prerequisitesVSCinstall()
|
||||
installVSCodePrerequisites()
|
||||
|
||||
installVSCPackage()
|
||||
installVSCodiumPackage()
|
||||
|
||||
if (options.contains("clojure")) {
|
||||
installExtensionsCode(clojureExtensions)
|
||||
installExtensionsCodium(clojureExtensions)
|
||||
installVSCodeExtensions(clojureExtensions)
|
||||
installVSCodiumExtensions(clojureExtensions)
|
||||
}
|
||||
if (options.contains("python")) {
|
||||
installExtensionsCode(pythonExtensions)
|
||||
installExtensionsCodium(pythonExtensions)
|
||||
installVSCodeExtensions(pythonExtensions)
|
||||
installVSCodiumExtensions(pythonExtensions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun Prov.prerequisitesVSCinstall() = task {
|
||||
private fun Prov.installVSCodePrerequisites() = task {
|
||||
aptInstall("curl gpg unzip apt-transport-https")
|
||||
}
|
||||
|
||||
|
||||
@Suppress("unused") // only required for installation of vscode via apt
|
||||
private fun Prov.installVscWithApt() = task {
|
||||
private fun Prov.installVSCodeWithApt() = task {
|
||||
val packageName = "code"
|
||||
if (!isPackageInstalled(packageName)) {
|
||||
// see https://code.visualstudio.com/docs/setup/linux
|
||||
|
@ -62,7 +62,7 @@ private fun Prov.installVSCodiumPackage() = task {
|
|||
}
|
||||
|
||||
|
||||
private fun Prov.installExtensionsCode(extensions: Set<String>) = optional {
|
||||
private fun Prov.installVSCodeExtensions(extensions: Set<String>) = optional {
|
||||
var res = ProvResult(true)
|
||||
for (ext in extensions) {
|
||||
res = cmd("code --install-extension $ext")
|
||||
|
@ -71,11 +71,11 @@ private fun Prov.installExtensionsCode(extensions: Set<String>) = optional {
|
|||
// Settings can be found at $HOME/.config/Code/User/settings.json
|
||||
}
|
||||
|
||||
private fun Prov.installExtensionsCodium(extensions: Set<String>) = optional {
|
||||
private fun Prov.installVSCodiumExtensions(extensions: Set<String>) = optional {
|
||||
var res = ProvResult(true)
|
||||
for (ext in extensions) {
|
||||
res = cmd("codium --install-extension $ext")
|
||||
res = ProvResult(res.success && cmd("codium --install-extension $ext").success)
|
||||
}
|
||||
res
|
||||
// Settings can be found at $HOME/.config/Code/User/settings.json
|
||||
// Settings can be found at $HOME/.config/VSCodium/User/settings.json
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||||
|
||||
import org.domaindrivenarchitecture.provs.framework.core.remote
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
|
||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.secret.secretSources.PromptSecretSource
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
|
@ -9,14 +10,19 @@ import org.junit.jupiter.api.Test
|
|||
internal class VSCodeKtTest {
|
||||
|
||||
@Test
|
||||
@Disabled("Test currently not working, needs fix. VSC is installed by snapd which is not currently supported to run inside docker")
|
||||
fun installVSC() {
|
||||
@Disabled("Remote testing by updating connection details below, then enable test and run it manually.")
|
||||
// Remark: VSCode installs with snap, which does not run in container and cannot be tested by container test.
|
||||
fun installVSCode() {
|
||||
// given
|
||||
val a = defaultTestContainer()
|
||||
a.aptInstall("xvfb libgbm-dev libasound2")
|
||||
val prov = remote("192.168.56.153", "xx", PromptSecretSource("Remote password").secret()) // machine needs openssh-server installed and sudo possible without pw
|
||||
prov.aptInstall("xvfb libgbm-dev libasound2")
|
||||
|
||||
// when
|
||||
val res = a.installVSC("python", "clojure")
|
||||
val res = prov.task {
|
||||
installVSCode("python", "clojure")
|
||||
cmd("code -v")
|
||||
cmd("codium -v")
|
||||
}
|
||||
|
||||
// then
|
||||
assertTrue(res.success)
|
||||
|
|
Loading…
Reference in a new issue