Skip to content

Webhooks not working in SSH mode when SSH hostname is different from web UI hostname #3720

@sestegra

Description

@sestegra

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

After receiving a webhook, gitjob doesn't evaluate it, because it can't find related GitRepo object.
As the find query is only based on Web hostname, no GitRepo is found by this query.

See parsePayload function
https://github.com/rancher/fleet/blob/main/pkg/webhook/webhook.go#L272

Expected Behavior

Received webhooks must be evaluated using the SSH URLs as well.

Steps To Reproduce

  1. Install Rancher 2.11.2 with URL equals to rancher.my.labs
  2. Deploy Ingress for Fleet Webhook
  3. Install Gitea/Forgejo/Gogs with HTTP URL equals to gitea.my.labs and SSH URL equals to gitea-ssh.my.labs(different hostname)
  4. Add GitRepo using repo: git@gitea-ssh.my.labs:fruit-salad/orange.git

Environment

- Architecture: amd64
- Fleet Version: 0.12.3
- Cluster:
  - Provider: RKE2
  - Options:
  - Kubernetes Version: v1.32.4+rke2r1

Logs

`gitjob` logs, only webhook payload is displayed, no further logs.

2025-05-26T12:17:55Z	DEBUG	webhook	Webhook payload	{"payload": {"ref":"refs/heads/main","before":"c910bb893ccdc56f6e8c0a39f6b3dac7839c2b5d","after":"be4a7eac8027c19e604dba9b31688f0f44d94dac","compare_url":"https://gitea.my.labs/fruit-salad/orange/compare/c910bb893ccdc56f6e8c0a39f6b3dac7839c2b5d...be4a7eac8027c19e604dba9b31688f0f44d94dac","commits":[{"id":"be4a7eac8027c19e604dba9b31688f0f44d94dac","message":"Update README.md\n","url":"https://gitea.my.labs/fruit-salad/orange/commit/be4a7eac8027c19e604dba9b31688f0f44d94dac","author":{"name":"root","email":"root@gitea.my.labs","username":"root"},"committer":{"name":"root","email":"root@gitea.my.labs","username":"root"},"added":[],"removed":[],"modified":["README.md"],"timestamp":"2025-05-26T12:17:51Z"}],"repository":{"id":2,"owner":{"id":5,"username":"fruit-salad","login":"fruit-salad","full_name":"","email":"","avatar_url":"https://gitea.my.labs/avatars/f141c59cb23e486c17f824d950eeca69"},"name":"orange","full_name":"fruit-salad/orange","description":"Orange is a project for managing orange service.","private":true,"unlisted":false,"fork":false,"parent":null,"empty":false,"mirror":false,"size":80,"html_url":"https://gitea.my.labs/fruit-salad/orange","ssh_url":"git@gitea-ssh.my.labs:fruit-salad/orange.git","clone_url":"https://gitea.my.labs/fruit-salad/orange.git","website":"","stars_count":0,"forks_count":0,"watchers_count":1,"open_issues_count":0,"default_branch":"main","created_at":"2025-05-26T07:55:24Z","updated_at":"2025-05-26T12:16:16Z","permissions":{"admin":true,"push":true,"pull":true}},"pusher":{"id":1,"username":"root","login":"root","full_name":"","email":"root@noreply.gitea.my.labs","avatar_url":"https://gitea.my.labs/avatars/6eecda161b118df90f110d5e71d26ab6"},"sender":{"id":1,"username":"root","login":"root","full_name":"","email":"root@noreply.gitea.my.labs","avatar_url":"https://gitea.my.labs/avatars/6eecda161b118df90f110d5e71d26ab6"}}}


Formatted payload

{
  "payload": {
    "ref": "refs/heads/main",
    "before": "c910bb893ccdc56f6e8c0a39f6b3dac7839c2b5d",
    "after": "be4a7eac8027c19e604dba9b31688f0f44d94dac",
    "compare_url": "https://gitea.my.labs/fruit-salad/orange/compare/c910bb893ccdc56f6e8c0a39f6b3dac7839c2b5d...be4a7eac8027c19e604dba9b31688f0f44d94dac",
    "commits": [
      {
        "id": "be4a7eac8027c19e604dba9b31688f0f44d94dac",
        "message": "Update README.md\n",
        "url": "https://gitea.my.labs/fruit-salad/orange/commit/be4a7eac8027c19e604dba9b31688f0f44d94dac",
        "author": {
          "name": "root",
          "email": "root@gitea.my.labs",
          "username": "root"
        },
        "committer": {
          "name": "root",
          "email": "root@gitea.my.labs",
          "username": "root"
        },
        "added": [],
        "removed": [],
        "modified": [
          "README.md"
        ],
        "timestamp": "2025-05-26T12:17:51Z"
      }
    ],
    "repository": {
      "id": 2,
      "owner": {
        "id": 5,
        "username": "fruit-salad",
        "login": "fruit-salad",
        "full_name": "",
        "email": "",
        "avatar_url": "https://gitea.my.labs/avatars/f141c59cb23e486c17f824d950eeca69"
      },
      "name": "orange",
      "full_name": "fruit-salad/orange",
      "description": "Orange is a project for managing orange service.",
      "private": true,
      "unlisted": false,
      "fork": false,
      "parent": null,
      "empty": false,
      "mirror": false,
      "size": 80,
      "html_url": "https://gitea.my.labs/fruit-salad/orange",
      "ssh_url": "git@gitea-ssh.my.labs:fruit-salad/orange.git",
      "clone_url": "https://gitea.my.labs/fruit-salad/orange.git",
      "website": "",
      "stars_count": 0,
      "forks_count": 0,
      "watchers_count": 1,
      "open_issues_count": 0,
      "default_branch": "main",
      "created_at": "2025-05-26T07:55:24Z",
      "updated_at": "2025-05-26T12:16:16Z",
      "permissions": {
        "admin": true,
        "push": true,
        "pull": true
      }
    },
    "pusher": {
      "id": 1,
      "username": "root",
      "login": "root",
      "full_name": "",
      "email": "root@noreply.gitea.my.labs",
      "avatar_url": "https://gitea.my.labs/avatars/6eecda161b118df90f110d5e71d26ab6"
    },
    "sender": {
      "id": 1,
      "username": "root",
      "login": "root",
      "full_name": "",
      "email": "root@noreply.gitea.my.labs",
      "avatar_url": "https://gitea.my.labs/avatars/6eecda161b118df90f110d5e71d26ab6"
    }
  }
}

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    Status

    📋 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions