Skip to content

Commit

Permalink
docs(contrib): Update contributing steps (#339)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
kskewes-sf and mergify[bot] committed May 4, 2022
1 parent 416e709 commit 49ff7e0
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,42 @@ go test -v ./...

Spin CLI uses [Swagger](https://swagger.io/) to generate the API client library for [Gate](https://github.com/spinnaker/gate).

Spin CLI's `master` should be using Gate's `master` swagger definition. Similarly, each [spin release version](https://github.com/spinnaker/spin/tags) `v{major}.{minor}.{patch}` semver should match [Gate's tag](https://github.com/spinnaker/gate/tags) `version-{major}.{minor}`.
Spin CLI's `master` branch should be using Gate's `master` swagger definition.

Example:

| Spin CLI version | Gate version |
| ---------------- | -------------- |
| v1.17.3 | version-1.17.0 |
| v1.17.2 | version-1.17.0 |
| v1.17.1 | version-1.17.0 |
Spin CLI's `release-{major}-{minor}.x` branch should be using Gate's
corresponding `release-{major}-{minor}.x` swagger definition.

To update the client library:

- Use the Swagger Codegen to generate the new library and drop it into the spin project

```bash
GATE_REPO_PATH=PATH_TO_YOUR_GATE_REPO
# decide branch to update
branch=release-1.##.x

# check out appropriate Gate branch
# assuming Gate checked out in same parent directory as spin and up to date
cd ../gate
git checkout "$branch"

# generate Gate swagger client library branch
swagger/generate_swagger.sh

# check out appropriate Spin branch
cd ../spin
git checkout "$branch"

# set Swagger Codegen tool version
SWAGGER_CODEGEN_VERSION=$(cat gateapi/.swagger-codegen/VERSION)

rm -rf gateapi/ \
&& docker run -it \
-v "${GATE_REPO_PATH}/swagger/:/tmp/gate" \
-v "$PWD/../gate/swagger/:/tmp/gate" \
-v "$PWD/gateapi/:/tmp/go/" \
"swaggerapi/swagger-codegen-cli:${SWAGGER_CODEGEN_VERSION}" generate -i /tmp/gate/swagger.json -l go -o /tmp/go/

# create branch off $branch and PR changes
git checkout -b "$branch-swagger"
```

- Commit the changes and open a PR.

0 comments on commit 49ff7e0

Please sign in to comment.