|
| 1 | +# Development |
| 2 | + |
| 3 | +This doc explains the development workflow so you can get started |
| 4 | +[contributing](CONTRIBUTING.md) to Skaffold! |
| 5 | + |
| 6 | +## Getting started |
| 7 | + |
| 8 | +First you will need to setup your GitHub account and create a fork: |
| 9 | + |
| 10 | +1. Create [a GitHub account](https://github.com/join) |
| 11 | +1. Setup [GitHub access via |
| 12 | + SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) |
| 13 | +1. [Create and checkout a repo fork](#checkout-your-fork) |
| 14 | + |
| 15 | +Once you have those, you can iterate on skaffold: |
| 16 | + |
| 17 | +1. [Build your dev version of skaffold](#building-skaffold) |
| 18 | +1. [Verify changes locally](#verifying-local-changes) |
| 19 | +1. [Run skaffold tests](#testing-skaffold) |
| 20 | +1. [Build docs](#building-skaffold-docs) if you are making doc changes |
| 21 | + |
| 22 | +When you're ready, you can [create a PR](#creating-a-pr)! |
| 23 | + |
| 24 | +You may also be interested in [contributing to the docs](#contributing-to-skaffold-docs). |
| 25 | + |
| 26 | +## Checkout your fork |
| 27 | + |
| 28 | +The Go tools require that you clone the repository to the `src/github.com/GoogleContainerTools/skaffold` directory |
| 29 | +in your [`GOPATH`](https://github.com/golang/go/wiki/SettingGOPATH). |
| 30 | + |
| 31 | +To check out this repository: |
| 32 | + |
| 33 | +1. Create your own [fork of this |
| 34 | + repo](https://help.github.com/articles/fork-a-repo/) |
| 35 | + |
| 36 | +1. Clone it to your machine: |
| 37 | + |
| 38 | + ```shell |
| 39 | + mkdir -p ${GOPATH}/src/github.com/GoogleContainerTools |
| 40 | + cd ${GOPATH}/src/github.com/GoogleContainerTools |
| 41 | + git clone [email protected]: ${YOUR_GITHUB_USERNAME}/skaffold.git |
| 42 | + cd skaffold |
| 43 | + git remote add upstream [email protected]:GoogleContainerTools/skaffold.git |
| 44 | + git remote set-url --push upstream no_push |
| 45 | + ``` |
| 46 | + |
| 47 | + _Adding the `upstream` remote sets you up nicely for regularly [syncing your |
| 48 | + fork](https://help.github.com/articles/syncing-a-fork/)._ |
| 49 | + |
| 50 | +## Building skaffold |
| 51 | + |
| 52 | +To build with your local changes you have two options: |
| 53 | + |
| 54 | +1. Build the skaffold binary: |
| 55 | + |
| 56 | + ```shell |
| 57 | + make |
| 58 | + ./out/skaffold version |
| 59 | + ``` |
| 60 | + |
| 61 | + You can then run this binary directly, or copy/symlink it into your path. |
| 62 | + |
| 63 | +1. Build and install the skaffold binary: |
| 64 | + |
| 65 | + ```shell |
| 66 | + make install |
| 67 | + skaffold version |
| 68 | + ``` |
| 69 | + |
| 70 | + This will install skaffold via `go install` (note that if you have [manually downloaded |
| 71 | + and installed skaffold to `/usr/bin/local`](README.adoc#installation), this is will probably |
| 72 | + take precedence in your path over your `$GOPATH/bin`). |
| 73 | + |
| 74 | + _If you are unsure if you are running a released or locally built version of skaffold, you |
| 75 | + can run `skaffold version` - output which includes `dirty` indicates you have built the |
| 76 | + binary locally._ |
| 77 | + |
| 78 | +## Verifying local changes |
| 79 | + |
| 80 | +If you are iterating on skaffold and want to see your changes in action, you can: |
| 81 | + |
| 82 | +1. [Build skaffold](#building-and-running-skaffold) |
| 83 | +2. [Use the quickstart example](README.adoc#iterative-development) |
| 84 | + |
| 85 | +## Testing skaffold |
| 86 | + |
| 87 | +skaffold has both [unit tests](#unit-tests) and [integration tests](#integration-tests). |
| 88 | + |
| 89 | +### Unit Tests |
| 90 | + |
| 91 | +The unit tests live with the code they test and can be run with: |
| 92 | + |
| 93 | +```shell |
| 94 | +make test |
| 95 | +``` |
| 96 | + |
| 97 | +_These tests will not run correctly unless you have [checked out your fork into your `$GOPATH`](#checkout-your-fork)._ |
| 98 | + |
| 99 | +### Integration tests |
| 100 | + |
| 101 | +The integration tests live in [`integration`](./integration) and run the [`examples`](./examples) |
| 102 | +as tests. They can be run with: |
| 103 | + |
| 104 | +```shell |
| 105 | +make integration-test |
| 106 | +``` |
| 107 | + |
| 108 | +_These tests require push access to a project in GCP, and so can only be run |
| 109 | +by maintainers who have access. These tests will be kicked off by [reviewers](#reviews) |
| 110 | +for submitted PRs._ |
| 111 | + |
| 112 | +## Building skaffold docs |
| 113 | + |
| 114 | +Before [creating a PR](#creating-a-pr) with doc changes, we recommend that you locally verify the |
| 115 | +generated docs with: |
| 116 | + |
| 117 | +```shell |
| 118 | +make docs |
| 119 | +``` |
| 120 | + |
| 121 | +And then open the generated docs/generated folder for `index.html` and `index.pdf`. |
| 122 | + |
| 123 | +Once PRs with doc changes are merged, they will get automatically published to the docs |
| 124 | +for [the latest build](https://storage.googleapis.com/skaffold/builds/latest/docs/index.html) |
| 125 | +which at release time will be published with [the latest release](https://storage.googleapis.com/skaffold/releases/latest/docs/index.html). |
| 126 | + |
| 127 | +## Creating a PR |
| 128 | + |
| 129 | +When you have changes you would like to propose to skaffold, you will need to: |
| 130 | + |
| 131 | +1. Ensure the commit message(s) describe what issue you are fixing and how you are fixing it |
| 132 | + (include references to [issue numbers](https://help.github.com/articles/closing-issues-using-keywords/) |
| 133 | + if appropriate) |
| 134 | +1. [Create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) |
| 135 | + |
| 136 | +### Reviews |
| 137 | + |
| 138 | +Each PR must be reviewed by a maintainer. This maintainer will add the `kokoro:run` label |
| 139 | +to a PR to kick of [the integration tests](#integration-tests), which must pass for the PR |
| 140 | +to be submitted. |
0 commit comments