diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a84e4234..32405e84 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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.