You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/11/30 07:12:22 UTC

(incubator-devlake-website) branch webhook-multi-repos updated: docs: update webhook connection

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch webhook-multi-repos
in repository https://gitbox.apache.org/repos/asf/incubator-devlake-website.git


The following commit(s) were added to refs/heads/webhook-multi-repos by this push:
     new a96b713e3a docs: update webhook connection
a96b713e3a is described below

commit a96b713e3abf17837a6a6c43c251b90553ac9698
Author: abeizn <zi...@merico.dev>
AuthorDate: Thu Nov 30 15:12:12 2023 +0800

    docs: update webhook connection
---
 docs/Configuration/webhook.md                      |   6 ++-
 docs/Plugins/webhook.md                            |  60 +++++++++++++++++----
 .../img/ConfigUI/webhook-add-data-connections.png  | Bin 22397 -> 19602 bytes
 static/img/ConfigUI/webhook-connection.png         | Bin 90764 -> 0 bytes
 static/img/ConfigUI/webhook-connection1.png        | Bin 0 -> 92931 bytes
 static/img/ConfigUI/webhook-connection2.png        | Bin 0 -> 104010 bytes
 6 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/docs/Configuration/webhook.md b/docs/Configuration/webhook.md
index 7fa721067e..bb710a1ed4 100644
--- a/docs/Configuration/webhook.md
+++ b/docs/Configuration/webhook.md
@@ -16,9 +16,11 @@ We recommend that you give your webhook connection a unique name so that you can
 
 ### Step 2 - Create webhooks connection
 
-Click on Generate POST URL, and you will find three webhook URLs. Copy the ones that suit your usage into your CI or issue-tracking systems. You can always come back to the webhook page to copy the URLs later on.
+Click on Generate POST URL, and you will find three webhook URLs. 
+![webhook-connection1](/img/ConfigUI/webhook-connection1.png)
 
-![webhook-connection](/img/ConfigUI/webhook-connection.png)
+Revoke and generate a new key, and copy the ones that suit your usage into your CI or issue-tracking systems. Ensure to save the generated API Key, you can revisit the webhook page to synthesize the complete URL.
+![webhook-connection2](/img/ConfigUI/webhook-connection2.png)
 
 ### Step 3 - Use webhook in a project
 
diff --git a/docs/Plugins/webhook.md b/docs/Plugins/webhook.md
index a92dba9c3d..b3494ea70d 100644
--- a/docs/Plugins/webhook.md
+++ b/docs/Plugins/webhook.md
@@ -45,18 +45,23 @@ If you want to collect deployment data from your system, you can use the incomin
 
 You can copy the generated deployment curl commands to your CI/CD script to post deployments to Apache DevLake. Below is the detailed payload schema:
 
-|     Key     | Required | Notes                                                                                                                                                                            |
-| :---------: | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+|     Key     | Required | Notes                                                                                                                                                                           |
+| :---------: | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 | pipeline_id |  ✖️ No   | related Domain Layer `cicd_pipelines.id`                                                                                                                                         |
-| environment |  ✖️ No   | the environment this deployment happens. For example, `PRODUCTION` `STAGING` `TESTING` `DEVELOPMENT`. <br/>The default value is `PRODUCTION`                                     |
-|  repo_url   |  ✔️ Yes  | the repo URL of the deployment commit<br />If there is a row in the domain layer table `repos` where `repos.url` equals `repo_url`, the `repoId` will be filled with `repos.id`. |
+| environment |  ✖️ No(no-multiple repos)   | the environment this deployment happens. For example, `PRODUCTION` `STAGING` `TESTING` `DEVELOPMENT`. <br/>The default value is `PRODUCTION`                  |
+|  repo_url   |  ✔️ Yes(no-multiple repos)  | the repo URL of the deployment commit<br />If there is a row in the domain layer table `repos` where `repos.url` equals `repo_url`, the `repoId` will be filled with `repos.id`. |
 |   repo_id   |  ✖️ No   | related Domain Layer `repos.id` <br/> No default value.                                                                                                                          |
-|  ref_name   |  ✖️ No   | related branch/tag<br/> No default value.                                                                                                                                        |
-| commit_sha  |  ✔️ Yes  | the sha of the deployment commit                                                                                                                                                 |
+|    name     |  ✖️ No   | deployment name. The default value is "deployment for `request.commit_sha`"                                                                                   |
+|  ref_name   |  ✖️ No(no-multiple repos)   | related branch/tag<br/> No default value.                                                                                                                     |
+| commit_sha  |  ✔️ Yes(no-multiple repos)  | the sha of the deployment commit                                                                                                                              |
+| commit_msg  |  ✖️ No(no-multiple repos)   | the sha of the deployment commit message                                                                                                                      |
 | create_time |  ✖️ No   | Time. Eg. 2020-01-01T12:00:00+00:00<br/> No default value.                                                                                                                       |
