]> git.lizzy.rs Git - cheatdb.git/commitdiff
Fix webhook issues, make repo URLs matched case insensitive
authorrubenwardy <rw@rubenwardy.com>
Wed, 3 Jun 2020 15:32:39 +0000 (16:32 +0100)
committerrubenwardy <rw@rubenwardy.com>
Wed, 3 Jun 2020 15:32:39 +0000 (16:32 +0100)
app/blueprints/github/__init__.py
app/blueprints/gitlab/__init__.py
app/flatpages/help/release_webhooks.md

index 2eb4f64c9e371716aa0050e0efc9724f0410b4f5..bc839222f1dbb4d21e00b6dcc51c086f5108e796 100644 (file)
@@ -90,9 +90,9 @@ def webhook():
 
        # Get package
        github_url = "github.com/" + json["repository"]["full_name"]
-       package = Package.query.filter(Package.repo.like("%{}%".format(github_url))).first()
+       package = Package.query.filter(Package.repo.ilike("%{}%".format(github_url))).first()
        if package is None:
-               return error(400, "Could not find package, did you set the VCS repo in CDB correctly?")
+               return error(400, "Could not find package, did you set the VCS repo in CDB correctly? Expected {}".format(github_url))
 
        # Get all tokens for package
        tokens_query = APIToken.query.filter(or_(APIToken.package==package,
index 84061d7dc4f8aa93936db87570005bfce718be7c..18ce8c2e955f4317bc0fa4b6de5524eaaf2f79a6 100644 (file)
@@ -30,9 +30,9 @@ def webhook():
 
        # Get package
        gitlab_url = "gitlab.com/{}/{}".format(json["project"]["namespace"], json["project"]["name"])
-       package = Package.query.filter(Package.repo.like("%{}%".format(gitlab_url))).first()
+       package = Package.query.filter(Package.repo.ilike("%{}%".format(gitlab_url))).first()
        if package is None:
-               return error(400, "Unknown package")
+               return error(400, "Could not find package, did you set the VCS repo in CDB correctly? Expected {}".format(gitlab_url))
 
        # Get all tokens for package
        secret = request.headers.get("X-Gitlab-Token")
index 438226e7ad8aa88907ef01eaf24350a8e07832ef..b99831b087af898c3949a418d321767ac26bdb6f 100644 (file)
@@ -36,9 +36,9 @@ The process is as follows:
 
 ### GitHub (manual)
 
-1. Create an API Token by visiting your profile and clicking "API Tokens: Manage".
+1. Create a ContentDB API Token by visiting your profile and clicking "API Tokens: Manage".
 2. Copy the access token that was generated.
-3. Go to the repository's settings > Webhooks > Add Webhook.
+3. Go to the GitLab repository's settings > Webhooks > Add Webhook.
 4. Set the payload URL to `https://content.minetest.net/github/webhook/`
 5. Set the content type to JSON.
 6. Set the secret to the access token that you copied.
@@ -46,18 +46,20 @@ The process is as follows:
   * If you want a rolling release, choose "just the push event".
   * Or if you want a stable release cycle based on tags,
     choose "Let me select" > Branch or tag creation.
+8. Create.
 
 ### GitLab (manual)
 
-1. Create an API Token by visiting your profile and clicking "API Tokens: Manage".
+1. Create a ContentDB API Token by visiting your profile and clicking "API Tokens: Manage".
 2. Copy the access token that was generated.
-3. Go to the repository's settings > Integrations.
+3. Go to the GitLab repository's settings > Webhooks.
 4. Set the URL to `https://content.minetest.net/gitlab/webhook/`
-6. Set the secret token to the access token that you copied.
+6. Set the secret token to the ContentDB access token that you copied.
 7. Set the events
     * If you want a rolling release, choose "Push events".
     * Or if you want a stable release cycle based on tags,
       choose "Tag push events".
+8. Add webhook.
 
 ## Configuring