{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/packaging/pulls/comments/37348973","id":37348973,"diff_hunk":"@@ -21,22 +21,82 @@ def self.jira_project_name(projects, project)\n       projects.find { |p| p.key == project }.name\n     end\n \n-    def self.jira_issue_fields(summary, description, project, parent, assignee)\n+    def self.jira_issue_fields(summary, description, project, parent, assignee, story_points = nil, type = nil, components = nil, epic_parent = nil)\n       # build the fields hash describing the ticket\n+\n+      # These are required for all tickets\n       fields = {\n           'summary'     => summary,\n-          'description' => description,\n           'project'     => { 'key' => project },\n-          'issuetype'   => { 'name' => parent ? \"Sub-task\" : \"Task\" },\n-          'assignee'    => { 'name' => assignee },\n       }\n-      if parent\n+\n+      # The following are optional\n+      if description\n+        fields['description'] = description\n+      end\n+      if assignee\n+        fields['assignee'] = { 'name' => assignee }\n+      end\n+      if story_points\n+        fields['customfield_10002'] = story_points.to_i\n+      end\n+      if components\n+        fields['components'] = components\n+      end\n+\n+      if type\n+        fields['issuetype'] = { 'name' => type }\n+        if type == 'Epic'\n+          fields['customfield_10007'] = summary  # this corresponds to the Epic Name field\n+        end\n+      else\n+        fields['issuetype'] = { 'name' => \"Task\" }\n+      end\n+\n+      if parent # Issue is a subtask of a parent ticket\n+        fields['issuetype'] = { 'name' => \"Sub-task\" }\n         fields['parent'] = { 'id' => parent }\n+      elsif epic_parent # Issue is in a given epic, cannot be a subtask\n+        fields['customfield_10006'] = epic_parent\n       end\n \n       fields\n     end\n \n+    def self.get_auth_vars\n+      vars = {}\n+      vars[:site]             = Pkg::Util.get_var(\"SITE\", false) || 'https://jira1-test.ops.puppetlabs.net'\n+      vars[:username]         = Pkg::Util.get_var(\"JIRA_USER\")\n+      vars[:password]         = Pkg::Util::Jira.get_password(vars[:site], vars[:username])\n+      vars[:base64_encoding]  = Pkg::Util::Jira.get_base64_encoding(vars[:username], vars[:password])\n+      vars\n+    end\n+\n+    def self.get_password(site, user)","path":"lib/packaging/util/jira.rb","position":60,"original_position":60,"commit_id":"ebd8eba95f6c3c15757c41710cffa19040c63820","original_commit_id":"ebd8eba95f6c3c15757c41710cffa19040c63820","user":{"login":"melissa","id":4473089,"avatar_url":"https://avatars.githubusercontent.com/u/4473089?v=3","gravatar_id":"","url":"https://api.github.com/users/melissa","html_url":"https://github.com/melissa","followers_url":"https://api.github.com/users/melissa/followers","following_url":"https://api.github.com/users/melissa/following{/other_user}","gists_url":"https://api.github.com/users/melissa/gists{/gist_id}","starred_url":"https://api.github.com/users/melissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melissa/subscriptions","organizations_url":"https://api.github.com/users/melissa/orgs","repos_url":"https://api.github.com/users/melissa/repos","events_url":"https://api.github.com/users/melissa/events{/privacy}","received_events_url":"https://api.github.com/users/melissa/received_events","type":"User","site_admin":false},"body":"ooh, I didn't even think of that, thanks!","created_at":"2015-08-18T20:26:46Z","updated_at":"2015-08-18T20:26:46Z","html_url":"https://github.com/puppetlabs/packaging/pull/429#discussion_r37348973","pull_request_url":"https://api.github.com/repos/puppetlabs/packaging/pulls/429","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/comments/37348973"},"html":{"href":"https://github.com/puppetlabs/packaging/pull/429#discussion_r37348973"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/429"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/packaging/pulls/429","id":42504132,"html_url":"https://github.com/puppetlabs/packaging/pull/429","diff_url":"https://github.com/puppetlabs/packaging/pull/429.diff","patch_url":"https://github.com/puppetlabs/packaging/pull/429.patch","issue_url":"https://api.github.com/repos/puppetlabs/packaging/issues/429","number":429,"state":"open","locked":false,"title":"Ticket/master/re 5105","user":{"login":"melissa","id":4473089,"avatar_url":"https://avatars.githubusercontent.com/u/4473089?v=3","gravatar_id":"","url":"https://api.github.com/users/melissa","html_url":"https://github.com/melissa","followers_url":"https://api.github.com/users/melissa/followers","following_url":"https://api.github.com/users/melissa/following{/other_user}","gists_url":"https://api.github.com/users/melissa/gists{/gist_id}","starred_url":"https://api.github.com/users/melissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melissa/subscriptions","organizations_url":"https://api.github.com/users/melissa/orgs","repos_url":"https://api.github.com/users/melissa/repos","events_url":"https://api.github.com/users/melissa/events{/privacy}","received_events_url":"https://api.github.com/users/melissa/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-14T22:31:34Z","updated_at":"2015-08-18T20:26:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6e2783f6fecca6d739a30d5ec0702024d611dc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/packaging/pulls/429/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/packaging/pulls/429/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/packaging/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/packaging/issues/429/comments","statuses_url":"https://api.github.com/repos/puppetlabs/packaging/statuses/ebd8eba95f6c3c15757c41710cffa19040c63820","head":{"label":"melissa:ticket/master/re-5105","ref":"ticket/master/re-5105","sha":"ebd8eba95f6c3c15757c41710cffa19040c63820","user":{"login":"melissa","id":4473089,"avatar_url":"https://avatars.githubusercontent.com/u/4473089?v=3","gravatar_id":"","url":"https://api.github.com/users/melissa","html_url":"https://github.com/melissa","followers_url":"https://api.github.com/users/melissa/followers","following_url":"https://api.github.com/users/melissa/following{/other_user}","gists_url":"https://api.github.com/users/melissa/gists{/gist_id}","starred_url":"https://api.github.com/users/melissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melissa/subscriptions","organizations_url":"https://api.github.com/users/melissa/orgs","repos_url":"https://api.github.com/users/melissa/repos","events_url":"https://api.github.com/users/melissa/events{/privacy}","received_events_url":"https://api.github.com/users/melissa/received_events","type":"User","site_admin":false},"repo":{"id":10980702,"name":"packaging","full_name":"melissa/packaging","owner":{"login":"melissa","id":4473089,"avatar_url":"https://avatars.githubusercontent.com/u/4473089?v=3","gravatar_id":"","url":"https://api.github.com/users/melissa","html_url":"https://github.com/melissa","followers_url":"https://api.github.com/users/melissa/followers","following_url":"https://api.github.com/users/melissa/following{/other_user}","gists_url":"https://api.github.com/users/melissa/gists{/gist_id}","starred_url":"https://api.github.com/users/melissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melissa/subscriptions","organizations_url":"https://api.github.com/users/melissa/orgs","repos_url":"https://api.github.com/users/melissa/repos","events_url":"https://api.github.com/users/melissa/events{/privacy}","received_events_url":"https://api.github.com/users/melissa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/melissa/packaging","description":"","fork":true,"url":"https://api.github.com/repos/melissa/packaging","forks_url":"https://api.github.com/repos/melissa/packaging/forks","keys_url":"https://api.github.com/repos/melissa/packaging/keys{/key_id}","collaborators_url":"https://api.github.com/repos/melissa/packaging/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/melissa/packaging/teams","hooks_url":"https://api.github.com/repos/melissa/packaging/hooks","issue_events_url":"https://api.github.com/repos/melissa/packaging/issues/events{/number}","events_url":"https://api.github.com/repos/melissa/packaging/events","assignees_url":"https://api.github.com/repos/melissa/packaging/assignees{/user}","branches_url":"https://api.github.com/repos/melissa/packaging/branches{/branch}","tags_url":"https://api.github.com/repos/melissa/packaging/tags","blobs_url":"https://api.github.com/repos/melissa/packaging/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/melissa/packaging/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/melissa/packaging/git/refs{/sha}","trees_url":"https://api.github.com/repos/melissa/packaging/git/trees{/sha}","statuses_url":"https://api.github.com/repos/melissa/packaging/statuses/{sha}","languages_url":"https://api.github.com/repos/melissa/packaging/languages","stargazers_url":"https://api.github.com/repos/melissa/packaging/stargazers","contributors_url":"https://api.github.com/repos/melissa/packaging/contributors","subscribers_url":"https://api.github.com/repos/melissa/packaging/subscribers","subscription_url":"https://api.github.com/repos/melissa/packaging/subscription","commits_url":"https://api.github.com/repos/melissa/packaging/commits{/sha}","git_commits_url":"https://api.github.com/repos/melissa/packaging/git/commits{/sha}","comments_url":"https://api.github.com/repos/melissa/packaging/comments{/number}","issue_comment_url":"https://api.github.com/repos/melissa/packaging/issues/comments{/number}","contents_url":"https://api.github.com/repos/melissa/packaging/contents/{+path}","compare_url":"https://api.github.com/repos/melissa/packaging/compare/{base}...{head}","merges_url":"https://api.github.com/repos/melissa/packaging/merges","archive_url":"https://api.github.com/repos/melissa/packaging/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/melissa/packaging/downloads","issues_url":"https://api.github.com/repos/melissa/packaging/issues{/number}","pulls_url":"https://api.github.com/repos/melissa/packaging/pulls{/number}","milestones_url":"https://api.github.com/repos/melissa/packaging/milestones{/number}","notifications_url":"https://api.github.com/repos/melissa/packaging/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/melissa/packaging/labels{/name}","releases_url":"https://api.github.com/repos/melissa/packaging/releases{/id}","created_at":"2013-06-26T22:19:53Z","updated_at":"2015-01-22T19:04:52Z","pushed_at":"2015-08-14T22:26:28Z","git_url":"git://github.com/melissa/packaging.git","ssh_url":"git@github.com:melissa/packaging.git","clone_url":"https://github.com/melissa/packaging.git","svn_url":"https://github.com/melissa/packaging","homepage":null,"size":2785,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"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":"master"}},"base":{"label":"puppetlabs:master","ref":"master","sha":"346eae16707a28201c45fc92d22c51e55b2db648","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":5209001,"name":"packaging","full_name":"puppetlabs/packaging","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/packaging","description":"","fork":false,"url":"https://api.github.com/repos/puppetlabs/packaging","forks_url":"https://api.github.com/repos/puppetlabs/packaging/forks","keys_url":"https://api.github.com/repos/puppetlabs/packaging/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/packaging/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/packaging/teams","hooks_url":"https://api.github.com/repos/puppetlabs/packaging/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/packaging/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/packaging/events","assignees_url":"https://api.github.com/repos/puppetlabs/packaging/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/packaging/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/packaging/tags","blobs_url":"https://api.github.com/repos/puppetlabs/packaging/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/packaging/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/packaging/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/packaging/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/packaging/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/packaging/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/packaging/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/packaging/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/packaging/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/packaging/subscription","commits_url":"https://api.github.com/repos/puppetlabs/packaging/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/packaging/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/packaging/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/packaging/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/packaging/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/packaging/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/packaging/merges","archive_url":"https://api.github.com/repos/puppetlabs/packaging/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/packaging/downloads","issues_url":"https://api.github.com/repos/puppetlabs/packaging/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/packaging/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/packaging/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/packaging/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/packaging/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/packaging/releases{/id}","created_at":"2012-07-27T20:18:19Z","updated_at":"2015-05-18T22:33:47Z","pushed_at":"2015-08-14T22:31:35Z","git_url":"git://github.com/puppetlabs/packaging.git","ssh_url":"git@github.com:puppetlabs/packaging.git","clone_url":"https://github.com/puppetlabs/packaging.git","svn_url":"https://github.com/puppetlabs/packaging","homepage":null,"size":3588,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":43,"mirror_url":null,"open_issues_count":2,"forks":43,"open_issues":2,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/429"},"html":{"href":"https://github.com/puppetlabs/packaging/pull/429"},"issue":{"href":"https://api.github.com/repos/puppetlabs/packaging/issues/429"},"comments":{"href":"https://api.github.com/repos/puppetlabs/packaging/issues/429/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/429/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/packaging/pulls/429/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/packaging/statuses/ebd8eba95f6c3c15757c41710cffa19040c63820"}}}}