update: instructions to update openapi (#350)

* Add openapi submodule instructions to README.md

Add instructions for updating the influx-cli/openapi git submodule when regenerating the CLI.

* update: instructions to update openapi

Add instructions to update and regenerate influx-cli/openapi when changing commits.
This commit is contained in:
Jason Stirnaman 2021-12-28 14:51:46 -06:00 committed by GitHub
parent 7af0b2ae73
commit cb3bade38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,17 +9,44 @@ This repository decouples the `influx` CLI from the OSS `influxdb` codebase. Our
2. Enable faster turn-around on fixes/features that only affect the CLI
3. Allow the CLI to be built & released for a wider range of platforms than the server can support
## Building
## Building the CLI
Run `make` or `make influx` to build the CLI. The output binary will be written to `bin/$(GOOS)/influx`.
Follow these steps to build the CLI. If you're updating your CLI build, see *Updating openapi* below.
1. Clone this repo (influx-cli) and change to your _influx-cli_ directory.
### Regenerating OpenAPI client
```
git clone git@github.com:influxdata/influx-cli.git
cd influx-cli
```
2. Build the CLI. The `make` and `make influx` commands write the new binary to `bin/$(GOOS)/influx`.
```
make
```
### Updating openapi
If you change or update your branch, you may also need to update `influx-cli/openapi` and regenerate the client code.
`influx-cli/openapi` is a Git submodule that contains the underlying API contracts and client used by the CLI.
We use [`OpenAPITools/openapi-generator`](https://github.com/OpenAPITools/openapi-generator) to generate
the underlying HTTP client used by the CLI. Run `make openapi` to re-generate the code. You'll need Docker
running locally for the script to work.
the HTTP client.
## Running
To update, run the following commands in your `influx-cli` repo:
1. Update the _openapi_ Git submodule. The following command pulls the latest commits for the branch and all submodules.
`git pull --recurse-submodules`
2. With [Docker](https://docs.docker.com/get-docker/) running locally, regenerate _openapi_.
`make openapi`
3. Rebuild the CLI
`make`
## Running the CLI
After building, use `influx -h` to see the list of available commands.