-| start_time  |  ✔️ Yes  | Time. Eg. 2020-01-01T12:00:00+00:00<br/> No default value.                                                                                                                       |
-|  end_time   |  ✔️ Yes  | Time. Eg. 2020-01-01T12:00:00+00:00<br/> The default value is the time when DevLake receives the POST request.                                                                   |
+| start_time  |  ✔️ Yes(no-multiple repos)  | Time. Eg. 2020-01-01T12:00:00+00:00<br/> No default value.                                                                                                    |
+|  end_time   |  ✖️ No   | Time. Eg. 2020-01-01T12:00:00+00:00<br/> The default value is the time when DevLake receives the POST request.                                                                   |
 |   result    |  ✖️ No   | deployment result, one of the values : `SUCCESS`, `FAILURE`, `ABORT`, `MANUAL`, <br/> The default value is `SUCCESS`.                                                            |
+| deploymentCommits[]    |  ✖️ yes((multiple repos))  | Allow deployment webhook to push deployments to multiple repos in one request, includes repo_url,commit_sha,commit_msg,name,ref_name    |
+
+
 
 #### Register a Deployment - Sample API Calls
 
@@ -68,21 +73,56 @@ curl <devlake-host>/api/rest/plugins/webhook/1/deployments -X 'POST' -d '{
     "environment":"PRODUCTION",
     "repo_url":"https://github.com/apache/incubator-devlake/",
     "repo_id": "optional-repo-id",
+    "name": "optional-deployment-name",
     "ref_name": "optional-release-v0.17",
     "commit_sha":"015e3d3b480e417aede5a1293bd61de9b0fd051d",
+    "commit_msg":"optional-commit-message",
     "create_time":"2020-01-01T11:00:00+00:00",
     "start_time":"2020-01-01T12:00:00+00:00",
     "end_time":"2020-01-02T13:00:00+00:00",
     "result": "FAILURE"
   }'
 ```
+or if you want to push deployments to multiple repos in one request, you can use the following command:
+```
+curl <devlake-host>/api/rest/plugins/webhook/1/deployments -X 'POST' -d '{
+    "pipeline_id": "optional-pipeline-id",
+    "environment":"PRODUCTION",
+    "repo_id": "optional-repo-id",
+    "name": "optional-deployment-name",
+    "create_time":"2020-01-01T11:00:00+00:00",
+    "start_time":"2020-01-01T12:00:00+00:00",
+    "end_time":"2020-01-02T13:00:00+00:00",
+    "result": "FAILURE",
+    "deploymentCommits":[
+       {
+           "repo_url":"repo-1",
+           "name":"optional, if null, it will be deployment for {commit_sha}",
+           "ref_name": "optional-release-v0.17",
+           "commit_sha":"c1",
+           "commit_msg":"optional-msg-1"
+       },
+       {
+           "repo_url":"repo-2",
+           "name":"optional, if null, it will be deployment for {commit_sha}",
+           "ref_name": "optional-release-v0.17",
+           "commit_sha":"c2",
+           "commit_msg":"optional-msg-2"
+       }
+    ]
+  }'
+```
 
 If you have set a [username/password](GettingStarted/Authentication.md) for Config UI, you'll need to add them to the curl command to register a `deployment`:
 
 ```
 curl <devlake-host>/api/rest/plugins/webhook/1/deployments -X 'POST' -u 'username:password' -d '{
-    "commit_sha":"015e3d3b480e417aede5a1293bd61de9b0fd051d",
-    "repo_url":"https://github.com/apache/incubator-devlake/",
+    "deploymentCommits":[
+        {
+        "commit_sha":"the sha of deployment commit1",
+        "repo_url":"the repo URL of the deployment commit"
+        }
+    ],
     "start_time":"2020-01-01T12:00:00+00:00",
     "end_time":"2020-01-02T12:00:00+00:00"
   }'
diff --git a/static/img/ConfigUI/webhook-add-data-connections.png b/static/img/ConfigUI/webhook-add-data-connections.png
index 4b1b050893..2000f04de7 100644
Binary files a/static/img/ConfigUI/webhook-add-data-connections.png and b/static/img/ConfigUI/webhook-add-data-connections.png differ
diff --git a/static/img/ConfigUI/webhook-connection.png b/static/img/ConfigUI/webhook-connection.png
deleted file mode 100644
index 231830b155..0000000000
Binary files a/static/img/ConfigUI/webhook-connection.png and /dev/null differ
diff --git a/static/img/ConfigUI/webhook-connection1.png b/static/img/ConfigUI/webhook-connection1.png
new file mode 100644
index 0000000000..cb0d8951b8
Binary files /dev/null and b/static/img/ConfigUI/webhook-connection1.png differ
diff --git a/static/img/ConfigUI/webhook-connection2.png b/static/img/ConfigUI/webhook-connection2.png
new file mode 100644
index 0000000000..d6d5fddffc
Binary files /dev/null and b/static/img/ConfigUI/webhook-connection2.png differ