|
| 1 | +# Install |
| 2 | + |
| 3 | +## Pipelines as Code Install |
| 4 | + |
| 5 | +To install Pipelines as Code on your server you simply need to run this command : |
| 6 | + |
| 7 | +```shell |
| 8 | +VERSION=0.1 |
| 9 | +kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/release-$VERSION/release-$VERSION.yaml |
| 10 | +``` |
| 11 | + |
| 12 | +If you would like to install the current developement version you can simply install it like this : |
| 13 | + |
| 14 | +```shell |
| 15 | +kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/nightly/release.yaml |
| 16 | +``` |
| 17 | + |
| 18 | +It will apply the release.yaml to your kubernetes cluster, creating the |
| 19 | +admin namespace `pipelines-as-code`, the roles and all other bits needed. |
| 20 | + |
| 21 | +The `pipelines-as-code` namespace is where all the admin pipelinerun are run, |
| 22 | +they are supposed to be accesible only by the admin. |
| 23 | + |
| 24 | +You will need then to have events from github or others coming through to your |
| 25 | +EventListenner so follow the next steps on how to do that. |
| 26 | + |
| 27 | +### Github configuration |
| 28 | + |
| 29 | +To setup Pipelines as Code on Github, you need to have a Github App created. |
| 30 | + |
| 31 | +You need the Webhook of the app pointing to your Ingress endpoint which would |
| 32 | +then go to the triggers enventlistenner/service. |
| 33 | + |
| 34 | +You need to make sure you have those permissions and events checked on the |
| 35 | +GitHub app : |
| 36 | + |
| 37 | +```json |
| 38 | + "default_permissions": { |
| 39 | + "checks": "write", |
| 40 | + "contents": "write", |
| 41 | + "issues": "write", |
| 42 | + "members": "read", |
| 43 | + "metadata": "read", |
| 44 | + "organization_plan": "read", |
| 45 | + "pull_requests": "write" |
| 46 | + }, |
| 47 | + "default_events": [ |
| 48 | + "commit_comment", |
| 49 | + "issue_comment", |
| 50 | + "pull_request", |
| 51 | + "pull_request_review", |
| 52 | + "pull_request_review_comment", |
| 53 | + "push" |
| 54 | + ] |
| 55 | +``` |
| 56 | + |
| 57 | +When you have created the `github-app-secret` Secret, grab the private key the |
| 58 | +`application_id` and the `webhook_secret` from the interface, place the private |
| 59 | +key in a file named for example `/tmp/github.app.key` and issue those commands : |
| 60 | + |
| 61 | +```bash |
| 62 | +% kubectl -n pipelines-as-code create secret generic github-app-secret \ |
| 63 | + --from-literal private.key="$(cat /tmp/github.app.key)" |
| 64 | + --from-literal application_id="APPLICATION_ID_NUMBER" \ |
| 65 | + --from-literal webhook.secret="WEBHOOK_SECRET" |
| 66 | +``` |
| 67 | + |
| 68 | +This secret is used to generate a token on behalf of the user running the event |
| 69 | +and make sure to validate the webhook via the webhook secret. |
| 70 | + |
| 71 | +You will then need to make sure to expose the `EventListenner` via a |
| 72 | +[Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) or a |
| 73 | +[OpenShift |
| 74 | +Route](https://docs.openshift.com/container-platform/latest/networking/routes/route-configuration.html) |
| 75 | +so GitHub can get send the webhook to it. |
| 76 | + |
| 77 | +### GitHub Enteprise |
| 78 | + |
| 79 | +Pipelines as Code supports Github Enterprise. |
| 80 | + |
| 81 | +You don't need to do anything special to get Pipelines as code working with GHE. |
| 82 | +Pipelines as code will automatically detects the header as set from GHE and use it the GHE API auth url instead of the public github. |
| 83 | + |
| 84 | +## Configuration |
| 85 | + |
| 86 | +There is a few things you can configure via the configmap `pipelines-as-code` in |
| 87 | +the `pipelines-as-code` namespace. |
| 88 | + |
| 89 | +- **application-name**: The name of the application showing for example in the |
| 90 | + GitHub Checks labels. Default to `"Pipelines as Code"` |
| 91 | +- **max-keep-days**: The number of the day to keep the PR runs in the |
| 92 | + `pipelines-as-code` namespace, see below for more details about it.. |
| 93 | + |
| 94 | +### PR cleanups in pipelines-as-code admin namespace |
| 95 | + |
| 96 | +We install by default a cron that cleanups the PR generated on events in pipelines-as-code |
| 97 | +namespace. The crons runs every hour and by default cleanups pipelineruns over a |
| 98 | +day. If you would like to change the max number of days to keep you can change the |
| 99 | +key `max-keep-days` in the `pipelines-as-code` configmap. This configmap |
| 100 | +setting doens't affect the cleanups of the user's PR controlled by the |
| 101 | +annotations. |
| 102 | + |
| 103 | +## OpenShift Pipelines CLI |
| 104 | + |
| 105 | +OpenShift Pipelines CLI offer a easy to use CLI to manage your repositories status. |
| 106 | + |
| 107 | +## Binary releases |
| 108 | + |
| 109 | +You can grab the latest binary directly from the |
| 110 | +[releases](https://github.com/openshift-pipelines/pipelines-as-code/releases) |
| 111 | +page. |
| 112 | + |
| 113 | +## Dev release |
| 114 | + |
| 115 | +If you want to install from the git repository you can just do : |
| 116 | + |
| 117 | +```shell |
| 118 | +go install github.com/openshift-pipelines/pipelines-as-code/cmd/tkn-pac |
| 119 | +``` |
| 120 | + |
| 121 | +## Brew release |
| 122 | + |
| 123 | +On LinuxBrew or OSX brew you can simply add the tap : |
| 124 | + |
| 125 | +```shell |
| 126 | +brew install openshift-pipelines/pipelines-as-code/tektoncd-pac |
| 127 | +``` |
0 commit comments