trailofbits / trailofbits/graphtage

kubectl diff

Open
#68 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.5k
Forks
61
Avg merge
6h 45m
Merged PRs (30d)
45

Description

The diff in Kubectl can be altered with KUBECTL_EXTERNAL_DIFF here is the ref

These options do all work:

  • KUBECTL_EXTERNAL_DIFF="colordiff -N -u"
  • KUBECTL_EXTERNAL_DIFF="dyff between --omit-header --set-exit-code"
  • KUBECTL_EXTERNAL_DIFF='diff -qr'

I can't, however, make it work with graphtage using the following config

KUBECTL_EXTERNAL_DIFF="graphtage --from-yaml --to-yaml --debug " kubectl diff -f ./dist/aws/cert-manager.k8s.yaml

Traceback (most recent call last):
  File "/Users/vadim/.local/bin/graphtage", line 8, in <module>
    sys.exit(main())
  File "/Users/vadim/.local/lib/python3.10/site-packages/graphtage/__main__.py", line 323, in main
    from_tree = from_format.build_tree_handling_errors(from_path, options)
  File "/Users/vadim/.local/lib/python3.10/site-packages/graphtage/yaml.py", line 236, in build_tree_handling_errors
    return self.build_tree(path=path, options=options)
  File "/Users/vadim/.local/lib/python3.10/site-packages/graphtage/yaml.py", line 228, in build_tree
    tree = build_tree(path=path, options=options)
  File "/Users/vadim/.local/lib/python3.10/site-packages/graphtage/yaml.py", line 23, in build_tree
    with open(path, 'rb') as stream:
IsADirectoryError: [Errno 21] Is a directory: '/var/folders/v5/27sfclt13g54_qgh9kmkqf6w0000gn/T/LIVE-3245526907'

How could I accomplish that with graphtage?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the kubectl diff command with KUBECTL_EXTERNAL_DIFF and graphtage's --from-yaml and --to-yaml options. Start with graphtage/main.py and graphtage/yaml.py, then trace how the temporary paths from kubectl are handled. Done means identifying and documenting or supporting an invocation that works with kubectl's inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.