Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions jira.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ def self.add_remote_link(issue, label, url)
)
end

def self.create_issue(summary:, project:, fields: {})
options = fields.merge(
'summary' => summary,
'project' => {
'key' => project
},
'issuetype' => {
'id' => '3',
}
)

issue = api.Issue.build
issue.save(fields: options)
issue.fetch
issue
end

def self.active_sprints
api.Agile.get_sprints(config.board, state: 'active')
end
Expand All @@ -46,6 +63,7 @@ def self.api
site: config.site,
context_path: '',
auth_type: :basic,
ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
})
end

Expand Down
12 changes: 10 additions & 2 deletions kansync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,20 @@ def execute
FixBz.new(profile: profile_object, bz_id: bz_id, fixed_in: version).run
end
end

subcommand 'bz_to_jira', 'Clone BZ issue to Jira' do
option ['-b', '--bz-id'], 'BZ_ID', 'Bugzilla id', required: true
option ['-t', '--title'], 'TITLE', 'Override title text', required: false

def execute
require_relative 'subcommands/clone_bz_to_jira'
CloneBzToJira.new(profile: profile_object, bz_id: bz_id, project: 'TFMRHCLOUD').run(summary: title)
end
end
end
end

# TODO need a separate script to create cards
# TODO need a separate script to help with new iteration setup
# TODO scripts may need custom configuration per profile, e.g. email mapping
# TODO README with links to APIs, docker image, sql converting trick

#09-7487410
20 changes: 20 additions & 0 deletions subcommands/clone_bz_to_jira.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require_relative 'link_jira_to_bz'

class CloneBzToJira
attr_accessor :bz_id, :project, :profile

def initialize(profile:, bz_id:, project:)
@profile = profile
@bz_id = bz_id
@project = project
end

def run(summary: nil)
bz = Bugzilla.get_issue(bz_id)['bugs'].first
summary ||= bz['summary']

issue = Jira.create_issue(project: project, summary: summary)

LinkJiraToBz.new(profile: profile, jira_id: issue.key, bz_id: bz_id).run
end
end