Skip to content

Commit 80995f8

Browse files
lbernickShivam Mukhade
authored andcommitted
Update documentation for ingresses and running PRs
This commit updates documentation for ingresses: - to provide GKE examples - to point to proxying docs - to clarify where to find more information on setting up your ingress It also clarifies where PipelineRun configuration must be stored, and how PipelineRuns from pull requests can be run.
1 parent 4602207 commit 80995f8

File tree

6 files changed

+87
-33
lines changed

6 files changed

+87
-33
lines changed

.vale.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ IgnoredScopes = code, tt, img, url, a, body.id
2222
SkippedScopes = script, style, pre, figure, code, tt, blockquote, listingblock, literalblock
2323

2424
RedHat.ConfigMap = NO
25+
RedHat.CaseSensitiveTerms = NO
2526
# Match Markdown files. See: https://docs.errata.ai/vale/scoping
2627
# Match also `*.properties` files (see the `format` section).
2728
[*.md]

docs/content/docs/guide/authoringprs.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ weight: 3
88
possible. Usually you will write your template and save them with a `.yaml`
99
extension and Pipelines as Code will run them.
1010

11+
* The `.tekton` directory must be at the top level of the repo.
12+
You can reference YAML files in other repos using remote URLs
13+
(see [Remote HTTP URLs](./resolver.md#remote-http-url) for more information),
14+
but PipelineRuns will only be triggered by events in the repository containing
15+
the `.tekton` directory.
16+
1117
* Using its [resolver](./resolver) Pipelines as Code will try to bundle the
1218
PipelineRun with all its Task as a single PipelineRun with no external
1319
dependencies.

docs/content/docs/guide/running.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ weight: 4
44
---
55
# Running the PipelineRun
66

7-
The user flow looks like this :
7+
Pipelines as Code will run any PipelineRuns committed to the default branch of the repo
8+
when the specified events occur on the repo.
9+
For example, if a PipelineRun on the default branch has the annotation
10+
`pipelinesascode.tekton.dev/on-event: "[pull_request]"`, it will run whenever a pull request event occurs.
811

9-
- A user create a `Pull Request` (or `Merge Request` in Gitlab).
12+
Pipelines as Code will also run any PipelineRuns from a branch in a pull request (or merge request in Gitlab).
13+
For example, if you're testing out a new PipelineRun, you can create a pull request
14+
with that PipelineRun, and it will run if the following conditions are met:
1015

11-
- Pipelines as Code picks the event and matches to a Repo CRD installed on the
12-
cluster.
16+
- The pull request author's PipelineRun will be run if:
1317

14-
- The user is allowed to run the CI if :
15-
16-
- The user is the owner of the repository.
17-
- The user is a collaborator on the repository.
18-
- The user is a public member on the organization of the repository.
19-
20-
- If the user is sending the Pull Request is inside an OWNER file located in the
18+
- The author is the owner of the repository.
19+
- The author is a collaborator on the repository.
20+
- The author is a public member on the organization of the repository.
21+
- The pull request author is inside an OWNER file located in the
2122
repository root on the main branch (the main branch as defined in the GitHub
2223
configuration for the repo) and added to either `approvers` or `reviewers`
23-
sections like this :
24+
sections. For example, if the approvers section looks like this:
2425

2526
```yaml
2627
approvers:
@@ -29,13 +30,16 @@ approvers:
2930
3031
then the user `approved` will be allowed.
3132

32-
- If the sender of a PR is not allowed to run CI but one of allowed user issue a
33-
`/ok-to-test` in any line of a comment the PR will be allowed to run CI.
33+
If the pull request author does not meet these requirements,
34+
another user that does meet these requirements can comment `/ok-to-test` on the pull request
35+
to run the PipelineRun.
36+
37+
## PipelineRun Execution
3438

35-
- If the user is allowed, `Pipelines as Code` will start creating the
36-
`PipelineRun` in the target user namespace.
39+
The PipelineRun will always run in the namespace of the Repository CRD associated with the repo
40+
that generated the event.
3741

38-
- The user can follow the execution of your pipeline with the
42+
You can follow the execution of your pipeline with the
3943
[tkn](https://github.com/tektoncd/cli) cli :
4044

4145
```console
@@ -55,7 +59,7 @@ your branch or pull_request.
5559

5660
On GitHub if you are using the Github apps, you can go to the Checks tab and
5761
click on the upper left button called "Re-Run" and Pipelines as Code will react
58-
to the event and restart testing the PipelineRun
62+
to the event and restart testing the PipelineRun.
5963

6064
### Gitops command on pull or merge request
6165

docs/content/docs/install/github_apps.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ There are 2 ways to set up GitHub App:
1919

2020
You could use [`tkn pac bootstrap`](/docs/guide/cli) command which will a create GitHub App, provides
2121
steps to configure it with your Git repository and also creates required secrets.
22+
After creating the Github App, you must install it on the repositories you want to use for Pipelines as Code.
2223

23-
Alternatively, you could set up manually by following the steps [here](#setup-manually)
24+
Alternatively, you could set up manually by following the steps [here](#setup-manually).
2425

2526
## Setup Manually
2627

@@ -61,7 +62,7 @@ Alternatively, you could set up manually by following the steps [here](#setup-ma
6162
download automatically. Store the private key in a safe place as you need it in the next section and in future when
6263
reconfiguring this app to use a different cluster.
6364

64-
## Configure Pipelines-as-Code on your cluster to access the GitHub App
65+
### Configure Pipelines-as-Code on your cluster to access the GitHub App
6566

6667
In order for Pipelines-as-Code to be able to authenticate to the GitHub App and have the GitHub App securely trigger the
6768
Pipelines-as-Code webhook, you need to create a Kubernetes secret containing the private key of the GitHub App and the
@@ -86,6 +87,8 @@ kubectl -n pipelines-as-code create secret generic pipelines-as-code-secret \
8687
--from-literal webhook.secret="WEBHOOK_SECRET"
8788
```
8889

90+
Lastly, install the App on any repos you'd like to use with Pipelines as Code.
91+
8992
## GitHub Enterprise
9093

9194
Pipelines as Code supports GitHub Enterprise.

docs/content/docs/install/installation.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,19 +140,13 @@ You can use following command to update the envs on the controller
140140

141141
## Proxy service for PAC controller
142142

143-
### What
143+
Pipelines as Code requires an externally accessible URL to receive events from Git providers.
144+
If you're developing locally (such as on kind or Minikube) or don't want to set up an ingress on your cluster,
145+
you can also use a proxy service to expose the `pipelines-as-code-controller` service and allow it to receive events.
144146

145-
proxy service is used to forward request coming to `pipelines-as-code-controller` service
147+
### Proxying with smee.io
146148

147-
### Why
148-
149-
PAC requires externally accessible URL to configure for GitHub, GitLab, BitBucket and there are few clusters which doesn't expose services to external world ex: Minikube, Kind and so on.
150-
151-
### Proposed solution
152-
153-
To handle such scenario for minikube/kind cluster lets use [smee.io](https://smee.io/)
154-
155-
### Steps to configure smee.io
149+
To handle such scenario for minikube/kind cluster let's use [smee.io](https://smee.io/)
156150

157151
- Generate your own URL by going to [smee.io/new](https://smee.io/new)
158152
- Copy `Webhook Proxy URL`

docs/content/docs/install/kubernetes.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,28 @@ and for the nightly :
2525
kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/nightly/release.k8s.yaml
2626
```
2727

28+
## Verify
29+
30+
Ensure that the pipelines-as-code controller, webhook, and watcher have come up healthy, for example:
31+
32+
```shell
33+
$ kubectl get deployment -n pipelines-as-code
34+
NAME READY UP-TO-DATE AVAILABLE AGE
35+
pipelines-as-code-controller 1/1 1 1 43h
36+
pipelines-as-code-watcher 1/1 1 1 43h
37+
pipelines-as-code-webhook 1/1 1 1 43h
38+
```
39+
40+
All three deployments should have all pods ready before moving on to ingress setup.
41+
2842
## Ingress
2943

30-
You will need a `Ingress` to point to the pipelines-as-code controller, here is an example working with the [nginx ingress](https://kubernetes.github.io/ingress-nginx/) controller :
44+
You will need a `Ingress` to point to the pipelines-as-code controller.
45+
The ingress configuration depends on your Kubernetes provider.
46+
Either the ingress hostname or its IP address may be used as the webhook URL.
47+
You'll provide this configuration when connecting Pipelines as Code to your Git provider.
48+
49+
Here is an example working with the [nginx ingress](https://kubernetes.github.io/ingress-nginx/) controller :
3150

3251
```yaml
3352
apiVersion: networking.k8s.io/v1
@@ -52,7 +71,34 @@ spec:
5271
pathType: Prefix
5372
```
5473
55-
In this example `webhook.host.tld` is the hostname for your pipeline's controller to fill as the webhook URL in the provider platform setup.
74+
In this example `webhook.host.tld` is the hostname that will be used for the Pipelines as Code webhook URL.
75+
76+
Here's an example with GKE:
77+
78+
```yaml
79+
apiVersion: networking.k8s.io/v1
80+
kind: Ingress
81+
metadata:
82+
labels:
83+
pipelines-as-code/route: controller
84+
name: pipelines-as-code
85+
namespace: pipelines-as-code
86+
annotations:
87+
kubernetes.io/ingress.class: gce
88+
spec:
89+
defaultBackend:
90+
service:
91+
name: pipelines-as-code-controller
92+
port:
93+
number: 8080
94+
```
95+
96+
In this example, you will use the ingress's IP address rather than a hostname for the webhook URL.
97+
You can find the ingress's address via `kubectl get ingress pipelines-as-code -n pipelines-as-code`.
98+
99+
If you can't or don't want to set up an ingress on your cluster (for example, you're using a kind cluster,
100+
or you just want to experiment with Pipelines as Code before setting up an ingress),
101+
see [Proxy service for PAC controller](./installation.md#proxy-service-for-pac-controller).
56102

57103
## Tekton Dashboard integration
58104

0 commit comments

Comments
 (0)