Skip to content

Commit 9129bdb

Browse files
authored
Merge pull request #566 from sm43/single-secret-for-webhook
Updates docs to have one secret with both keys for webhook
2 parents 449a6af + 0f1896c commit 9129bdb

File tree

5 files changed

+31
-49
lines changed

5 files changed

+31
-49
lines changed

docs/content/docs/install/bitbucket_cloud.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Keep the generated token noted somewhere, or otherwise you will have to recreate
5959

6060
```shell
6161
kubectl -n target-namespace create secret generic bitbucket-cloud-token \
62-
--from-literal APP_PASSWORD_AS_GENERATED_PREVIOUSLY
62+
--from-literal provider.token="APP_PASSWORD_AS_GENERATED_PREVIOUSLY"
6363
```
6464

6565
- And then create the Repository CRD with the secret field referencing it, for example:
@@ -79,7 +79,7 @@ Keep the generated token noted somewhere, or otherwise you will have to recreate
7979
secret:
8080
name: “bitbucket-cloud-token“
8181
# Set this if you have a different key in your secret
82-
# key: “token“
82+
# key: “provider.token“
8383
```
8484

8585
## Bitbucket Cloud Notes

docs/content/docs/install/bitbucket_server.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,14 @@ recreate it.
4848
* Pull Request -> Source branch updated
4949
* Pull Request -> Comments added
5050

51-
* Create a secret with personal token in the `target-namespace`
51+
* Create a secret with personal token in the `target-namespace`
5252

5353
```shell
54-
kubectl -n target-namespace create secret generic bitbucket-server-token \
55-
--from-literal token="TOKEN_AS_GENERATED_PREVIOUSLY"
54+
kubectl -n target-namespace create secret generic bitbucket-server-webhook-config \
55+
--from-literal provider.token="TOKEN_AS_GENERATED_PREVIOUSLY" \
56+
--from-literal webhook.secret="SECRET_AS_SET_IN_WEBHOOK_CONFIGURATION"
5657
```
57-
58-
* Then create the secret with the secret name as set in the Webhook configuration :
59-
60-
```shell
61-
kubectl -n target-namespace create secret generic bitbucket-server-webhook-secret \
62-
--from-literal secret="SECRET_NAME_AS_SET_IN_WEBHOOK_CONFIGURATION"
63-
```
64-
58+
6559
* And finally create Repository CRD with the secret field referencing it.
6660

6761
* Here is an example of a Repository CRD :
@@ -79,13 +73,13 @@ recreate it.
7973
url: "https://bitbucket.server.api.url"
8074
user: "your-bitbucket-username"
8175
secret:
82-
name: "bitbucket-server-token"
76+
name: "bitbucket-server-webhook-config"
8377
# Set this if you have a different key in your secret
84-
# key: "token"
78+
# key: "provider.token"
8579
webhook_secret::
86-
name: "bitbucket-server-webhook-secret"
80+
name: "bitbucket-server-webhook-config"
8781
# Set this if you have a different key for your secret
88-
# key: "secret-name"
82+
# key: "webhook.secret"
8983
```
9084

9185
## Notes

docs/content/docs/install/github_webhook.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,14 @@ The only permission needed is the *repo* permission. You will have to note the g
4949
* You are now able to create a Repository CRD. The repository CRD will reference a
5050
Kubernetes Secret containing the Personal token as generated previously and another reference to a Kubernetes secret to validate the Webhook payload as set previously in your Webhook configuration .
5151

52-
* First create the secret with the personal token in the `target-namespace` :
52+
* First create the secret with the personal token and webhook secret in the `target-namespace` :
5353

