github.com/spinnaker/spin@v1.30.0/CONTRIBUTING.md (about) 1 # Contributing 2 3 Interested in contributing to Spinnaker? Please review the [contribution documentation](https://spinnaker.io/docs/community/contributing/). 4 5 ## Setup 6 7 ### Go 8 9 [Install Go 1.17.x](https://golang.org/doc/install). 10 11 Clone the repository: 12 13 ```bash 14 $ git clone https://github.com/spinnaker/spin 15 ``` 16 17 Afterward, use `go build` to build the program. This will automatically fetch dependencies. 18 19 ```bash 20 $ go build 21 ``` 22 23 Upon first build, you may see output while the `go` tool fetches dependencies. 24 25 To verify dependencies match checksums under go.sum, run `go mod verify`. 26 27 To clean up any old, unused go.mod or go.sum lines, run `go mod tidy`. 28 29 ## Running Spin 30 31 Run using 32 33 ```bash 34 ./spin <cmds> <flags> 35 ``` 36 37 ## Running tests 38 39 From the root `spin/` directory run: 40 41 ```bash 42 go test -v ./... 43 ``` 44 45 ## Updating the Gate API 46 47 Spin CLI uses [Swagger](https://swagger.io/) to generate the API client library for [Gate](https://github.com/spinnaker/gate). 48 49 Spin CLI's `master` branch should be using Gate's `master` swagger definition. 50 51 Spin CLI's `release-{major}-{minor}.x` branch should be using Gate's 52 corresponding `release-{major}-{minor}.x` swagger definition. 53 54 To update the client library: 55 56 - Use the Swagger Codegen to generate the new library and drop it into the spin project 57 58 ```bash 59 # decide branch to update 60 branch=release-1.##.x 61 62 # check out appropriate Gate branch 63 # assuming Gate checked out in same parent directory as spin and up to date 64 cd ../gate 65 git checkout "$branch" 66 67 # generate Gate swagger client library branch 68 swagger/generate_swagger.sh 69 70 # check out appropriate Spin branch 71 cd ../spin 72 git checkout "$branch" 73 74 # set Swagger Codegen tool version 75 SWAGGER_CODEGEN_VERSION=$(cat gateapi/.swagger-codegen/VERSION) 76 77 rm -rf gateapi/ \ 78 && docker run -it \ 79 -v "$PWD/../gate/swagger/:/tmp/gate" \ 80 -v "$PWD/gateapi/:/tmp/go/" \ 81 "swaggerapi/swagger-codegen-cli:${SWAGGER_CODEGEN_VERSION}" generate -i /tmp/gate/swagger.json -l go -o /tmp/go/ 82 83 # create branch off $branch and PR changes 84 git checkout -b "$branch-swagger" 85 ``` 86 87 - Commit the changes and open a PR.