added webhook validation

This commit is contained in:
ston1th 2019-12-14 14:48:41 +01:00
commit dd88498e0d
6 changed files with 158 additions and 21 deletions

View file

@ -10,6 +10,8 @@ This way we can trigger cleanups when the PR is closed.
```
X-Interceptor-Push-Ref: string: "refs/heads/master"
X-Interceptor-Include-Repo: []string{"my/repo"}
X-Interceptor-Exclude-Repo: []string{"my/repo"}
```
Response Headers:
@ -53,10 +55,33 @@ Issue: <Pull-Request ID>
Commit: <Pull-Request Head Commit Hash>
```
## Validate Webhooks
Add secret webhook keys you want to have validated.
**NOTE:** the name must be `webhook-secret`.
```
cat <<EOF>webhook-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: webhook-secret
namespace: webhook-interceptor
type: Opaque
stringData:
github.com: "<secreet>"
github.com_foo: "<foo secret>"
github.com_foo_bar: "<bar secret>"
EOF
```
# Build and run
Create git authentication secret:
**NOTE:** the name must be `git-auth`.
```
cat <<EOF>secret.yaml
apiVersion: v1
@ -67,6 +92,8 @@ metadata:
type: Opaque
stringData:
github.com: "<username>:<password>"
github.com_foo: "<foo username>:<foo password>"
github.com_foo_bar: "<bar username>:<bar password>"
EOF
```