Skip to content

Commit

Permalink
Reinstates missing PR (#1241)
Browse files Browse the repository at this point in the history
Fixes #

## Proposed Changes

* Reinstates #1189

## Docs and Tests

* [x] Tests added
* [x] Updated documentation
  • Loading branch information
ademariag authored Sep 24, 2024
1 parent a115bbb commit 593e5f9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kapitan/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def build_parser():
compile_parser.add_argument(
"--reveal",
help="reveal refs (warning: this will potentially write sensitive data)",
action="store_true",
action=argparse.BooleanOptionalAction,
default=from_dot_kapitan("compile", "reveal", False),
)
compile_parser.add_argument(
Expand Down
8 changes: 8 additions & 0 deletions tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def setUp(self):
reset_cache()
os.chdir(TEST_RESOURCES_PATH)

def test_compile_no_reveal(self):
# check if the --no-reveal flag takes precedence over --reveal when passed together
sys.argv = ["kapitan", "compile", "-t", "reveal-output", "--reveal", "--no-reveal"]
main()

with open("compiled/reveal-output/main.json") as f:
self.assertTrue("?{gpg:" in f.read())

def test_single_target_compile(self):
sys.argv = ["kapitan", "compile", "-t", "test-objects"]
main()
Expand Down
12 changes: 12 additions & 0 deletions tests/test_resources/inventory/targets/reveal-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
input: $?{gpg:targets/nginx-ingress/electionID||randomstr|base64}
kapitan:
vars:
target: reveal-output
compile:
- name: generate-toml-jsonnet
input_type: jsonnet
output_path: .
output_type: json
input_paths:
- components/input-to-output/main.jsonnet

0 comments on commit 593e5f9

Please sign in to comment.