{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/samson/pulls/comments/59761941","id":59761941,"diff_hunk":"@@ -1,13 +1,28 @@\n module SamsonPipelines::StageConcern\n-  # Return true if any stages in the pipeline are marked production\n-  def production?\n-    super || next_stages.any?(&:production?)\n-  end\n \n   def next_stages\n     Stage.find(next_stage_ids)\n   end\n \n+  # Needs to find all the possible stages in case this is a pipeline of pipelines as each subsequent stage\n+  # could have valid next_stage_ids\n+  def all_next_stages\n+    Stage.find(recursive_next_stage_ids);\n+  end\n+\n+  def recursive_next_stage_ids\n+    return [] if next_stage_ids.empty?\n+    next_stage_ids.map(&:to_i) + Stage.find(next_stage_ids).flat_map(&:recursive_next_stage_ids)\n+  end\n+\n+  def deploy_requires_approval?\n+    super || all_next_stages.any? do |next_stage|\n+      next_stage.deploy_requires_approval? && !next_stage.no_code_deployed?","path":"plugins/pipelines/app/models/concerns/samson_pipelines/stage_concern.rb","position":24,"original_position":24,"commit_id":"54ca1331a065551f284bdd589e94734f7497f3c5","original_commit_id":"54ca1331a065551f284bdd589e94734f7497f3c5","user":{"login":"grosser","id":11367,"avatar_url":"https://avatars.githubusercontent.com/u/11367?v=3","gravatar_id":"","url":"https://api.github.com/users/grosser","html_url":"https://github.com/grosser","followers_url":"https://api.github.com/users/grosser/followers","following_url":"https://api.github.com/users/grosser/following{/other_user}","gists_url":"https://api.github.com/users/grosser/gists{/gist_id}","starred_url":"https://api.github.com/users/grosser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grosser/subscriptions","organizations_url":"https://api.github.com/users/grosser/orgs","repos_url":"https://api.github.com/users/grosser/repos","events_url":"https://api.github.com/users/grosser/events{/privacy}","received_events_url":"https://api.github.com/users/grosser/received_events","type":"User","site_admin":false},"body":"deploy_requires_approval already checks no_code_deployed ... so the && can go away ?","created_at":"2016-04-14T17:55:59Z","updated_at":"2016-04-14T17:55:59Z","html_url":"https://github.com/zendesk/samson/pull/780#discussion_r59761941","pull_request_url":"https://api.github.com/repos/zendesk/samson/pulls/780","_links":{"self":{"href":"https://api.github.com/repos/zendesk/samson/pulls/comments/59761941"},"html":{"href":"https://github.com/zendesk/samson/pull/780#discussion_r59761941"},"pull_request":{"href":"https://api.github.com/repos/zendesk/samson/pulls/780"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/samson/pulls/780","id":64662981,"html_url":"https://github.com/zendesk/samson/pull/780","diff_url":"https://github.com/zendesk/samson/pull/780.diff","patch_url":"https://github.com/zendesk/samson/pull/780.patch","issue_url":"https://api.github.com/repos/zendesk/samson/issues/780","number":780,"state":"open","locked":false,"title":"Samson 215 (making pipeline'd deployment honor no_code_deployed)","user":{"login":"irwaters","id":155554,"avatar_url":"https://avatars.githubusercontent.com/u/155554?v=3","gravatar_id":"","url":"https://api.github.com/users/irwaters","html_url":"https://github.com/irwaters","followers_url":"https://api.github.com/users/irwaters/followers","following_url":"https://api.github.com/users/irwaters/following{/other_user}","gists_url":"https://api.github.com/users/irwaters/gists{/gist_id}","starred_url":"https://api.github.com/users/irwaters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irwaters/subscriptions","organizations_url":"https://api.github.com/users/irwaters/orgs","repos_url":"https://api.github.com/users/irwaters/repos","events_url":"https://api.github.com/users/irwaters/events{/privacy}","received_events_url":"https://api.github.com/users/irwaters/received_events","type":"User","site_admin":false},"body":"* Add description here\r\ncurrently deploys in a pipeline don't honor the no_code_deployed attibute on the stage.  changes here cause it do so.\r\n\r\n* Add any screenshots if you are touching the UI\r\n* Remember to add unit tests\r\n\r\n/cc @zendesk/samson\r\n\r\n### Tasks\r\n - [ ] :+1: from team\r\n\r\n### References\r\nhttps://zendesk.atlassian.net/projects/SAMSON/issues/SAMSON-215\r\n### Risks\r\n- Level: Low/Med/High\r\nMed\r\n","created_at":"2016-03-30T17:09:57Z","updated_at":"2016-04-14T17:55:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ad56cc82dd66fb62b704dd2dc815c3be01488be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/samson/pulls/780/commits","review_comments_url":"https://api.github.com/repos/zendesk/samson/pulls/780/comments","review_comment_url":"https://api.github.com/repos/zendesk/samson/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/samson/issues/780/comments","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/54ca1331a065551f284bdd589e94734f7497f3c5","head":{"label":"zendesk:SAMSON-215","ref":"SAMSON-215","sha":"54ca1331a065551f284bdd589e94734f7497f3c5","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":20208662,"name":"samson","full_name":"zendesk/samson","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/samson","description":"Web interface for deployments","fork":false,"url":"https://api.github.com/repos/zendesk/samson","forks_url":"https://api.github.com/repos/zendesk/samson/forks","keys_url":"https://api.github.com/repos/zendesk/samson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/samson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/samson/teams","hooks_url":"https://api.github.com/repos/zendesk/samson/hooks","issue_events_url":"https://api.github.com/repos/zendesk/samson/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/samson/events","assignees_url":"https://api.github.com/repos/zendesk/samson/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/samson/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/samson/tags","blobs_url":"https://api.github.com/repos/zendesk/samson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/samson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/samson/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/samson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/samson/languages","stargazers_url":"https://api.github.com/repos/zendesk/samson/stargazers","contributors_url":"https://api.github.com/repos/zendesk/samson/contributors","subscribers_url":"https://api.github.com/repos/zendesk/samson/subscribers","subscription_url":"https://api.github.com/repos/zendesk/samson/subscription","commits_url":"https://api.github.com/repos/zendesk/samson/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/samson/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/samson/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/samson/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/samson/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/samson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/samson/merges","archive_url":"https://api.github.com/repos/zendesk/samson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/samson/downloads","issues_url":"https://api.github.com/repos/zendesk/samson/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/samson/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/samson/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/samson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/samson/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/samson/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/samson/deployments","created_at":"2014-05-27T05:55:57Z","updated_at":"2016-04-13T05:41:56Z","pushed_at":"2016-04-14T17:52:47Z","git_url":"git://github.com/zendesk/samson.git","ssh_url":"git@github.com:zendesk/samson.git","clone_url":"https://github.com/zendesk/samson.git","svn_url":"https://github.com/zendesk/samson","homepage":null,"size":173281,"stargazers_count":645,"watchers_count":645,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":53,"forks":107,"open_issues":53,"watchers":645,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"bec193ef5ef8f579920b86e1df88814824a915d1","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":20208662,"name":"samson","full_name":"zendesk/samson","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars.githubusercontent.com/u/11525?v=3","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/samson","description":"Web interface for deployments","fork":false,"url":"https://api.github.com/repos/zendesk/samson","forks_url":"https://api.github.com/repos/zendesk/samson/forks","keys_url":"https://api.github.com/repos/zendesk/samson/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/samson/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/samson/teams","hooks_url":"https://api.github.com/repos/zendesk/samson/hooks","issue_events_url":"https://api.github.com/repos/zendesk/samson/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/samson/events","assignees_url":"https://api.github.com/repos/zendesk/samson/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/samson/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/samson/tags","blobs_url":"https://api.github.com/repos/zendesk/samson/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/samson/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/samson/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/samson/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/samson/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/samson/languages","stargazers_url":"https://api.github.com/repos/zendesk/samson/stargazers","contributors_url":"https://api.github.com/repos/zendesk/samson/contributors","subscribers_url":"https://api.github.com/repos/zendesk/samson/subscribers","subscription_url":"https://api.github.com/repos/zendesk/samson/subscription","commits_url":"https://api.github.com/repos/zendesk/samson/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/samson/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/samson/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/samson/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/samson/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/samson/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/samson/merges","archive_url":"https://api.github.com/repos/zendesk/samson/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/samson/downloads","issues_url":"https://api.github.com/repos/zendesk/samson/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/samson/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/samson/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/samson/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/samson/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/samson/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/samson/deployments","created_at":"2014-05-27T05:55:57Z","updated_at":"2016-04-13T05:41:56Z","pushed_at":"2016-04-14T17:52:47Z","git_url":"git://github.com/zendesk/samson.git","ssh_url":"git@github.com:zendesk/samson.git","clone_url":"https://github.com/zendesk/samson.git","svn_url":"https://github.com/zendesk/samson","homepage":null,"size":173281,"stargazers_count":645,"watchers_count":645,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":53,"forks":107,"open_issues":53,"watchers":645,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/samson/pulls/780"},"html":{"href":"https://github.com/zendesk/samson/pull/780"},"issue":{"href":"https://api.github.com/repos/zendesk/samson/issues/780"},"comments":{"href":"https://api.github.com/repos/zendesk/samson/issues/780/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/samson/pulls/780/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/samson/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/samson/pulls/780/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/samson/statuses/54ca1331a065551f284bdd589e94734f7497f3c5"}}}}