{"id":15348160,"url":"https://github.com/ironcore864/tap","last_synced_at":"2026-03-07T09:30:22.514Z","repository":{"id":73865976,"uuid":"242135558","full_name":"IronCore864/tap","owner":"IronCore864","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-15T15:32:04.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T12:45:46.765Z","etag":null,"topics":[],"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/IronCore864.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-21T12:35:38.000Z","updated_at":"2024-02-19T02:04:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"d1d80638-daad-4c44-8c22-96b3483d4e68","html_url":"https://github.com/IronCore864/tap","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.06896551724137934,"last_synced_commit":"9742a6225ec23218a1b36b3e2583b964950537ba"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IronCore864","download_url":"https://codeload.github.com/IronCore864/tap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239898461,"owners_count":19715212,"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":[],"created_at":"2024-10-01T11:45:12.050Z","updated_at":"2026-03-07T09:30:22.448Z","avatar_url":"https://github.com/IronCore864.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Template Tool in Golang for All Purpose\n\nNaming: tap means Template All Product.\n\nIt's a tool written in Golang, which takes yaml (or json) as input, and renders templates in Golang syntax.\n\nCan be used for all kinds of purposes, hence the name, TAP.\n\n## Purpose\n\nUsing input values (defined in a single yaml or json file) and template/templates (all golang tempaltes under a given directory, or a single template file) to write rendered files.\n\nIt was originally designed to generate config.tf and terraform.tfvars for usage of terraform, but it can be for sure used for other purposes, so the naming changed from \"tftpl\" (terraform template) to \"tap\" (template all products).\n\nTemplates names end with `.tpl`, after render, the rendered filename is generated by removing the `.tpl` of the template filename.\n\nFor example, if template name is `file.txt.tpl`, rendered result will be `file.txt` (simply removing the `.tpl`).\n\n## Example Input and Templates\n\nInput examples see `test/input/test.yaml`, `test/input/test.json`.\n\nTemplate examples see `test/templates/test.tfvars.tpl`.\n\nBoth are relatively simple examples, but golang template full feature are supported. For example, to render a yaml list into an array with square brackets and comma separated items:\n\n```\narr = [{{ range  $i, $e := .list }}{{ if $i }}, {{ end }}\"{{ $e }}\"{{ end }}]\n```\n\n## Dependencies\n\n- Golang 1.13.\n\nTested with golang `1.13.4 darwin/amd64`, as well as `1.14` in CircleCI.\n\nOther dependencies can be fetched via go module command `go get`, see below.\n\n## Build\n\n```\ngo get ./...\ngo build\n```\n\n## Test\n\n```\ngo test ./...\n```\n\nCoverage:\n\n```\ngo test ./... -coverprofile=c.out\n```\n\nView coverage as html:\n\n```\ngo tool cover -html=c.out\n```\n\n## Usage\n\n```\n$ ./tap -h\nUsage of ./tap:\n  -inputFile string\n        input file path and name, example: ./input/eks.yaml (default \"./input/eks.yaml\")\n  -outputDir string\n        output directory, example: ./output (default \".\")\n  -template string\n        if given a file, the file of the template to be rendered; if given a directory, all templates under the directory will be rendered (default \"./templates\")\n```\n\n## Run\n\n```\n./tap -inputFile ./test/input/test.yaml -outputDir . -template ./test/templates/\n# template can be either a directory (in which case, all templates under it will be rendered), or a file\n./tap -inputFile ./test/input/test.yaml -outputDir . -template ./test/templates/a.tpl\n```\n\n## Build Docker\n\n```\ndocker build -t ironcore864/tap:latest .\ndocker push ironcore864/tap:latest\n```\n\n## Run in Docker\n\n```\ndocker pull ironcore864/tap:latest\ndocker run -it ironcore864/tap:latest\n```\n\n## Use with Jenkins Pipeline with Kubernetes Plugin in a Multi-Container Pipeline\n\n```\npodTemplate(label: 'pipeline', cloud: 'kubernetes', containers: [\n  containerTemplate(name: 'tap', \n    image: 'docker.io/ironcore864/tap:latest', \n    alwaysPullImage: true,\n    ttyEnabled: true,\n    args: '',\n    command: 'tail -f /dev/null',\n    resourceRequestCpu: '100m',\n    resourceLimitCpu: '200m',\n    resourceRequestMemory: '200Mi',\n    resourceLimitMemory: '400Mi'),\n  containerTemplate(name: 'jnlp',\n    image: 'docker.io/jenkinsci/jnlp-slave:alpine',\n    command: '',\n    args: '${computer.jnlpmac} ${computer.name}',\n    resourceRequestCpu: '50m',\n    resourceLimitCpu: '600m',\n    resourceRequestMemory: '100Mi',\n    resourceLimitMemory: '500Mi')\n  ]) {\n  node('pipeline') {\n    stage(\"Render Templates\") {\n      container('tap') {\n        unstash 'userinput'\n        sh '/app/tap -inputFile ./${USER_INPUT_FILE} -outputDir ./${OUTPUT_DIR} -template ./${TEMPLATE_DIR}'\n      }\n    }\n    stage(\"XXX\") {\n      // ...\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironcore864%2Ftap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fironcore864%2Ftap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironcore864%2Ftap/lists"}