add creating folder .bashrc.d when installing kubectl

This commit is contained in:
ansgarz 2021-10-09 15:13:51 +02:00
parent 038c775c3f
commit 7fe16d9c0d
3 changed files with 28 additions and 2 deletions

View file

@ -134,6 +134,26 @@ task uberjarWorkplace(type: Jar) {
archiveFileName = 'provs-workplace.jar' archiveFileName = 'provs-workplace.jar'
} }
task uberjarEntry(type: Jar) {
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
} {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.core.entry.EntryKt'
}
archiveFileName = 'provs-entry.jar'
}
task sourceJar(type: Jar, dependsOn: classes) { task sourceJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource from sourceSets.main.allSource

View file

@ -16,8 +16,8 @@ fun Prov.createFileFromResource(
resourcePath: String = "", resourcePath: String = "",
posixFilePermission: String? = null, posixFilePermission: String? = null,
sudo: Boolean = false sudo: Boolean = false
): ProvResult { ): ProvResult = def {
return createFile( createFile(
fullyQualifiedFilename, fullyQualifiedFilename,
getResourceAsText(resourcePath.endingWithFileSeparator() + resourceFilename), getResourceAsText(resourcePath.endingWithFileSeparator() + resourceFilename),
posixFilePermission, posixFilePermission,

View file

@ -2,6 +2,7 @@ package org.domaindrivenarchitecture.provs.workplace.infrastructure
import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.Prov
import org.domaindrivenarchitecture.provs.core.ProvResult import org.domaindrivenarchitecture.provs.core.ProvResult
import org.domaindrivenarchitecture.provs.core.local
import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.* import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.*
import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.ubuntu.web.base.downloadFromURL import org.domaindrivenarchitecture.provs.ubuntu.web.base.downloadFromURL
@ -51,6 +52,7 @@ fun Prov.installKubectlAndTools(): ProvResult = def {
cmd("sudo apt-get update") cmd("sudo apt-get update")
aptInstall("kubectl") aptInstall("kubectl")
addTextToFile("\nkubectl completion bash\n", "/etc/bash_completion.d/kubernetes", sudo = true) addTextToFile("\nkubectl completion bash\n", "/etc/bash_completion.d/kubernetes", sudo = true)
createDir(".bashrc.d")
createFileFromResource(kubeConfigFile, "kubectl.sh", resourcePath) createFileFromResource(kubeConfigFile, "kubectl.sh", resourcePath)
} else { } else {
ProvResult(true, out = "Kubectl already installed") ProvResult(true, out = "Kubectl already installed")
@ -129,3 +131,7 @@ fun awsCredentials(id: String, key: String): String {
aws_secret_access_key = $key aws_secret_access_key = $key
""".trimIndent() """.trimIndent()
} }
fun main() {
local().installDevOps()
}