{"id":17254335,"url":"https://github.com/bkbnio/skelegro","last_synced_at":"2025-12-30T22:25:31.033Z","repository":{"id":36992582,"uuid":"347669652","full_name":"bkbnio/skelegro","owner":"bkbnio","description":"A wacky assortment of Kotlin-based DSL generators for various file specs","archived":true,"fork":false,"pushed_at":"2024-10-10T10:48:20.000Z","size":585,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T03:45:01.503Z","etag":null,"topics":["actions","docker","gradle","kotlin","terraform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bkbnio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-14T15:09:45.000Z","updated_at":"2024-10-18T16:55:59.000Z","dependencies_parsed_at":"2023-10-11T01:58:33.017Z","dependency_job_id":"a3028c40-616a-4cf3-8c1b-d8e34015b6e5","html_url":"https://github.com/bkbnio/skelegro","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bkbnio/skelegro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbnio%2Fskelegro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbnio%2Fskelegro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbnio%2Fskelegro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbnio%2Fskelegro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bkbnio","download_url":"https://codeload.github.com/bkbnio/skelegro/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkbnio%2Fskelegro/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261771062,"owners_count":23207212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","docker","gradle","kotlin","terraform"],"created_at":"2024-10-15T07:08:32.647Z","updated_at":"2025-12-30T22:25:30.955Z","avatar_url":"https://github.com/bkbnio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Skelegro\n\n![Maven Central](https://img.shields.io/maven-central/v/io.bkbn/skelegro-docker?style=for-the-badge)\n\n## What is Skelegro\n\nSkelegro is a collection of Kotlin DSLs made to assist in the generation of full-fledged repositories.  Currently,\nthey are being built on a by-need basis, and are constructed in a highly manual manner.  Ideally, in a follow up version,\nthis could be modified to generate DSLs from source much like the amazing https://github.com/fkorotkov/k8s-kotlin-dsl.\n\nThere are some challenges with that approach however, which is why the MVP libraries are all manually declared.  Primarily,\nthe generative approach requires _something_ to generate off of.  Codified sources such as an API spec, JsonSchema, etc.\nwould all suffice.\n\n## How to install\n\nSkelegro is published to Maven Central. \n\n```kotlin\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n  implementation(\"io.bkbn:skelegro-docker:latest.release\")\n  implementation(\"io.bkbn:skelegro-gradle:latest.release\")\n  implementation(\"io.bkbn:skelegro-hcl:latest.release\")\n  implementation(\"io.bkbn:skelegro-yml:latest.release\")\n}\n\n```\n\n## Modules\n\n### YML\n\nThe following example maps to a test yaml file that can be found in the test resources of the `skelegro-yml` source code.\n\nThis builds a GitHub Action manifest\n\n```kotlin\nval manifest = yamlFile {\n  \"name\" eq \"Build and Deploy\"\n  \"on\" block {\n    \"push\" block {\n      \"branches\" block {\n        - \"main\"\n      }\n    }\n  }\n  \"env\" block {\n    \"ACTOR\" eq \"\\${{ github.actor }}\"\n    \"SECRET\" eq \"\\${{ github.secret }}\"\n  }\n  \"jobs\" block {\n    \"assemble\" block {\n      \"runs-on\" eq \"ubuntu-latest\"\n      \"steps\" block {\n        - (\"uses\" req \"actions/checkout@v2\")\n        - (\"uses\" req \"actions/setup-java@v1\")\n        indent {\n          \"with\" block {\n            \"java-version\" eq \"1.11\"\n          }\n        }\n        - (\"name\" req \"Cache Gradle Packages\")\n        indent {\n          \"uses\" eq \"actions/cache@v2\"\n          \"with\" block {\n            \"path\" eq \"~/.gradle/caches\"\n            \"key\" eq \"\\${{ runner.os }}-gradle-\\${{ hashFiles('**/*.gradle.kts') }}\"\n            \"restore-keys\" eq \"\\${{ runner.os }}-gradle\"\n          }\n        }\n        - (\"name\" req \"Assemble Gradle\")\n        indent {\n          \"run\" eq \"gradle assemble\"\n        }\n      }\n    }\n    \"publish-kotlin-images\" block {\n      \"runs-on\" eq \"ubuntu-latest\"\n      \"needs\" block {\n        - \"assemble\"\n      }\n      \"steps\" block {\n        - (\"uses\" req \"actions/checkout@v2\")\n        - (\"uses\" req \"actions/setup-java@v1\")\n        indent {\n          \"with\" block {\n            \"java-version\" eq \"1.11\"\n          }\n        }\n        - (\"name\" req \"Docker Login\")\n        indent {\n          \"uses\" eq \"docker/login-action@v1\"\n          \"with\" block {\n            \"registry\" eq \"ghcr.io\"\n            \"username\" eq \"\\${{ secrets.ACTOR }}\"\n            \"password\" eq \"\\${{ secrets.SECRET }}\"\n          }\n        }\n        - (\"name\" req \"Cache Gradle Packages\")\n        indent {\n          \"uses\" eq \"actions/cache@v2\"\n          \"with\" block {\n            \"path\" eq \"~/.gradle/caches\"\n            \"key\" eq \"\\${{ runner.os }}-gradle-\\${{ hashFiles('**/*.gradle.kts') }}\"\n            \"restore-keys\" eq \"\\${{ runner.os }}-gradle\"\n          }\n        }\n        - (\"name\" req \"Builds image and tags for github packages repo\")\n        indent {\n          \"run\" eq \"./gradlew dockerTagGithubPackages\"\n        }\n        - (\"name\" req \"Pushes image to github package repo\")\n        indent {\n          \"run\" eq \"./gradlew dockerPushGithubPackages --parallel\"\n        }\n      }\n    }\n  }\n}\n```\n\n### Docker\n\nThe following builds a simple dockerfile that can be found in the test resources of the `skelegro-docker` module\n\n```kotlin\ndocker {\n  FROM {\n    comment = \"A basic apache server with PHP. To use either add or bind mount content under /var/www\"\n    image = \"kstaken/apache2\"\n  }\n  LABEL {\n    labels = listOf(\n      Pair(\"maintainer\", \"Kimbro Staken\"),\n      Pair(\"version\", \"0.1\")\n    )\n  }\n  RUN {\n    commands = listOf(\n      \"apt-get update\",\n      \"apt-get install -y php5 libapache2-mod-php5 php5-mysql php5-cli\",\n      \"apt-get clean\",\n      \"rm -rf /var/lib/apt/lists/*\"\n    )\n    separator = \" \u0026\u0026 \"\n  }\n  CMD {\n    instructions = listOf(\n      \"/usr/sbin/apache2\",\n      \"-D\",\n      \"FOREGROUND\"\n    )\n  }\n}\n```\n\n### Gradle\n\nThe following example maps (almost) one-to-one with the `build.gradle.kts` found in the root of this repository\n\n```kotlin\nval buildScript = buildGradleKts {\n  \"plugins\" block {\n    +(fn(\"id\", \"org.jetbrains.kotlin.jvm\") version \"1.4.32\" apply false)\n    +(fn(\"id\", \"io.gitlab.arturbosch.detekt\") version \"1.16.0-RC2\" apply false)\n    +(fn(\"id\", \"com.adarshr.test-logger\") version \"3.0.0\" apply false)\n  }\n  `---`()\n  \"allprojects\" block {\n    \"group\" eq \"org.leafygreens\"\n    \"version\" eq \"0.0.1\"\n    `---`()\n    \"repositories\" block {\n      \"maven\" block {\n        \"url\" eq FunctionCall(\"uri\").withArguments(\"https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven\")\n      }\n      +fn(\"mavenCentral\")\n    }\n    `---`()\n    +fn(\"apply\", NamedParameter(\"plugin\", \"org.jetbrains.kotlin.jvm\"))\n    +fn(\"apply\", NamedParameter(\"plugin\", \"io.gitlab.arturbosch.detekt\"))\n    +fn(\"apply\", NamedParameter(\"plugin\", \"com.adarshr.test-logger\"))\n    +fn(\"apply\", NamedParameter(\"plugin\", \"java-library\"))\n    +fn(\"apply\", NamedParameter(\"plugin\", \"maven-publish\"))\n    +fn(\"apply\", NamedParameter(\"plugin\", \"idea\"))\n    `---`()\n    fn(\"tasks.withType\u003cTest\u003e\") block {\n      +fn(\"useJUnitPlatform\")\n    }\n    `---`()\n    \"configure\u003ccom.adarshr.gradle.testlogger.TestLoggerExtension\u003e\" block {\n      \"theme\" eq EnumReference(\"com.adarshr.gradle.testlogger.theme.ThemeType.MOCHA\")\n      \"logLevel\" eq EnumReference(\"LogLevel.LIFECYCLE\")\n      \"showExceptions\" eq true\n      \"showStackTraces\" eq true\n      \"showFullStackTraces\" eq false\n      \"showCauses\" eq true\n      \"slowThreshold\" eq 2000\n      \"showSummary\" eq true\n      \"showSimpleNames\" eq false\n      \"showPassed\" eq true\n      \"showSkipped\" eq true\n      \"showFailed\" eq true\n      \"showStandardStreams\" eq false\n      \"showPassedStandardStreams\" eq true\n      \"showSkippedStandardStreams\" eq true\n      \"showFailedStandardStreams\" eq true\n    }\n    `---`()\n    fn(\"tasks.withType\u003corg.jetbrains.kotlin.gradle.tasks.KotlinCompile\u003e\").plus(\".configureEach\") block {\n      \"kotlinOptions\" block {\n        \"jvmTarget\" eq \"11\"\n      }\n    }\n    `---`()\n    \"configure\u003cio.gitlab.arturbosch.detekt.extensions.DetektExtension\u003e\" block {\n      \"toolVersion\" eq \"1.16.0-RC2\"\n      \"config\" eq FunctionCall(\"files\").withArguments(\"\\${rootProject.projectDir}/detekt.yml\")\n      \"buildUponDefaultConfig\" eq true\n    }\n    `---`()\n    \"configure\u003cPublishingExtension\u003e\" block {\n      \"repositories\" block {\n        \"maven\" block {\n          \"name\" eq \"GithubPackages\"\n          \"url\" eq FunctionCall(\"uri\").withArguments(\"https://maven.pkg.github.com/bkbnio/skelegro\")\n          \"credentials\" block {\n            \"username\" eq FunctionCall(\"System.getenv\").withArguments(\"GITHUB_ACTOR\")\n            \"password\" eq FunctionCall(\"System.getenv\").withArguments(\"GITHUB_TOKEN\")\n          }\n        }\n      }\n    }\n    `---`()\n    \"configure\u003cJavaPluginExtension\u003e\" block {\n      +fn(\"withSourcesJar\")\n    }\n  }\n}\n```\n\n### HCL\n\nLet's explore using `skelegro-hcl` to generate a Terraform manifest for a kubernetes deployment\n\n```kotlin\nval manifest = hclFile {\n  \"variable\" label \"github_token\" block {\n    \"type\" eq HclType.STRING\n    \"sensitive\" eq true\n  }\n  `---`()\n  \"resource\" label \"kubernetes_deployment\" label \"potato_app\" block {\n    \"metadata\" block {\n      \"name\" eq FunctionCall(\"base64decode\").withArguments(\n        Reference(\"data\", \"digitalocean_kubernetes_cluster\", \"cluster\", \"kube_config\", 0, \"cluster_ca_certificate\")\n      )\n      \"labels\" eqBlock {\n        \"application\" eq \"potato-app\"\n        \"owner\" eq \"big-boss\"\n      }\n    }\n    \"spec\" block {\n      \"replicas\" eq 3\n      \"selector\" block {\n        \"match_labels\" eqBlock {\n          \"application\" eq \"potato-app\"\n          \"owner\" eq \"big-boss\"\n        }\n      }\n      \"template\" block {\n        \"metadata\" block {\n          \"labels\" eqBlock {\n            \"application\" eq \"potato-app\"\n            \"owner\" eq \"big-boss\"\n          }\n        }\n        \"spec\" block {\n          \"image_pull_secrets\" block {\n            \"name\" eq \"ghcr\"\n          }\n          \"container\" block {\n            \"image\" eq \"my-image:latest\"\n            \"name\" eq \"potato-app\"\n            \"image_pull_policy\" eq \"Always\"\n            \"port\" block {\n              \"container_port\" eq 8080\n              \"protocol\" eq \"TCP\"\n            }\n            \"env\" block {\n              \"name\" eq \"MY_SPECIAL_ENV_VAR\"\n              \"value\" eq Reference(\"data\", \"vault_generic_secret\", \"credentials\", \"data[\\\"token\\\"]\")\n            }\n            \"env\" block {\n              \"name\" eq \"GITHUB_TOKEN\"\n              \"value\" eq Reference(\"var\", \"github_token\")\n            }\n            \"resources\" block {\n              \"limits\" eqBlock {\n                \"cpu\" eq \"1\"\n                \"memory\" eq \"1024Mi\"\n              }\n              \"requests\" eqBlock {\n                \"cpu\" eq \"0.5\"\n                \"memory\" eq \"512Mi\"\n              }\n            }\n            \"liveness_probe\" block {\n              \"http_get\" block {\n                \"path\" eq \"/\"\n                \"port\" eq 8080\n              }\n              \"initial_delay_seconds\" eq 30\n              \"period_seconds\" eq 30\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkbnio%2Fskelegro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkbnio%2Fskelegro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkbnio%2Fskelegro/lists"}