manifestgen

module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: MIT

README

Manifestgen

CLI tool for generating dynamic yaml and json manifests trough Go templating.

Usage Manifestgen
Usage of manifestgen:
  -read-from-file string
        path/file to variables file
  -template string
        path/file to template file
  -type string
        choose input type json / yaml (default "json")
  -write-to-file string
        path/file for writing generated file
Test & Build (Linux)
# clone repository
git clone https://github.com/bartvanbenthem/manifestgen.git
cd manifestgen

# test manifestgen module
go test -cover -v  ./...

# build manifestgen binary
GOOS=linux GOARCH=amd64 go build -o build/bin ./cmd/manifestgen

ManifestGen Examples
# 01  ##########################################################
# testing manifest-printer JSON w/ pipe input | write to Stdout
cat build/testing/values/team-a.json | ./build/bin/manifestgen \
      --type='json' \
      --template='build/testing/templates/team.json'

# 02  ##########################################################
# testing manifest-printer Yaml w/ pipe input  | write to Stdout
cat build/testing/values/team-a.yaml | ./build/bin/manifestgen \
      --type='yaml' \
      --template='build/testing/templates/team.yaml'

# 03  ##########################################################
# testing manifest-writer JSON w/ pipe input | write to File
cat build/testing/values/team-b.json | ./build/bin/manifestgen \
      --type='json' \
      --template='build/testing/templates/team.json' \
      --write-to-file='build/testing/output/team-b.json'

# 04 ##########################################################
# testing manifest-writer YAML w/ pipe input | write to File
cat build/testing/values/team-b.yaml | ./build/bin/manifestgen \
      --type='yaml' \
      --template='build/testing/templates/team.yaml' \
      --write-to-file='build/testing/output/team-b.yaml'

# 05  ##########################################################
# testing manifest-writer JSON w/ file reader input | write to Stdout
./build/bin/manifestgen \
      --type='json' \
      --template='build/testing/templates/team.json' \
      --read-from-file='./build/testing/values/team-a.json'

# 06  ##########################################################
# testing manifest-printer JSON w/ file reader input | write to Stdout
./build/bin/manifestgen \
      --type='json' \
      --template='build/testing/templates/team.json' \
      --read-from-file='./build/testing/values/team-a.json'

# 07  ##########################################################
# testing manifest-printer YAML w/ file reader input | write to Stdout
./build/bin/manifestgen \
      --type='yaml' \
      --template='build/testing/templates/team.yaml' \
      --read-from-file='./build/testing/values/team-a.yaml'

# 08  ##########################################################
# testing manifest-writer JSON w/ pipe input | write to File
cat build/testing/values/team-a.json  | ./build/bin/manifestgen \
      --type='json'  \
      --template='build/testing/templates/team.json' \
      --write-to-file='build/testing/output/team-a.json'

# 09  ##########################################################
# testing manifest-writer YAML w/ file reader input | write to File
./build/bin/manifestgen \
      --type='yaml' \
      --template='build/testing/templates/team.yaml' \
      --read-from-file='./build/testing/values/team-a.yaml' \
      --write-to-file='build/testing/output/team-a.yaml'

# 10  ##########################################################
# testing manifest-writer YAML w/ file reader input | write to File
./build/bin/manifestgen \
      --type='yaml' \
      --template='build/testing/templates/team.yaml' \
      --read-from-file='./build/testing/values/team-a.yaml' \
      --write-to-file='build/testing/output/reader-to-writer.yaml'

# 11  ##########################################################
# terraform variable file example w/ pipe input | write to File
cat 'build/testing/values/tf_variables.json' | ./build/bin/manifestgen \
      --type='json' \
      --template='build/testing/templates/test.tfvars.template' \
      --write-to-file='build/testing/output/test.tfvars'

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL