{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments/170394957","pull_request_review_id":99084572,"id":170394957,"diff_hunk":"@@ -153,3 +156,97 @@ func isUserTrusted(ghc githubClient, user, trustedOrg, org string) (bool, error)\n \t}\n \treturn orgMember, nil\n }\n+\n+func runOrSkipRequested(c client, pr *github.PullRequest, requestedJobs []config.Presubmit, forceRunContexts map[string]bool, body, eventGUID string) error {\n+\torg := pr.Base.Repo.Owner.Login\n+\trepo := pr.Base.Repo.Name\n+\tnumber := pr.Number\n+\n+\tbaseSHA, err := c.GitHubClient.GetRef(org, repo, \"heads/\"+pr.Base.Ref)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tgetChanges := fileChangesGetter(c.GitHubClient, org, repo, number)\n+\t// shouldRun indicates if a job should actually run.\n+\tshouldRun := func(j config.Presubmit) (bool, error) {\n+\t\tif !j.RunsAgainstBranch(pr.Base.Ref) {\n+\t\t\treturn false, nil\n+\t\t}\n+\t\tif j.RunIfChanged == \"\" || forceRunContexts[j.Context] || j.TriggerMatches(body) {\n+\t\t\treturn true, nil\n+\t\t}\n+\t\tchanges, err := getChanges()\n+\t\tif err != nil {\n+\t\t\treturn false, err\n+\t\t}\n+\t\treturn j.RunsAgainstChanges(changes), nil\n+\t}\n+\n+\t// For each job determine if any sharded version of the job runs.\n+\t// This in turn determines which jobs to run and which contexts to mark as \"Skipped\".\n+\t//\n+\t// Note: Jobs sharding is achieved with presubit configurations that overlap on","path":"prow/plugins/trigger/trigger.go","position":null,"original_position":47,"commit_id":"083ff186a3c3ae26ddaa0e9d5e3794776882fef8","original_commit_id":"0f3738308248faa7deaaad9ff8bbfedc27229c14","user":{"login":"cjwagner","id":5334145,"avatar_url":"https://avatars3.githubusercontent.com/u/5334145?v=4","gravatar_id":"","url":"https://api.github.com/users/cjwagner","html_url":"https://github.com/cjwagner","followers_url":"https://api.github.com/users/cjwagner/followers","following_url":"https://api.github.com/users/cjwagner/following{/other_user}","gists_url":"https://api.github.com/users/cjwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/cjwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjwagner/subscriptions","organizations_url":"https://api.github.com/users/cjwagner/orgs","repos_url":"https://api.github.com/users/cjwagner/repos","events_url":"https://api.github.com/users/cjwagner/events{/privacy}","received_events_url":"https://api.github.com/users/cjwagner/received_events","type":"User","site_admin":false},"body":"Fixed.","created_at":"2018-02-23T23:41:36Z","updated_at":"2018-02-23T23:41:36Z","html_url":"https://github.com/kubernetes/test-infra/pull/6815#discussion_r170394957","pull_request_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments/170394957"},"html":{"href":"https://github.com/kubernetes/test-infra/pull/6815#discussion_r170394957"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815"}},"in_reply_to_id":170269999},"pull_request":{"url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815","id":169035471,"html_url":"https://github.com/kubernetes/test-infra/pull/6815","diff_url":"https://github.com/kubernetes/test-infra/pull/6815.diff","patch_url":"https://github.com/kubernetes/test-infra/pull/6815.patch","issue_url":"https://api.github.com/repos/kubernetes/test-infra/issues/6815","number":6815,"state":"open","locked":false,"title":"Reduce repetitive code in trigger plugin and fix bug with branch sharded jobs.","user":{"login":"cjwagner","id":5334145,"avatar_url":"https://avatars3.githubusercontent.com/u/5334145?v=4","gravatar_id":"","url":"https://api.github.com/users/cjwagner","html_url":"https://github.com/cjwagner","followers_url":"https://api.github.com/users/cjwagner/followers","following_url":"https://api.github.com/users/cjwagner/following{/other_user}","gists_url":"https://api.github.com/users/cjwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/cjwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjwagner/subscriptions","organizations_url":"https://api.github.com/users/cjwagner/orgs","repos_url":"https://api.github.com/users/cjwagner/repos","events_url":"https://api.github.com/users/cjwagner/events{/privacy}","received_events_url":"https://api.github.com/users/cjwagner/received_events","type":"User","site_admin":false},"body":"The bug is a problem with skipping branch sharded jobs that affects the `buildAll` function used to handle `pull_request` events. (`/test` and `/retest` commands are working properly.)\r\nSpecifically each job that didn't need to run would mark the status context as skipped before the shard that actually runs sets the status to \"Job triggered\".  In addition to being confusing to users, this wastes API tokens, and is a potential race if requests arrive to Github in the wrong order. Switching `buildAll` to share the logic from comment handling fixes this.\r\n\r\n/area prow\r\n/kind bug","created_at":"2018-02-14T07:01:28Z","updated_at":"2018-02-23T23:41:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eab76c6a8fade8738c60e7db0d7fa6123625ec7e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"BenTheElder","id":917931,"avatar_url":"https://avatars2.githubusercontent.com/u/917931?v=4","gravatar_id":"","url":"https://api.github.com/users/BenTheElder","html_url":"https://github.com/BenTheElder","followers_url":"https://api.github.com/users/BenTheElder/followers","following_url":"https://api.github.com/users/BenTheElder/following{/other_user}","gists_url":"https://api.github.com/users/BenTheElder/gists{/gist_id}","starred_url":"https://api.github.com/users/BenTheElder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenTheElder/subscriptions","organizations_url":"https://api.github.com/users/BenTheElder/orgs","repos_url":"https://api.github.com/users/BenTheElder/repos","events_url":"https://api.github.com/users/BenTheElder/events{/privacy}","received_events_url":"https://api.github.com/users/BenTheElder/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":705940018,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/approved","name":"approved","color":"0ffa16","default":false},{"id":412127043,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/area/prow","name":"area/prow","color":"0052cc","default":false},{"id":484580953,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":522887185,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/kind/bug","name":"kind/bug","color":"e11d21","default":false},{"id":671133125,"url":"https://api.github.com/repos/kubernetes/test-infra/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815/commits","review_comments_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815/comments","review_comment_url":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/test-infra/issues/6815/comments","statuses_url":"https://api.github.com/repos/kubernetes/test-infra/statuses/083ff186a3c3ae26ddaa0e9d5e3794776882fef8","head":{"label":"cjwagner:trigger-change-no-99999999","ref":"trigger-change-no-99999999","sha":"083ff186a3c3ae26ddaa0e9d5e3794776882fef8","user":{"login":"cjwagner","id":5334145,"avatar_url":"https://avatars3.githubusercontent.com/u/5334145?v=4","gravatar_id":"","url":"https://api.github.com/users/cjwagner","html_url":"https://github.com/cjwagner","followers_url":"https://api.github.com/users/cjwagner/followers","following_url":"https://api.github.com/users/cjwagner/following{/other_user}","gists_url":"https://api.github.com/users/cjwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/cjwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjwagner/subscriptions","organizations_url":"https://api.github.com/users/cjwagner/orgs","repos_url":"https://api.github.com/users/cjwagner/repos","events_url":"https://api.github.com/users/cjwagner/events{/privacy}","received_events_url":"https://api.github.com/users/cjwagner/received_events","type":"User","site_admin":false},"repo":{"id":87842138,"name":"test-infra","full_name":"cjwagner/test-infra","owner":{"login":"cjwagner","id":5334145,"avatar_url":"https://avatars3.githubusercontent.com/u/5334145?v=4","gravatar_id":"","url":"https://api.github.com/users/cjwagner","html_url":"https://github.com/cjwagner","followers_url":"https://api.github.com/users/cjwagner/followers","following_url":"https://api.github.com/users/cjwagner/following{/other_user}","gists_url":"https://api.github.com/users/cjwagner/gists{/gist_id}","starred_url":"https://api.github.com/users/cjwagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjwagner/subscriptions","organizations_url":"https://api.github.com/users/cjwagner/orgs","repos_url":"https://api.github.com/users/cjwagner/repos","events_url":"https://api.github.com/users/cjwagner/events{/privacy}","received_events_url":"https://api.github.com/users/cjwagner/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cjwagner/test-infra","description":"Test infrastructure for the Kubernetes project.","fork":true,"url":"https://api.github.com/repos/cjwagner/test-infra","forks_url":"https://api.github.com/repos/cjwagner/test-infra/forks","keys_url":"https://api.github.com/repos/cjwagner/test-infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cjwagner/test-infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cjwagner/test-infra/teams","hooks_url":"https://api.github.com/repos/cjwagner/test-infra/hooks","issue_events_url":"https://api.github.com/repos/cjwagner/test-infra/issues/events{/number}","events_url":"https://api.github.com/repos/cjwagner/test-infra/events","assignees_url":"https://api.github.com/repos/cjwagner/test-infra/assignees{/user}","branches_url":"https://api.github.com/repos/cjwagner/test-infra/branches{/branch}","tags_url":"https://api.github.com/repos/cjwagner/test-infra/tags","blobs_url":"https://api.github.com/repos/cjwagner/test-infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cjwagner/test-infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cjwagner/test-infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/cjwagner/test-infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cjwagner/test-infra/statuses/{sha}","languages_url":"https://api.github.com/repos/cjwagner/test-infra/languages","stargazers_url":"https://api.github.com/repos/cjwagner/test-infra/stargazers","contributors_url":"https://api.github.com/repos/cjwagner/test-infra/contributors","subscribers_url":"https://api.github.com/repos/cjwagner/test-infra/subscribers","subscription_url":"https://api.github.com/repos/cjwagner/test-infra/subscription","commits_url":"https://api.github.com/repos/cjwagner/test-infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/cjwagner/test-infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/cjwagner/test-infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/cjwagner/test-infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/cjwagner/test-infra/contents/{+path}","compare_url":"https://api.github.com/repos/cjwagner/test-infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cjwagner/test-infra/merges","archive_url":"https://api.github.com/repos/cjwagner/test-infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cjwagner/test-infra/downloads","issues_url":"https://api.github.com/repos/cjwagner/test-infra/issues{/number}","pulls_url":"https://api.github.com/repos/cjwagner/test-infra/pulls{/number}","milestones_url":"https://api.github.com/repos/cjwagner/test-infra/milestones{/number}","notifications_url":"https://api.github.com/repos/cjwagner/test-infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cjwagner/test-infra/labels{/name}","releases_url":"https://api.github.com/repos/cjwagner/test-infra/releases{/id}","deployments_url":"https://api.github.com/repos/cjwagner/test-infra/deployments","created_at":"2017-04-10T18:07:52Z","updated_at":"2017-04-27T21:56:46Z","pushed_at":"2018-02-23T23:41:10Z","git_url":"git://github.com/cjwagner/test-infra.git","ssh_url":"git@github.com:cjwagner/test-infra.git","clone_url":"https://github.com/cjwagner/test-infra.git","svn_url":"https://github.com/cjwagner/test-infra","homepage":null,"size":43093,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"d04fb8bd897bc6c45bdbab88f5013e8e215fbcef","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":57333709,"name":"test-infra","full_name":"kubernetes/test-infra","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/test-infra","description":"Test infrastructure for the Kubernetes project.","fork":false,"url":"https://api.github.com/repos/kubernetes/test-infra","forks_url":"https://api.github.com/repos/kubernetes/test-infra/forks","keys_url":"https://api.github.com/repos/kubernetes/test-infra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/test-infra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/test-infra/teams","hooks_url":"https://api.github.com/repos/kubernetes/test-infra/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/test-infra/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/test-infra/events","assignees_url":"https://api.github.com/repos/kubernetes/test-infra/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/test-infra/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/test-infra/tags","blobs_url":"https://api.github.com/repos/kubernetes/test-infra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/test-infra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/test-infra/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/test-infra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/test-infra/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/test-infra/languages","stargazers_url":"https://api.github.com/repos/kubernetes/test-infra/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/test-infra/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/test-infra/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/test-infra/subscription","commits_url":"https://api.github.com/repos/kubernetes/test-infra/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/test-infra/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/test-infra/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/test-infra/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/test-infra/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/test-infra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/test-infra/merges","archive_url":"https://api.github.com/repos/kubernetes/test-infra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/test-infra/downloads","issues_url":"https://api.github.com/repos/kubernetes/test-infra/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/test-infra/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/test-infra/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/test-infra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/test-infra/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/test-infra/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/test-infra/deployments","created_at":"2016-04-28T21:05:35Z","updated_at":"2018-02-23T22:56:29Z","pushed_at":"2018-02-23T23:41:12Z","git_url":"git://github.com/kubernetes/test-infra.git","ssh_url":"git@github.com:kubernetes/test-infra.git","clone_url":"https://github.com/kubernetes/test-infra.git","svn_url":"https://github.com/kubernetes/test-infra","homepage":null,"size":43920,"stargazers_count":281,"watchers_count":281,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":363,"mirror_url":null,"archived":false,"open_issues_count":343,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":363,"open_issues":343,"watchers":281,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815"},"html":{"href":"https://github.com/kubernetes/test-infra/pull/6815"},"issue":{"href":"https://api.github.com/repos/kubernetes/test-infra/issues/6815"},"comments":{"href":"https://api.github.com/repos/kubernetes/test-infra/issues/6815/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/test-infra/pulls/6815/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/test-infra/statuses/083ff186a3c3ae26ddaa0e9d5e3794776882fef8"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cjwagner"}}