Skip to content

Instantly share code, notes, and snippets.

@TomLous
Last active January 1, 2020 21:09
Show Gist options
  • Save TomLous/6f44692f16507e9f50c54ccccc26c9f7 to your computer and use it in GitHub Desktop.
Save TomLous/6f44692f16507e9f50c54ccccc26c9f7 to your computer and use it in GitHub Desktop.
build.sbt part 4 for Medium Post
// Task to create helm chart
lazy val createImporterHelmChart: Def.Initialize[Task[Seq[File]]] = Def.task {
val chartFile = baseDirectory.value / "helm" / "Chart.yaml"
val valuesFile = baseDirectory.value / "helm" / "values.yaml"
val chartContents =
s"""# Generated by build.sbt. Please don't manually update
|apiVersion: v1
|name: $domain-${name.value}
|version: ${version.value}
|appVersion: ${version.value}
|description: Sample ETL Job for Medium Post
|home: http://bit.ly/spark-k8s
|sources:
| - https://github.com/TomLous/medium-spark-k8s
|maintainers:
| - name: Tom Lous
| email: tomlous@gmail.com
| url: https://lous.info
|""".stripMargin
val valuesContents =
s"""# Generated by build.sbt. Please don't manually update
|version: ${version.value}
|sparkVersion: ${sparkVersion}
|image: $domain/${name.value}:${version.value}
|imageRegistry:
|jar: local://$targetDockerJarPath/$domain-${name.value}.jar
|mainClass: ${(Compile / run / mainClass).value.getOrElse("__MAIN_CLASS__")}
|fileDependencies: []
|""".stripMargin
IO.write(chartFile, chartContents)
IO.write(valuesFile, valuesContents)
Seq(chartFile, valuesFile)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment