{"id":13646038,"url":"https://github.com/sampointer/dy","last_synced_at":"2025-04-21T17:31:49.872Z","repository":{"id":35902931,"uuid":"220036986","full_name":"sampointer/dy","owner":"sampointer","description":"Construct YAML from a directory tree","archived":true,"fork":false,"pushed_at":"2023-02-27T19:57:05.000Z","size":41,"stargazers_count":123,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T19:41:16.902Z","etag":null,"topics":["cloudformation","containers","continuous-integration","docker","kubernetes","yaml"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sampointer.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2019-11-06T16:06:37.000Z","updated_at":"2024-09-27T11:34:20.000Z","dependencies_parsed_at":"2024-01-14T10:08:06.175Z","dependency_job_id":null,"html_url":"https://github.com/sampointer/dy","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampointer%2Fdy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampointer%2Fdy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampointer%2Fdy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sampointer%2Fdy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sampointer","download_url":"https://codeload.github.com/sampointer/dy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250100539,"owners_count":21374962,"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":["cloudformation","containers","continuous-integration","docker","kubernetes","yaml"],"created_at":"2024-08-02T01:02:47.268Z","updated_at":"2025-04-21T17:31:49.521Z","avatar_url":"https://github.com/sampointer.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# dy [![Go Report Card](https://goreportcard.com/badge/github.com/sampointer/dy)](https://goreportcard.com/report/github.com/sampointer/dy) [![CircleCI](https://circleci.com/gh/sampointer/dy.svg?style=shield)](https://circleci.com/gh/sampointer/dy) [![GoDoc](https://godoc.org/github.com/sampointer/dy?status.svg)](https://godoc.org/github.com/sampointer/dy)\nConstruct YAML from a directory tree\n\n## Description\nThe entire world seems to think declarative configuration is best represented as YAML. This is especially prevalent in the land of Kubernetes and related tools. Terrible ideas have a tendency to accumulate leading to [awful solutions](https://twitter.com/sam_pointer/status/1182321989895311362) to the wrong problems.\n\nWhilst this tool doesn't pretend to move the mountain it does try to nudge it back in the right direction.\n\nPut simply, `dy` allows one to build a YAML document from a directory tree containing snippets of YAML. The aim is to make the document easier to reason about and maintain.\n\nIt is useful everywhere complex YAML configuration is employed: CI pipelines, Cloudformation, Kubernetes, etc. See the [examples](https://github.com/sampointer/dy/tree/master/examples) for inspiration, especially in tandem with [envsubst](https://www.gnu.org/software/gettext/manual/html_node/envsubst-Invocation.html).\n\n## Introducing Divvy Yaml\n\u003e **divvy** */ˈdɪvi/* - To share out. *Informal, British* - A foolish or stupid person\n\n`dy` parses a directory tree according to the following rules:\n\n* A directory is a text key\n* A file name has contents that are rendered under a key named after the file prefix\n* A file name that begins with an underscore is rendered without a key at the current indentation level\n\nConsider the following [example](https://github.com/sampointer/dy/tree/master/examples/k8s_deployment):\n\n```\n$ tree k8s_deployment/\nk8s_deployment/\n├── _header.yaml\n├── metadata.yaml\n└── spec\n    ├── _replicas.yaml\n    ├── selector.yaml\n    └── template\n        ├── metadata\n        │   └── labels.yaml\n        └── spec\n            └── containers.yaml\n\n4 directories, 6 files\n```\n\n```\n$ dy k8s_deployment/\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\n  labels:\n    app: nginx\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n        - name: nginx\n          image: nginx:1.7.9\n          ports:\n          - containerPort: 80\n```\n\n```\n$ dy k8s_deployment/ | kubectl apply --validate=true --dry-run=true -f -\ndeployment.apps/nginx-deployment created (dry run)\n```\n\nYou may pass multiple directories as arguments and they will each be parsed and\nemitted as documents in their own right. In this way a single `dy` invocation\ncan be used to produce a valid multi-document YAML stream.\n\n## Installing\n### Homebrew\n```\nbrew tap sampointer/dy\nbrew install dy\n```\n\n### Manually\nDownload the appropriate package for your distribution from the [releases](https://github.com/sampointer/dy/releases) page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsampointer%2Fdy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsampointer%2Fdy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsampointer%2Fdy/lists"}