5454
```shell
55-
kubectl -n target-namespace create secret generic github-personal-token \
56-
--from-literal token="TOKEN_AS_GENERATED_PREVIOUSLY"
55+
kubectl -n target-namespace create secret generic github-webhook-config \
56+
--from-literal provider.token="TOKEN_AS_GENERATED_PREVIOUSLY" \
57+
--from-literal webhook.secret="SECRET_AS_SET_IN_WEBHOOK_CONFIGURATION"
5758
```
58-
59-
* Then create the secret with the secret name as set in the Webhook configuration :
60-
61-
```shell
62-
kubectl -n target-namespace create secret generic github-webhook-secret \
63-
--from-literal secret="SECRET_NAME_AS_SET_IN_WEBHOOK_CONFIGURATION"
64-
```
65-
59+
6660
* And now create Repository CRD referencing everything :
6761

6862
```yaml
@@ -76,13 +70,13 @@ The only permission needed is the *repo* permission. You will have to note the g
7670
url: "https://github.com/owner/repo"
7771
git_provider:
7872
secret:
79-
name: "github-personal-token"
73+
name: "github-webhook-config"
8074
# Set this if you have a different key in your secret
81-
# key: "token"
75+
# key: "provider.token"
8276
webhook_secret:
83-
name: "github-webhook-secret"
77+
name: "github-webhook-config"
8478
# Set this if you have a different key for your secret
85-
# key: "secret-name"
79+
# key: "webhook.secret"
8680
```
8781

8882
## GitHub webhook Notes

docs/content/docs/install/gitlab.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,14 @@ Follow the pipelines-as-code [installation](/docs/install/installation) accordin
4646
* You are now able to create a Repository CRD. The repository CRD will reference a Kubernetes Secret containing the Personal token
4747
and another reference to a Kubernetes secret to validate the Webhook payload as set previously in your Webhook configuration.
4848

49-
* First create the secret with the personal token in the `target-namespace` (where you are planning to run your pipeline CI) :
49+
* First create the secret with the personal token and webhook secret in the `target-namespace` (where you are planning to run your pipeline CI) :
5050

5151
```shell
52-
kubectl -n target-namespace create secret generic gitlab-personal-token \
53-
--from-literal token="TOKEN_AS_GENERATED_PREVIOUSLY"
52+
kubectl -n target-namespace create secret generic gitlab-webhook-config \
53+
--from-literal provider.token="TOKEN_AS_GENERATED_PREVIOUSLY" \
54+
--from-literal webhook.secret="SECRET_AS_SET_IN_WEBHOOK_CONFIGURATION"
5455
```
55-
56-
* Then create the secret with the secret name as set in the Webhook configuration :
57-
58-
```shell
59-
kubectl -n target-namespace create secret generic gitlab-webhook-secret \
60-
--from-literal secret="SECRET_NAME_AS_SET_IN_WEBHOOK_CONFIGURATION"
61-
```
62-
56+
6357
* And now create Repository CRD with the secret field referencing it.
6458

6559
Here is an example of a Repository CRD :
@@ -75,13 +69,13 @@ Here is an example of a Repository CRD :
7569
url: "https://gitlab.com/group/project"
7670
git_provider:
7771
secret:
78-
name: "gitlab-personal-token"
72+
name: "gitlab-webhook-config"
7973
# Set this if you have a different key in your secret
80-
# key: "token"
74+
# key: "provider.token"
8175
webhook_secret:
82-
name: "gitlab-webhook-secret"
76+
name: "gitlab-webhook-config"
8377
# Set this if you have a different key in your secret
84-
# key: "secret-name"
78+
# key: "webhook.secret"
8579
```
8680

8781
## Notes

pkg/pipelineascode/secret.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
)
1414

1515
const (
16-
defaultGitProviderSecretKey = "token"
17-
defaultGitProviderWebhookSecretKey = "secret"
16+
defaultGitProviderSecretKey = "provider.token"
17+
defaultGitProviderWebhookSecretKey = "webhook.secret"
1818
defaultPipelinesAscodeSecretName = "pipelines-as-code-secret"
1919
defaultPipelinesAscodeSecretWebhookSecretKey = "webhook.secret"
2020
)

0 commit comments

Comments
 (0)