Commit Graph

11 Commits

Author SHA1 Message Date
Kali Vara Purushotham Santhati
8c41ff539a cli: enhance metadata diff command
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2581
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 327c26868102ea1c277b795b9f508847faa2ae8b
2021-12-09 17:26:53 +00:00
Aravind K P
186baa7915 cli: add support for metadata subcommands to work with json/yaml files
closes https://github.com/hasura/graphql-engine/issues/7542

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2445
GitOrigin-RevId: c0087fa475cf4b353f4af150629684d3b9e1f82f
2021-09-29 11:13:31 +00:00
Kali Vara Purushotham Santhati
c6d47a7db3 cli: use server metadata as base for comparison in metadata diff
Reference: https://hasurahq.slack.com/archives/C024GF6FCTH/p1629193174042700

Problem: The `metadata diff` is conventional where it takes the project metadata and w.r.t to the signs `---`, `+++`, it shows the diff output but it is not similar to git diff as taking the remote repo as base and `+` denotes it has, `-` not. So make the metadata diff output follow as git diff output

Solution: To change the order of arguments in diff function and assign `---` to server,`+++` to project, so that it will be similar to prev diff output

https://github.com/hasura/graphql-engine-mono/pull/2166

GitOrigin-RevId: bf35b5a3ef835fc64f590b65160c01c9a8c1382a
2021-08-24 03:25:05 +00:00
Kali Vara Purushotham Santhati
ca567bf8cb cli: enhance e2e tests
- actions use-codegen
    - Assert if starter kit files are created
- metadata apply
    - Assert server metadata after apply
    - assert that --dry-run flag will not modify metadata on server
- metadata clear
    - Assert with server metadata that operation was successful.
- metadata inconsistency drop
    - Assert with server metadata that operation was successful.
- metadata inconsistency status
    - Assert for all possible states
- metadata reload
    - Assert effect of operation with server
- migrate and seed subcommands
    - Add tests for MSSQL sources
    - Structure tests in such a way that it’s easy to add tests for new sources

https://github.com/hasura/graphql-engine-mono/pull/1693

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: fcdbb806d105978a07487a40f7fa6e16b3ab8816
2021-07-28 06:45:03 +00:00
Kali Vara Purushotham Santhati
a70e6089c8 cli: show only differences in metadata on metadata diff
https://github.com/hasura/graphql-engine-mono/pull/461

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 626bdfd8d1d05996153cd9676f1695ea796b00d9
2021-06-17 10:16:17 +00:00
Aravind K P
3136ffad1b cli: update go.mod
>

### Description
Update `go.mod` to allow other packages to import [v2.0.0 versions](https://blog.golang.org/v2-go-modules).

### Changelog

- [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label.

### Affected components

- [x] CLI

https://github.com/hasura/graphql-engine-mono/pull/1584

GitOrigin-RevId: a5d17ad20289d1cd7217763f56ef3ba6552d69c4
2021-06-16 11:45:07 +00:00
Aravind K P
d8198a8bad cli,ci: testsuite enhancements
- remove `HASURA_TEST_CLI_HGE_DOCKER_TAG` & `HASURA_TEST_CLI_HGE_DOCKER_REPO` env variables
- add `HASURA_TEST_CLI_HGE_DOCKER_IMAGE` environment variable to configure hge image used in tests
- add template test project directories
- add helper functions to manipulate the template projects in individual tests
- add config v2 tests

Co-authored-by: Kali Vara Purushotham Santhati <72007599+purush7@users.noreply.github.com>
GitOrigin-RevId: 009a74c042861ff0a8dec2b06002e55de3a8a629
2021-06-03 13:27:24 +00:00
Kali Vara Purushotham Santhati
489835eb36 cli: metadata apply,export enhancements
- modified the `dry-run` flag of metadata apply command.
- added new flag `o` which takes "json" or "yaml" as parameters for metadata apply command.
- added new flag `o` which takes "json" or "yaml" as parameters for metadata export command. It outputs the metadata from server to stdout in form of  json or yaml and won't change the project's metadata.
- added deprecation warnings for `--from-file` flag
- added info message for describing change of behavior of `--dry-run` flag
- v3 metadata objects like `rest_endpoints` was also added to list of metadata objects in config v2 (fix)
- the order in which metadata objects are appended to metadata objects list matter when using `--dry-run` flag, refactored this order to match server metadata.
- `metadata apply` command can now accept json/yaml metadata from io pipe
- config v3 `metadata apply` didn't show any information to user when applied metadata is inconsistent, this is addressed.
- removed `github.com/ghodss/yaml` dependency from repo
- version metadata object was added twice during intialization (fix)

Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 2316f519eb40645efd86ffee2a85d3c90543ec17
2021-05-14 19:09:59 +00:00
Kali Vara Purushotham Santhati
379b812674 cli: add e2e tests for metadata and migrate commands
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: d63e0452fdb97a8f6c4e921467fc2a1de50639a1
2021-04-05 14:01:35 +00:00
Aravind Shankar
bb63d7e60e
cli: allow managing actions (#3859)
Co-authored-by: Rishichandra Wawhal <rishichandra.wawhal@gmail.com>
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind <aravindkp@outlook.in>
Co-authored-by: Anon Ray <ecthiender@users.noreply.github.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
2020-02-24 21:44:46 +05:30
Jeff Sieu
2ee7f7d76e cli(metadata): add diff command and dry-run flag (#3157)
### Description
Adds a `metadata diff` command to show comparisons between two different sets of Hasura metadata.
```
# Show changes between server metadata and the exported metadata file:
hasura metadata diff

# Show changes between server metadata and that in local_metadata.yaml:
hasura metadata diff local_metadata.yaml

# Show changes between metadata from metadata.yaml and metadata_old.yaml:
hasura metadata diff metadata.yaml metadata_old.yaml
```

Also adds a `--dry-run` flag to `metadata apply` command which will print the diff and exit rather than actually applying the metadata.

### Affected components 
- CLI
- Docs

### Related Issues
Close #3126, Close #3127

### Solution and Design
- Added `metadata_diff.go` and `metadata_diff_test.go`


### Steps to test and verify
```
hasura metadata export
# Make changes to migrations/metadata.yaml
hasura metadata diff
```

### Limitations, known bugs & workarounds
This is just a general-purpose diff. 

A more contextual diff with the understanding of metadata can be added once #3072  is merged.
2019-10-30 19:24:22 +05:30