Commit Graph

25 Commits

Author SHA1 Message Date
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
Aravind K P
054a41d93d cli: (regression) fix behaviour of metadata apply --dry-run flag
GitOrigin-RevId: e1f61866f78bbf8b255852c9b9390f02220f5b6b
2021-04-21 08:22:47 +00:00
Aravind K P
8bc7c2089c cli: fix errors being ignored on metadata apply
GitOrigin-RevId: 1f526c70f57082aa968ebc3d957c78613e9a399e
2021-04-16 11:51:48 +00:00
Kali Vara Purushotham Santhati
b875d95a75 cli: separate the metadata operations from migrate driver
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: 8f6791d5fd51d011623361ac2f5994c8badb50bf
2021-04-01 05:14:17 +00:00
Kali Vara Purushotham Santhati
c3e60aba28 cli: update cli help texts and docs generation
Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com>
Co-authored-by: Aravind K P <8335904+scriptonist@users.noreply.github.com>
GitOrigin-RevId: b6909583093baac4a69296721feae149ca6a0605
2021-03-15 15:41:54 +00:00
Aravind K P
a0995d1b30 cli: add client package, statestore implementations, deprecate config v1
GitOrigin-RevId: 5a1d9cb772ac62603f2543bfe6c01a95c0a035c6
2021-02-17 04:21:11 +00:00
Shraddha Agrawal
d95d6378e8
cli: add support for servers with self-signed certs (fix #4564) (#4582)
Co-Authored-By: Marion Schleifer <marion@hasura.io>
2020-04-28 17:29:57 +05:30
Aravind Shankar
995e198d0a
cli: show env vars for the flags in command help (close #4263) (#4326) 2020-04-08 17:25:42 +05:30
Aravind Shankar
13e8a3c010
cli: send command path in telemetry data (#4095) 2020-03-26 08:38:54 +05:30
Aravind Shankar
e3b843ce81
cli: fix flags in actions, migrate and metadata cmd (fix #3982) (#3991) 2020-03-03 12:36:59 +05:30
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
Pradeep Murugesan
dece69c5a9 cli: add commands to manage inconsistent metadata (close #2766) (#2973)
Co-authored-by: Aravind Shankar <face11301@gmail.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
2019-12-25 14:03:06 +05:30
Rakesh Emmadi
421a182f64 export metadata without nulls, empty arrays & default values (#3393)
* export metadata without nulls, empty arrays
* property tests for 'ReplaceMetadata' using QuickCheck
-> Derive Arbitrary class for 'ReplaceMetadata' dependant types

* reduce property test cases number to 30
QuickCheck generates the `ReplaceMetadata` value really large
for higher number test cases. Encoded JSON for such values is large and
consumes more memory. Thus, CI is giving up while running property
tests.

* circle-ci: Add property tests as saperate job
* add no command mode to tests
* add yaml.v2 to go mod
* remove indirect comment for yaml.v2 dependency
2019-12-14 00:47:38 -06:00
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
Aravind Shankar
ca7d8b3df5 rename metadata reset to metadta clear (close #1851) (#1893)
The word "reset" is little ambiguous (reset to scratch or reset to last known consistent state). metadata reset clears the all the metadata to mimic a freshly installed hasura instance. This actually invokes the clear_metadata API in the backend and hence should also be called metadata clear for perfect clarity.

All references to metadata reset should be changed to metadata clear.
2019-03-29 10:44:56 +05:30
Aravind Shankar
8043ddeebf accept a json or yaml file for metadata apply command (close #1698) (#1746) 2019-03-20 10:40:06 +05:30
Taru
2127ae878b fix a typo in metadata command (#788) 2018-10-20 08:53:20 +05:30
Abilash Menon
0993740786 add reload metadata command to the cli (close #722) (#725) 2018-10-16 11:55:30 +05:30
Shahidh K Muhammed
330f90de40
add project flag, change persistentprerun to prerun (close #552) (#557)
### Description

Adds `--project` flag to the CLI and changes all `PersistentPreRuns` to `PreRuns`

What component does this PR affect? 

- [ ] Server
- [ ] Console
- [x] CLI
- [ ] Docs
- [ ] Community Content
- [ ] Build System

### Related Issue

#552
2018-09-27 19:27:17 +05:30
Maxim Makarov
0fc4ebf09a fix typos in metadata command (#493) 2018-09-20 07:00:37 +05:30
Aravind Shankar
6a20784b95 move metadata.yml file inside migrations folder, fix #122 (#125)
metadata.yaml will be present inside migrations folder
2018-07-12 18:22:25 +05:30
Aravind Shankar
1bff452cb4 handle server endpoints that contains a url path (#64) 2018-07-09 19:17:38 +05:30
Shahidh K Muhammed
6d0d75fbe3
[cli] add comments (#4)
Especially for godoc
2018-06-28 14:06:25 +05:30
Shahidh
8e41d75aa3 refactor most of the code 2018-06-26 21:39:32 +05:30
Shahidh
f7409ef2eb
add hasura cli package 2018-06-24 19:10:48 +05:30