Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.10] Backport of [SURE-9190]New commits from webhook should trigger deployments, but disablePolling for gitrepo prevents new deployments #3003

Closed
1 task done
0xavi0 opened this issue Oct 24, 2024 · 1 comment
Assignees
Milestone

Comments

@0xavi0
Copy link
Contributor

0xavi0 commented Oct 24, 2024

Backport of #2969

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When disablePolling is enabled in a Git repository, Fleet fetches the latest commit but does not apply it to the deployment. The same behavior is observed with Azure DevOps.

Expected Behavior

when disablePolling set in gitrepo, New commits from webhook should trigger deployments

Steps To Reproduce

  1. Install rancher 2.9.2 / fleet v0.10.3 (enable debug logging on fleet)
  2. configure the Fleet webhook
  3. create a girepo using example with simple path and set disablePolling: true
  4. update the deployment (ex: change the replicas count to a higher number)
  5. Notice the Fleet fetches the new commit in the gitrepo...
  6. gitjob pod logs shows a webhook payload.
2024-10-21T09:46:20Z	DEBUG	webhook	Webhook payload	{"payload": {"ref":"refs/heads/main","before":"bf810dec76b610ba01271b6899306b63189c6eba","after":"afa5f4f644233e16f65ee3251d0522358d72fc02","created":false,"deleted":false,"forced":false,"base_ref":null,"compare":"https://github.com/xxx/test/compare/bf810dec76b6...afa5f4f64423","commits":[{"sha":"","id":"afa5f4f644233e16f65ee3251d0522358d72fc02","node_id":"","tree_id":"7bbe0c768f77fda465980cc5e2597bd50615f11b","distinct":true,"message":"Update deployment.yaml","timestamp":"2024-10-21T15:16:18+05:30","url":"https://github.
  1. until I force update the gitrepo, there is no job created with the latest commit

Environment

- Architecture: x86_64
- Fleet Version: 0.10.3
- Cluster: local
  - Provider: custom
  - Options:
  - Kubernetes Version: 1.28

Logs

2024-10-21T10: 50: 26Z	DEBUG	webhook	Webhook payload	{
    "payload": {
        "ref": "refs/heads/main",
        "before": "afa5f4f644233e16f65ee3251d0522358d72fc02",
        "after": "797aa0b191af4b6f386eb8ccefc929c9baf8f35b",
        "created": false,
        "deleted": false,
        "forced": false,
        "base_ref": null,
        "compare": "https://github.com/xxxxxx/test/compare/afa5f4f64423...797aa0b191af",
        "commits": [
            {
                "sha": "",
                "id": "797aa0b191af4b6f386eb8ccefc929c9baf8f35b",
                "node_id": "",
                "tree_id": "28939fa43e9fa0c1724ecd392aca5d0d599d690e",
                "distinct": true,
                "message": "Update deployment.yaml",
                "timestamp": "2024-10-21T16:20:24+05:30",
                "url": "https://github.com/xxxxxx/test/commit/797aa0b191af4b6f386eb8ccefc929c9baf8f35b",
                "author": {
                    "name": "xxxxxx",
                    "email": "[email protected]",
                    "username": "xxxxxx"
                },
                "committer": {
                    "name": "GitHub",
                    "email": "[email protected]",
                    "username": "web-flow"
                },
                "added": [],
                "removed": [],
                "modified": [
                    "helloapp/deployment.yaml"
                ]
            }
        ],
        "head_commit": {
            "id": "797aa0b191af4b6f386eb8ccefc929c9baf8f35b",
            "node_id": "",
            "tree_id": "28939fa43e9fa0c1724ecd392aca5d0d599d690e",
            "distinct": true,
            "message": "Update deployment.yaml",
            "timestamp": "2024-10-21T16:20:24+05:30",
            "url": "https://github.com/xxxxxx/test/commit/797aa0b191af4b6f386eb8ccefc929c9baf8f35b",
            "author": {
                "name": "xxxxxx",
                "email": "[email protected]",
                "username": "xxxxxx"
            },
            "committer": {
                "name": "GitHub",
                "email": "[email protected]",
                "username": "web-flow"
            },
            "added": [],
            "removed": [],
            "modified": [
                "helloapp/deployment.yaml"
            ]
        },
        "repository": {
            "id": 873356537,
            "node_id": "R_kgDONA5c-Q",
            "name": "test",
            "full_name": "xxxxxx/test",
            "owner": {
                "login": "xxxxxx",
                "id": 53037653,
                "node_id": "MDQ6VXNlcjUzMDM3NjUz",
                "avatar_url": "https://avatars.githubusercontent.com/u/53037653?v=4",
                "gravatar_id": "",
                "url": "https://api.github.com/users/xxxxxx",
                "html_url": "https://github.com/xxxxxx",
                "followers_url": "https://api.github.com/users/xxxxxx/followers",
                "following_url": "https://api.github.com/users/xxxxxx/following{/other_user}",
                "gists_url": "https://api.github.com/users/xxxxxx/gists{/gist_id}",
                "starred_url": "https://api.github.com/users/xxxxxx/starred{/owner}{/repo}",
                "subscriptions_url": "https://api.github.com/users/xxxxxx/subscriptions",
                "organizations_url": "https://api.github.com/users/xxxxxx/orgs",
                "repos_url": "https://api.github.com/users/xxxxxx/repos",
                "events_url": "https://api.github.com/users/xxxxxx/events{/privacy}",
                "received_events_url": "https://api.github.com/users/xxxxxx/received_events",
                "type": "User",
                "site_admin": false
            },
            "private": false,
            "html_url": "https://github.com/xxxxxx/test",
            "description": "",
            "fork": false,
            "url": "https://github.com/xxxxxx/test",
            "forks_url": "https://api.github.com/repos/xxxxxx/test/forks",
            "keys_url": "https://api.github.com/repos/xxxxxx/test/keys{/key_id}",
            "collaborators_url": "https://api.github.com/repos/xxxxxx/test/collaborators{/collaborator}",
            "teams_url": "https://api.github.com/repos/xxxxxx/test/teams",
            "hooks_url": "https://api.github.com/repos/xxxxxx/test/hooks",
            "issue_events_url": "https://api.github.com/repos/xxxxxx/test/issues/events{/number}",
            "events_url": "https://api.github.com/repos/xxxxxx/test/events",
            "assignees_url": "https://api.github.com/repos/xxxxxx/test/assignees{/user}",
            "branches_url": "https://api.github.com/repos/xxxxxx/test/branches{/branch}",
            "tags_url": "https://api.github.com/repos/xxxxxx/test/tags",
            "blobs_url": "https://api.github.com/repos/xxxxxx/test/git/blobs{/sha}",
            "git_tags_url": "https://api.github.com/repos/xxxxxx/test/git/tags{/sha}",
            "git_refs_url": "https://api.github.com/repos/xxxxxx/test/git/refs{/sha}",
            "trees_url": "https://api.github.com/repos/xxxxxx/test/git/trees{/sha}",
            "statuses_url": "https://api.github.com/repos/xxxxxx/test/statuses/{sha}",
            "languages_url": "https://api.github.com/repos/xxxxxx/test/languages",
            "stargazers_url": "https://api.github.com/repos/xxxxxx/test/stargazers",
            "contributors_url": "https://api.github.com/repos/xxxxxx/test/contributors",
            "subscribers_url": "https://api.github.com/repos/xxxxxx/test/subscribers",
            "subscription_url": "https://api.github.com/repos/xxxxxx/test/subscription",
            "commits_url": "https://api.github.com/repos/xxxxxx/test/commits{/sha}",
            "git_commits_url": "https://api.github.com/repos/xxxxxx/test/git/commits{/sha}",
            "comments_url": "https://api.github.com/repos/xxxxxx/test/comments{/number}",
            "issue_comment_url": "https://api.github.com/repos/xxxxxx/test/issues/comments{/number}",
            "contents_url": "https://api.github.com/repos/xxxxxx/test/contents/{+path}",
            "compare_url": "https://api.github.com/repos/xxxxxx/test/compare/{base}...{head}",
            "merges_url": "https://api.github.com/repos/xxxxxx/test/merges",
            "archive_url": "https://api.github.com/repos/xxxxxx/test/{archive_format}{/ref}",
            "downloads_url": "https://api.github.com/repos/xxxxxx/test/downloads",
            "issues_url": "https://api.github.com/repos/xxxxxx/test/issues{/number}",
            "pulls_url": "https://api.github.com/repos/xxxxxx/test/pulls{/number}",
            "milestones_url": "https://api.github.com/repos/xxxxxx/test/milestones{/number}",
            "notifications_url": "https://api.github.com/repos/xxxxxx/test/notifications{?since,all,participating}",
            "labels_url": "https://api.github.com/repos/xxxxxx/test/labels{/name}",
            "releases_url": "https://api.github.com/repos/xxxxxx/test/releases{/id}",
            "created_at": 1729047958,
            "updated_at": "2024-10-21T09:46:22Z",
            "pushed_at": 1729507825,
            "git_url": "git://github.com/xxxxxx/test.git",
            "ssh_url": "[email protected]:xxxxxx/test.git",
            "clone_url": "https://github.com/xxxxxx/test.git",
            "svn_url": "https://github.com/xxxxxx/test",
            "homepage": null,
            "size": 29,
            "stargazers_count": 0,
            "watchers_count": 0,
            "language": null,
            "has_issues": true,
            "has_downloads": true,
            "has_wiki": true,
            "has_pages": false,
            "forks_count": 0,
            "mirror_url": null,
            "open_issues_count": 0,
            "forks": 0,
            "open_issues": 0,
            "watchers": 0,
            "default_branch": "main",
            "stargazers": 0,
            "master_branch": "main"
        },
        "pusher": {
            "name": "xxxxxx",
            "email": "[email protected]"
        },
        "sender": {
            "login": "xxxxxx",
            "id": 53037653,
            "node_id": "MDQ6VXNlcjUzMDM3NjUz",
            "avatar_url": "https://avatars.githubusercontent.com/u/53037653?v=4",
            "gravatar_id": "",
            "url": "https://api.github.com/users/xxxxxx",
            "html_url": "https://github.com/xxxxxx",
            "followers_url": "https://api.github.com/users/xxxxxx/followers",
            "following_url": "https://api.github.com/users/xxxxxx/following{/other_user}",
            "gists_url": "https://api.github.com/users/xxxxxx/gists{/gist_id}",
            "starred_url": "https://api.github.com/users/xxxxxx/starred{/owner}{/repo}",
            "subscriptions_url": "https://api.github.com/users/xxxxxx/subscriptions",
            "organizations_url": "https://api.github.com/users/xxxxxx/orgs",
            "repos_url": "https://api.github.com/users/xxxxxx/repos",
            "events_url": "https://api.github.com/users/xxxxxx/events{/privacy}",
            "received_events_url": "https://api.github.com/users/xxxxxx/received_events",
            "type": "User",
            "site_admin": false
        },
        "installation": {
            "id": 0
        }
    }
}


### Anything else?

_No response_
@mmartin24
Copy link
Collaborator

Tested in with Rancher v2.9-5e27c2a5f9a245cad28ba209988eb7efb6b80447-head and fleet:104.1.1+up0.10.5-rc.1 deployed in GCP and working:


Steps done:

  • Created Github webhook with SSL verification disabled and Payload URL with https
  • Deployed above mentioned rancher version with 3 ds clusters. Passed as ingress reverse order of GCP ip with nip.io. Detailed steps here: Configure Github Webhook and Fleet
  • Deployed private gitrepo (https://github.com/fleetqa/webhook-private-test) with disablePoling=true ensuring solely webhook update its status.
  • Changed on Gitrepo amount of replicas and checked if changed is propagated immediately. This can be seen here:
Screencast.from.31-10-24.13.11.03.mov
  • Checked also 200 response on Webhook response:
    image

@github-project-automation github-project-automation bot moved this from Needs QA review to ✅ Done in Fleet Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants