fix installKubectlAndTools

This commit is contained in:
az 2022-03-28 20:11:23 +02:00
parent 906deb4ac7
commit e1b4dabb26
2 changed files with 4 additions and 5 deletions

View file

@ -39,7 +39,7 @@ fun Prov.installKubectlAndTools(): ProvResult = task {
val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure"
task("installKubectl") {
val kubeConfigFile = "~/.bashrc.d/kubectl.sh"
val kubeConfigFile = ".bashrc.d/kubectl.sh"
if (!checkFile(kubeConfigFile)) {
// prerequisites -- see https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
cmd("sudo apt-get update")
@ -48,6 +48,7 @@ fun Prov.installKubectlAndTools(): ProvResult = task {
cmd("echo \"deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main\" | sudo tee /etc/apt/sources.list.d/kubernetes.list")
// kubectl and bash completion
cmd("sudo apt update")
aptInstall("kubectl")
cmd("kubectl completion bash >> /etc/bash_completion.d/kubernetes", sudo = true)
createDir(".bashrc.d")

View file

@ -1,6 +1,7 @@
package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.getResourceAsText
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.checkFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.fileContainsText
@ -30,10 +31,7 @@ internal class DevOpsKtTest {
)
)
assertTrue(
defaultTestContainer().fileContainsText(
"/etc/bash_completion.d/kubernetes",
"\nkubectl completion bash\n"
)
defaultTestContainer().checkFile("/etc/bash_completion.d/kubernetes", sudo = true)
)
}
}