github.com/yrj2011/jx-test-infra@v0.0.0-20190529031832-7a2065ee98eb/prow/docs/pr_status_setup.md (about) 1 # How to setup PR Status 2 This document helps configure PR Status endpoints. 3 4 ## Setup secrets 5 PR status is an OAuth App that query pull requests on behalf of the authenticated users. 6 Therefore, some secret pieces of information are needed to authorize users for the app. The following 7 steps will show you how to setup an oauth app that works with PR Status. 8 1. Create your Github Oauth application 9 10 https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/ 11 12 The callback url should be: 13 14 `<PROW_BASE_URL>/github-login/redirect` 15 2. Create a secret file for github oauth that content should be as following. The information can be found in the [Github OAuth developer settings](https://github.com/settings/developers): 16 17 ``` 18 client_id: <APP_CLIENT_ID> 19 client_secret: <APP_CLIENT_SECRET> 20 redirect_url: <PROW_BASE_URL>/github-login/redirect 21 final_redirect_url: <PROW_BASE_URL>/pr 22 ``` 23 3. Create another secret file for the cookie store. The file should contain a random 64-byte length base64 key. For example, you can use `openssl` to generate the key 24 25 ``` 26 openssl rand -out cookie.txt -base64 64 27 ``` 28 4. Use `kubectl`, which should already point to your Prow cluster, to create secrets using the command: 29 30 `kubectl create secret generic github-oauth-config --from-file=secret=<PATH_TO_YOUR_GITHUB_SECRET>` 31 32 `kubectl create secret generic cookie --from-file=secret=<PATH_TO_YOUR_COOKIE_KEY_SECRET>` 33 5. To use the secrets, you can either: 34 35 * [Mount](https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets) secrets to your deck volume: 36 37 Open `test-infra/prow/cluster/deck_deployment.yaml`. 38 Under `volumes` token, add: 39 ``` 40 - name: oauth-config 41 secret: 42 secretName: github-oauth-config 43 - name: cookie-secret 44 secret: 45 secretName: cookie 46 ``` 47 Under `volumeMounts` token, add: 48 ``` 49 - name: oauth-config 50 mountPath: /etc/github 51 readOnly: true 52 - name: cookie-secret 53 mountPath: /etc/cookie 54 readOnly: true 55 ``` 56 * Or, pass the path to your secrets to `deck` using the `--github-oauth-config-file` and `--cookie-secret` flags. 57 58 ## Run PR Status endpoint locally 59 Firstly, you will need a Github OAuth app. Please visit step 1 - 3 above. 60 61 When testing locally, pass the path to your secrets to `deck` using the `--github-oauth-config-file` and `--cookie-secret` flags. 62 63 Run the commands: 64 65 `go build . && ./deck --config-path=../../config.yaml --github-oauth-config-file=<PATH_TO_YOUR_GITHUB_OAUTH_SECRET> --cookie-secret=<PATH_TO_YOUR_COOKIE_SECRET> --oauth_url=/pr`