{"action":"created","comment":{"url":"https://api.github.com/repos/ovh/cds/pulls/comments/199113366","pull_request_review_id":133168910,"id":199113366,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTExMzM2Ng==","diff_hunk":"@@ -487,15 +538,64 @@ func (api *API) detachRepositoriesManagerHandler() Handler {\n \t\t\treturn sdk.WrapError(err, \"detachRepositoriesManager> error on poller.DeleteAll\")\n \t\t}\n \n-\t\tif err := application.UpdateLastModified(tx, api.Cache, app, getUser(ctx)); err != nil {\n+\t\tif err := application.UpdateLastModified(tx, api.Cache, app, u); err != nil {\n \t\t\treturn sdk.WrapError(err, \"detachRepositoriesManager> Cannot update application last modified date\")\n \t\t}\n \n \t\tif err := tx.Commit(); err != nil {\n \t\t\treturn sdk.WrapError(err, \"detachRepositoriesManager> Cannot commit transaction\")\n \t\t}\n \n-\t\tevent.PublishApplicationRepositoryDelete(projectKey, appName, app.VCSServer, app.RepositoryFullname, getUser(ctx))\n+\t\tusage, errU := loadApplicationUsage(db, projectKey, appName)\n+\t\tif errU != nil {\n+\t\t\treturn sdk.WrapError(errU, \"detachRepositoriesManager> Cannot load application usage\")\n+\t\t}\n+\n+\t\t// Update default payload of linked workflow root\n+\t\tif len(usage.Workflows) > 0 {\n+\t\t\tproj, errP := project.Load(db, api.Cache, projectKey, u)\n+\t\t\tif errP != nil {\n+\t\t\t\treturn sdk.WrapError(errP, \"detachRepositoriesManager> Cannot load project\")\n+\t\t\t}\n+\n+\t\t\thookToDelete := map[string]sdk.WorkflowNodeHook{}\n+\t\t\tfor _, wf := range usage.Workflows {\n+\t\t\t\tnodeHooks, err := workflow.LoadHooksByNodeID(db, wf.RootID)\n+\t\t\t\tif err != nil {\n+\t\t\t\t\treturn sdk.WrapError(err, \"detachRepositoriesManager> Cannot load node hook by nodeID %d\", wf.RootID)\n+\t\t\t\t}\n+\n+\t\t\t\tfor _, nodeHook := range nodeHooks {\n+\t\t\t\t\tif nodeHook.WorkflowHookModel.Name != sdk.RepositoryWebHookModelName && nodeHook.WorkflowHookModel.Name != sdk.GitPollerModelName {\n+\t\t\t\t\t\tcontinue\n+\t\t\t\t\t}\n+\t\t\t\t\thookToDelete[nodeHook.UUID] = nodeHook\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif len(hookToDelete) > 0 {\n+\t\t\t\ttxDel, errTx := db.Begin()\n+\t\t\t\tif errTx != nil {\n+\t\t\t\t\treturn sdk.WrapError(errTx, \"detachRepositoriesManager> Cannot create delete transaction\")\n+\t\t\t\t}\n+\t\t\t\tdefer txDel.Rollback()","path":"engine/api/repositories_manager.go","position":193,"original_position":193,"commit_id":"8d20ee8bfe41cda26b295df48f114f3f3638d805","original_commit_id":"8d20ee8bfe41cda26b295df48f114f3f3638d805","user":{"login":"golangci","id":35628013,"node_id":"MDQ6VXNlcjM1NjI4MDEz","avatar_url":"https://avatars3.githubusercontent.com/u/35628013?v=4","gravatar_id":"","url":"https://api.github.com/users/golangci","html_url":"https://github.com/golangci","followers_url":"https://api.github.com/users/golangci/followers","following_url":"https://api.github.com/users/golangci/following{/other_user}","gists_url":"https://api.github.com/users/golangci/gists{/gist_id}","starred_url":"https://api.github.com/users/golangci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golangci/subscriptions","organizations_url":"https://api.github.com/users/golangci/orgs","repos_url":"https://api.github.com/users/golangci/repos","events_url":"https://api.github.com/users/golangci/events{/privacy}","received_events_url":"https://api.github.com/users/golangci/received_events","type":"User","site_admin":false},"body":"Error return value of `txDel.Rollback` is not checked","created_at":"2018-06-29T10:02:43Z","updated_at":"2018-06-29T10:02:43Z","html_url":"https://github.com/ovh/cds/pull/2976#discussion_r199113366","pull_request_url":"https://api.github.com/repos/ovh/cds/pulls/2976","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/ovh/cds/pulls/comments/199113366"},"html":{"href":"https://github.com/ovh/cds/pull/2976#discussion_r199113366"},"pull_request":{"href":"https://api.github.com/repos/ovh/cds/pulls/2976"}}},"pull_request":{"url":"https://api.github.com/repos/ovh/cds/pulls/2976","id":198270698,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MjcwNjk4","html_url":"https://github.com/ovh/cds/pull/2976","diff_url":"https://github.com/ovh/cds/pull/2976.diff","patch_url":"https://github.com/ovh/cds/pull/2976.patch","issue_url":"https://api.github.com/repos/ovh/cds/issues/2976","number":2976,"state":"open","locked":false,"title":"fix(api): when you update repomanager on an application, update workflow root linked","user":{"login":"bnjjj","id":5719034,"node_id":"MDQ6VXNlcjU3MTkwMzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5719034?v=4","gravatar_id":"","url":"https://api.github.com/users/bnjjj","html_url":"https://github.com/bnjjj","followers_url":"https://api.github.com/users/bnjjj/followers","following_url":"https://api.github.com/users/bnjjj/following{/other_user}","gists_url":"https://api.github.com/users/bnjjj/gists{/gist_id}","starred_url":"https://api.github.com/users/bnjjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnjjj/subscriptions","organizations_url":"https://api.github.com/users/bnjjj/orgs","repos_url":"https://api.github.com/users/bnjjj/repos","events_url":"https://api.github.com/users/bnjjj/events{/privacy}","received_events_url":"https://api.github.com/users/bnjjj/received_events","type":"User","site_admin":false},"body":"\r\nSigned-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>\r\n\r\n1. Description\r\n1. Related issues\r\n1. About tests\r\nclose  #2913\r\n1. Mentions\r\n\r\n@ovh/cds\r\n","created_at":"2018-06-29T09:59:04Z","updated_at":"2018-06-29T10:02:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5dca96ad0077624674fb3ddade664ed4a40f9265","assignee":null,"assignees":[],"requested_reviewers":[{"login":"yesnault","id":395454,"node_id":"MDQ6VXNlcjM5NTQ1NA==","avatar_url":"https://avatars3.githubusercontent.com/u/395454?v=4","gravatar_id":"","url":"https://api.github.com/users/yesnault","html_url":"https://github.com/yesnault","followers_url":"https://api.github.com/users/yesnault/followers","following_url":"https://api.github.com/users/yesnault/following{/other_user}","gists_url":"https://api.github.com/users/yesnault/gists{/gist_id}","starred_url":"https://api.github.com/users/yesnault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yesnault/subscriptions","organizations_url":"https://api.github.com/users/yesnault/orgs","repos_url":"https://api.github.com/users/yesnault/repos","events_url":"https://api.github.com/users/yesnault/events{/privacy}","received_events_url":"https://api.github.com/users/yesnault/received_events","type":"User","site_admin":false},{"login":"fsamin","id":684151,"node_id":"MDQ6VXNlcjY4NDE1MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/684151?v=4","gravatar_id":"","url":"https://api.github.com/users/fsamin","html_url":"https://github.com/fsamin","followers_url":"https://api.github.com/users/fsamin/followers","following_url":"https://api.github.com/users/fsamin/following{/other_user}","gists_url":"https://api.github.com/users/fsamin/gists{/gist_id}","starred_url":"https://api.github.com/users/fsamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsamin/subscriptions","organizations_url":"https://api.github.com/users/fsamin/orgs","repos_url":"https://api.github.com/users/fsamin/repos","events_url":"https://api.github.com/users/fsamin/events{/privacy}","received_events_url":"https://api.github.com/users/fsamin/received_events","type":"User","site_admin":false},{"login":"sguiheux","id":1478025,"node_id":"MDQ6VXNlcjE0NzgwMjU=","avatar_url":"https://avatars2.githubusercontent.com/u/1478025?v=4","gravatar_id":"","url":"https://api.github.com/users/sguiheux","html_url":"https://github.com/sguiheux","followers_url":"https://api.github.com/users/sguiheux/followers","following_url":"https://api.github.com/users/sguiheux/following{/other_user}","gists_url":"https://api.github.com/users/sguiheux/gists{/gist_id}","starred_url":"https://api.github.com/users/sguiheux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sguiheux/subscriptions","organizations_url":"https://api.github.com/users/sguiheux/orgs","repos_url":"https://api.github.com/users/sguiheux/repos","events_url":"https://api.github.com/users/sguiheux/events{/privacy}","received_events_url":"https://api.github.com/users/sguiheux/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":459183305,"node_id":"MDU6TGFiZWw0NTkxODMzMDU=","url":"https://api.github.com/repos/ovh/cds/labels/bug","name":"bug","color":"ee0701","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/ovh/cds/pulls/2976/commits","review_comments_url":"https://api.github.com/repos/ovh/cds/pulls/2976/comments","review_comment_url":"https://api.github.com/repos/ovh/cds/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ovh/cds/issues/2976/comments","statuses_url":"https://api.github.com/repos/ovh/cds/statuses/8d20ee8bfe41cda26b295df48f114f3f3638d805","head":{"label":"ovh:fix_#2913","ref":"fix_#2913","sha":"8d20ee8bfe41cda26b295df48f114f3f3638d805","user":{"login":"ovh","id":1698434,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTg0MzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1698434?v=4","gravatar_id":"","url":"https://api.github.com/users/ovh","html_url":"https://github.com/ovh","followers_url":"https://api.github.com/users/ovh/followers","following_url":"https://api.github.com/users/ovh/following{/other_user}","gists_url":"https://api.github.com/users/ovh/gists{/gist_id}","starred_url":"https://api.github.com/users/ovh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovh/subscriptions","organizations_url":"https://api.github.com/users/ovh/orgs","repos_url":"https://api.github.com/users/ovh/repos","events_url":"https://api.github.com/users/ovh/events{/privacy}","received_events_url":"https://api.github.com/users/ovh/received_events","type":"Organization","site_admin":false},"repo":{"id":70572539,"node_id":"MDEwOlJlcG9zaXRvcnk3MDU3MjUzOQ==","name":"cds","full_name":"ovh/cds","owner":{"login":"ovh","id":1698434,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTg0MzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1698434?v=4","gravatar_id":"","url":"https://api.github.com/users/ovh","html_url":"https://github.com/ovh","followers_url":"https://api.github.com/users/ovh/followers","following_url":"https://api.github.com/users/ovh/following{/other_user}","gists_url":"https://api.github.com/users/ovh/gists{/gist_id}","starred_url":"https://api.github.com/users/ovh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovh/subscriptions","organizations_url":"https://api.github.com/users/ovh/orgs","repos_url":"https://api.github.com/users/ovh/repos","events_url":"https://api.github.com/users/ovh/events{/privacy}","received_events_url":"https://api.github.com/users/ovh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ovh/cds","description":"Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform","fork":false,"url":"https://api.github.com/repos/ovh/cds","forks_url":"https://api.github.com/repos/ovh/cds/forks","keys_url":"https://api.github.com/repos/ovh/cds/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ovh/cds/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ovh/cds/teams","hooks_url":"https://api.github.com/repos/ovh/cds/hooks","issue_events_url":"https://api.github.com/repos/ovh/cds/issues/events{/number}","events_url":"https://api.github.com/repos/ovh/cds/events","assignees_url":"https://api.github.com/repos/ovh/cds/assignees{/user}","branches_url":"https://api.github.com/repos/ovh/cds/branches{/branch}","tags_url":"https://api.github.com/repos/ovh/cds/tags","blobs_url":"https://api.github.com/repos/ovh/cds/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ovh/cds/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ovh/cds/git/refs{/sha}","trees_url":"https://api.github.com/repos/ovh/cds/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ovh/cds/statuses/{sha}","languages_url":"https://api.github.com/repos/ovh/cds/languages","stargazers_url":"https://api.github.com/repos/ovh/cds/stargazers","contributors_url":"https://api.github.com/repos/ovh/cds/contributors","subscribers_url":"https://api.github.com/repos/ovh/cds/subscribers","subscription_url":"https://api.github.com/repos/ovh/cds/subscription","commits_url":"https://api.github.com/repos/ovh/cds/commits{/sha}","git_commits_url":"https://api.github.com/repos/ovh/cds/git/commits{/sha}","comments_url":"https://api.github.com/repos/ovh/cds/comments{/number}","issue_comment_url":"https://api.github.com/repos/ovh/cds/issues/comments{/number}","contents_url":"https://api.github.com/repos/ovh/cds/contents/{+path}","compare_url":"https://api.github.com/repos/ovh/cds/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ovh/cds/merges","archive_url":"https://api.github.com/repos/ovh/cds/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ovh/cds/downloads","issues_url":"https://api.github.com/repos/ovh/cds/issues{/number}","pulls_url":"https://api.github.com/repos/ovh/cds/pulls{/number}","milestones_url":"https://api.github.com/repos/ovh/cds/milestones{/number}","notifications_url":"https://api.github.com/repos/ovh/cds/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ovh/cds/labels{/name}","releases_url":"https://api.github.com/repos/ovh/cds/releases{/id}","deployments_url":"https://api.github.com/repos/ovh/cds/deployments","created_at":"2016-10-11T08:28:23Z","updated_at":"2018-06-29T09:03:56Z","pushed_at":"2018-06-29T09:59:04Z","git_url":"git://github.com/ovh/cds.git","ssh_url":"git@github.com:ovh/cds.git","clone_url":"https://github.com/ovh/cds.git","svn_url":"https://github.com/ovh/cds","homepage":"https://ovh.github.io/cds/","size":98485,"stargazers_count":272,"watchers_count":272,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":53,"mirror_url":null,"archived":false,"open_issues_count":136,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":53,"open_issues":136,"watchers":272,"default_branch":"master"}},"base":{"label":"ovh:master","ref":"master","sha":"4a4457941aefff2380b89241e48b3eb2e5733457","user":{"login":"ovh","id":1698434,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTg0MzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1698434?v=4","gravatar_id":"","url":"https://api.github.com/users/ovh","html_url":"https://github.com/ovh","followers_url":"https://api.github.com/users/ovh/followers","following_url":"https://api.github.com/users/ovh/following{/other_user}","gists_url":"https://api.github.com/users/ovh/gists{/gist_id}","starred_url":"https://api.github.com/users/ovh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovh/subscriptions","organizations_url":"https://api.github.com/users/ovh/orgs","repos_url":"https://api.github.com/users/ovh/repos","events_url":"https://api.github.com/users/ovh/events{/privacy}","received_events_url":"https://api.github.com/users/ovh/received_events","type":"Organization","site_admin":false},"repo":{"id":70572539,"node_id":"MDEwOlJlcG9zaXRvcnk3MDU3MjUzOQ==","name":"cds","full_name":"ovh/cds","owner":{"login":"ovh","id":1698434,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2OTg0MzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1698434?v=4","gravatar_id":"","url":"https://api.github.com/users/ovh","html_url":"https://github.com/ovh","followers_url":"https://api.github.com/users/ovh/followers","following_url":"https://api.github.com/users/ovh/following{/other_user}","gists_url":"https://api.github.com/users/ovh/gists{/gist_id}","starred_url":"https://api.github.com/users/ovh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovh/subscriptions","organizations_url":"https://api.github.com/users/ovh/orgs","repos_url":"https://api.github.com/users/ovh/repos","events_url":"https://api.github.com/users/ovh/events{/privacy}","received_events_url":"https://api.github.com/users/ovh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ovh/cds","description":"Enterprise-Grade Continuous Delivery & DevOps Automation Open Source Platform","fork":false,"url":"https://api.github.com/repos/ovh/cds","forks_url":"https://api.github.com/repos/ovh/cds/forks","keys_url":"https://api.github.com/repos/ovh/cds/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ovh/cds/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ovh/cds/teams","hooks_url":"https://api.github.com/repos/ovh/cds/hooks","issue_events_url":"https://api.github.com/repos/ovh/cds/issues/events{/number}","events_url":"https://api.github.com/repos/ovh/cds/events","assignees_url":"https://api.github.com/repos/ovh/cds/assignees{/user}","branches_url":"https://api.github.com/repos/ovh/cds/branches{/branch}","tags_url":"https://api.github.com/repos/ovh/cds/tags","blobs_url":"https://api.github.com/repos/ovh/cds/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ovh/cds/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ovh/cds/git/refs{/sha}","trees_url":"https://api.github.com/repos/ovh/cds/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ovh/cds/statuses/{sha}","languages_url":"https://api.github.com/repos/ovh/cds/languages","stargazers_url":"https://api.github.com/repos/ovh/cds/stargazers","contributors_url":"https://api.github.com/repos/ovh/cds/contributors","subscribers_url":"https://api.github.com/repos/ovh/cds/subscribers","subscription_url":"https://api.github.com/repos/ovh/cds/subscription","commits_url":"https://api.github.com/repos/ovh/cds/commits{/sha}","git_commits_url":"https://api.github.com/repos/ovh/cds/git/commits{/sha}","comments_url":"https://api.github.com/repos/ovh/cds/comments{/number}","issue_comment_url":"https://api.github.com/repos/ovh/cds/issues/comments{/number}","contents_url":"https://api.github.com/repos/ovh/cds/contents/{+path}","compare_url":"https://api.github.com/repos/ovh/cds/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ovh/cds/merges","archive_url":"https://api.github.com/repos/ovh/cds/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ovh/cds/downloads","issues_url":"https://api.github.com/repos/ovh/cds/issues{/number}","pulls_url":"https://api.github.com/repos/ovh/cds/pulls{/number}","milestones_url":"https://api.github.com/repos/ovh/cds/milestones{/number}","notifications_url":"https://api.github.com/repos/ovh/cds/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ovh/cds/labels{/name}","releases_url":"https://api.github.com/repos/ovh/cds/releases{/id}","deployments_url":"https://api.github.com/repos/ovh/cds/deployments","created_at":"2016-10-11T08:28:23Z","updated_at":"2018-06-29T09:03:56Z","pushed_at":"2018-06-29T09:59:04Z","git_url":"git://github.com/ovh/cds.git","ssh_url":"git@github.com:ovh/cds.git","clone_url":"https://github.com/ovh/cds.git","svn_url":"https://github.com/ovh/cds","homepage":"https://ovh.github.io/cds/","size":98485,"stargazers_count":272,"watchers_count":272,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":53,"mirror_url":null,"archived":false,"open_issues_count":136,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":53,"open_issues":136,"watchers":272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ovh/cds/pulls/2976"},"html":{"href":"https://github.com/ovh/cds/pull/2976"},"issue":{"href":"https://api.github.com/repos/ovh/cds/issues/2976"},"comments":{"href":"https://api.github.com/repos/ovh/cds/issues/2976/comments"},"review_comments":{"href":"https://api.github.com/repos/ovh/cds/pulls/2976/comments"},"review_comment":{"href":"https://api.github.com/repos/ovh/cds/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ovh/cds/pulls/2976/commits"},"statuses":{"href":"https://api.github.com/repos/ovh/cds/statuses/8d20ee8bfe41cda26b295df48f114f3f3638d805"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"golangci"}}