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

Feature request: get diff output with new component versions #102

Open
rererecursive opened this issue Mar 25, 2019 · 7 comments
Open

Feature request: get diff output with new component versions #102

rererecursive opened this issue Mar 25, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@rererecursive
Copy link

When changing a component's version, we have no mechanism to verify that the compiled output will also be changed. For small changes to components, it's usually easy for a developer to verify that the new code is safe to deploy, simply by visiting GitHub. But for large changes, verifying can involve more lengthy processes, such as using diff, updates to CloudFormation, etc, which can be inefficient and error prone.

It would be nice to have an option to cfcompile that would allow us to see the diff if we were to use a new component's version in the project. For example, a command like
cfhighlander cfcompile --diff vpc1.0.0=vpc1.0.1.

Note that this is separate from showing the actual diff of the components themselves -- this covers only the generated output.

This could also serve as a testing tool, as we can verify that a config can work across multiple versions of a particular component, and vice versa.

@Guslington
Copy link
Member

@rererecursive good idea, just thinking it might be better to have diff as a seperate command outside on cfcompile. But i agree it should be diffing the generated cloudformation output, either json or yaml.

Something like cfhighlander diff --compare [email protected] [email protected] [email protected] and would diff each generated component and display the output under a heading of each template.

Any thoughts @toshke @aaronwalker ?

@Guslington Guslington added the enhancement New feature or request label Mar 26, 2019
@toshke
Copy link
Member

toshke commented Mar 26, 2019

@Guslington @rererecursive my two cents: this behaviour can be implemented outside of highlander, either by just invoking diff on the highlander output of two different configurations. I feel like adding this functionality may make the cli bit bloated and steeping bit aside from unix philosophy of single tool for single job. Perhaps having standardised Makefile to work with components to wrap such functionality would me more suitable - @aaronwalker thoughts?

@aaronwalker
Copy link
Member

@toshke kinda agree... Although I had this exact situation though and my workflow was to compile my stack with the old version copy the complied yaml then upgrade the component and compile again then run a diff against the old version. Was pretty clunky.

I think if we go down the path of having a version lock file we could include some sort of diff functionality as part of that process as it would make it easier to determine what to actually diff

@Guslington
Copy link
Member

@toshke i get where you're coming from but i agree with @aaronwalker that if we're versioning components there should be some provided functionality to check for changes. Maybe it's feature for kurgan, something like an update command which would display the diffed yaml/json

kurgan update vpc --version 1.0.1 --diff

@toshke
Copy link
Member

toshke commented Mar 29, 2019

@Guslington - i like idea of such functionality being part of kurgan . I've also had few more thing in mind for kurgan, e.g. generating default config, starting a new component that extends another one

@Guslington
Copy link
Member

Guslington commented Apr 2, 2019

@toshke cool, i'll move this request to kurgan

theonestack/kurgan#2

@rererecursive
Copy link
Author

rererecursive commented Apr 11, 2019

Actually, I've realised that the best way to achieve a diff of the output is to simply track the generated out/ folder in git. We make our changes, run cfcompile, and then do a git diff to check the differences.

Which leads me to think: might it be beneficial to actually track the generated JSON in git? After all, it is the information that actually gets uploaded and represents the state of the infrastructure. Is there a reason why we don't commit the output (JSON) to the repository? Is it because we want Highlander/Cfndsl to represent the infrastructure instead? Ideally this would be the case, but ultimately we rely on the JSON being correct, and we need a method to ensure that a change in any Highlander is correctly translated into the expected JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants