Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatted output for extensibility #30

Closed
ykakarap opened this issue Mar 1, 2021 · 4 comments
Closed

Formatted output for extensibility #30

ykakarap opened this issue Mar 1, 2021 · 4 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/release Categorizes an issue or PR as relevant to SIG Release.

Comments

@ykakarap
Copy link
Contributor

ykakarap commented Mar 1, 2021

What would you like to be added:

I would like to add support for formatted outputs like yaml and json. As mentioned in #21 and #27 Zeitgeist can be used by other systems that rely on the output of Zeitgeist to perform some actions. To allow smoother integrations with other systems, eg: build system, dependency bots, etc, we need a machine readable output.

Example:
For the following dependency.yaml :

dependencies:
- name: terraform 
  version: 0.12.3
  upstream:
    flavour: github
    url: hashicorp/terraform
- name: awesome-cli
  version: 79b5b78183f2585689780fbdef1395b06d05ed25
  scheme: random
  upstream:
    flavour: github
    url: project/awesome-cli
    branch: master

The output (in yaml format) can be :

- name: terraform  # example of a component where a new version is detected
  version: 0.12.3
  nextVersion: 0.14.7 # new version available that satisfies the given constraints
- name: awesome-cli  # example of a component where no new version is detected
  version: 79b5b78183f2585689780fbdef1395b06d05ed25
  nextVersion: 79b5b78183f2585689780fbdef1395b06d05ed25

The output format can be specified by --output-format and the accepted values will be json and yaml.
Would also be better to add a -o flag to support writing the output to a target file. Would default to writing the output to dependency_output.(yaml|json)

Why is this needed:

As mentioned in #21 and #27 Zeitgeist can be used by other systems that rely on the output of Zeitgeist to perform some actions. To allow smoother integrations with other systems, eg: build system, dependency bots, etc, we need a machine readable output.

Additional note:
An issue along the same lines is recorded at #21. This issue will be used to track the efforts on this feature as it is going to cover a broader list of output formats, namely yaml and json.

@ykakarap ykakarap added kind/feature Categorizes issue or PR as related to a new feature. sig/release Categorizes an issue or PR as relevant to SIG Release. labels Mar 1, 2021
@ykakarap
Copy link
Contributor Author

ykakarap commented Mar 1, 2021

/assign

@chlunde
Copy link
Contributor

chlunde commented Mar 2, 2021

Cool! What do you think the next step is? I think there are two alternatives:

  • Adding subcommands/flags to this binary to perform the replacement
  • Adding position output to allow other tools to perform the replacement without reimplementing parts of zeitgeist

I think the schema needs to be extended with offsets and file names for each match/version number zeitgeist finds if option 2 is the path forward. But this would also be a very low level API so I'm not sure if there would be more than one (bug free) consumer of such an API :)

Either way, I think this is a perfect first step for both options 👍

@ykakarap
Copy link
Contributor Author

The issue is addressed in this #31

/close

@k8s-ci-robot
Copy link
Contributor

@ykakarap: Closing this issue.

In response to this:

The issue is addressed in this #31

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/release Categorizes an issue or PR as relevant to SIG Release.
Projects
None yet
Development

No branches or pull requests

3 participants