From 7fe16d9c0dcfdcb6cb3cdf98bdd479eeca8942a3 Mon Sep 17 00:00:00 2001 From: ansgarz Date: Sat, 9 Oct 2021 15:13:51 +0200 Subject: [PATCH] add creating folder .bashrc.d when installing kubectl --- build.gradle | 20 +++++++++++++++++++ .../ubuntu/filesystem/base/Filesystem.kt | 4 ++-- .../provs/workplace/infrastructure/DevOps.kt | 6 ++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index d4bb21b..52b9acd 100644 --- a/build.gradle +++ b/build.gradle @@ -134,6 +134,26 @@ task uberjarWorkplace(type: 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) { from sourceSets.main.allSource diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/filesystem/base/Filesystem.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/filesystem/base/Filesystem.kt index 096558a..c20f57d 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/filesystem/base/Filesystem.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/ubuntu/filesystem/base/Filesystem.kt @@ -16,8 +16,8 @@ fun Prov.createFileFromResource( resourcePath: String = "", posixFilePermission: String? = null, sudo: Boolean = false -): ProvResult { - return createFile( +): ProvResult = def { + createFile( fullyQualifiedFilename, getResourceAsText(resourcePath.endingWithFileSeparator() + resourceFilename), posixFilePermission, diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOps.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOps.kt index eeb3773..06d5825 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOps.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/workplace/infrastructure/DevOps.kt @@ -2,6 +2,7 @@ package org.domaindrivenarchitecture.provs.workplace.infrastructure import org.domaindrivenarchitecture.provs.core.Prov import org.domaindrivenarchitecture.provs.core.ProvResult +import org.domaindrivenarchitecture.provs.core.local import org.domaindrivenarchitecture.provs.ubuntu.filesystem.base.* import org.domaindrivenarchitecture.provs.ubuntu.install.base.aptInstall import org.domaindrivenarchitecture.provs.ubuntu.web.base.downloadFromURL @@ -51,6 +52,7 @@ fun Prov.installKubectlAndTools(): ProvResult = def { cmd("sudo apt-get update") aptInstall("kubectl") addTextToFile("\nkubectl completion bash\n", "/etc/bash_completion.d/kubernetes", sudo = true) + createDir(".bashrc.d") createFileFromResource(kubeConfigFile, "kubectl.sh", resourcePath) } else { ProvResult(true, out = "Kubectl already installed") @@ -129,3 +131,7 @@ fun awsCredentials(id: String, key: String): String { aws_secret_access_key = $key """.trimIndent() } + +fun main() { + local().installDevOps() +} \ No newline at end of file