<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>jira 归档 - Tinyfool的个人网站</title>
	<atom:link href="https://codechina.org/tag/jira/feed/" rel="self" type="application/rss+xml" />
	<link>https://codechina.org/tag/jira/</link>
	<description></description>
	<lastBuildDate>Thu, 19 Sep 2019 03:19:19 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>如何集成Jira和Github企业版</title>
		<link>https://codechina.org/2019/09/992/</link>
					<comments>https://codechina.org/2019/09/992/#respond</comments>
		
		<dc:creator><![CDATA[tinyfool]]></dc:creator>
		<pubDate>Thu, 19 Sep 2019 03:17:56 +0000</pubDate>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jira]]></category>
		<guid isPermaLink="false">http://codechina.org/?p=992</guid>

					<description><![CDATA[<p>Github企业版包含了基本的issue和看板管理，对一般的团队已经足够。但是有的团队仍旧需要把自己习惯使用的 [&#8230;]</p>
<p><a href="https://codechina.org/2019/09/992/">如何集成Jira和Github企业版</a>最先出现在<a href="https://codechina.org">Tinyfool的个人网站</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Github企业版包含了基本的issue和看板管理，对一般的团队已经足够。但是有的团队仍旧需要把自己习惯使用的Jira和Github企业版集成。这样，团队可以在Jira内看到他们的分支，提交信息，pull requests等等，可以让Github的代码提交记录和Jira的任务管理系统集成在一起，获得便利。</p>



<span id="more-992"></span>



<p><em><strong>注：</strong>如果你想连接Jira和Github.com的帐号，相对比较简单，你简单的在Github官网的市场找到</em><a href="https://github.com/marketplace/jira-software-github"><em>Github提供的插件</em></a><em>就可以了，那个比较简单，这里不具体介绍了。</em></p>



<p>下面是具体的流程介绍：</p>



<h2 class="wp-block-heading">第一步：在你的企业版帐号创建OAuth access token</h2>



<p>一般在Github企业版里，我们会创建组织，把代码库放在组织里面管理。首先，用管理员账户登录，进去你的组织的首页。</p>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1024" height="658" src="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.27.49-1024x658.png" alt="" class="wp-image-994" srcset="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.27.49-1024x658.png 1024w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.27.49-300x193.png 300w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.27.49-768x493.png 768w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.27.49.png 2020w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<ol class="wp-block-list"><li>点击Setting进入设置页面。</li><li>选择Developer settings -&gt; OAuth Apps。</li><li>选择New Oauth App。</li><li>在页面内填写信息：</li></ol>



<figure class="wp-block-image"><img decoding="async" width="1024" height="992" src="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.31.28-1024x992.png" alt="" class="wp-image-995" srcset="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.31.28-1024x992.png 1024w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.31.28-300x291.png 300w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.31.28-768x744.png 768w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.31.28.png 1162w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>注意：</p>



<ol class="wp-block-list"><li>Application name可以任意填写，主要是为了区分，我们这里就直接写了“Jira集成”。</li><li>Homepage URL和Authorization callback URL，都是你自己的Jira部署的地址。既可以是Jira的云部署，也可以是私有部署。</li></ol>



<p>然后点击Register application即可。提交后的结果页面会有Client ID和Client Secret，这是我们后续需要的。</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="455" src="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.41.29-1024x455.png" alt="" class="wp-image-996" srcset="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.41.29-1024x455.png 1024w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.41.29-300x133.png 300w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.41.29-768x341.png 768w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.41.29.png 1530w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>在Github企业版里面的设置就结束了。</p>



<h2 class="wp-block-heading">第二步：在Jira里面加入Github企业版连接</h2>



<p>目前连接Jira和Github企业版的唯一方法还是需要DVCS插件。</p>



<ol class="wp-block-list"><li>用管理员账号登陆Jira。</li><li>选择settings，选择Applications。</li><li>从Integrations部分选择DVCS accounts.</li><li>进入后，点击Link Bitbucket Cloud or Github account按钮。</li></ol>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="603" src="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.48.01-1024x603.png" alt="" class="wp-image-997" srcset="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.48.01-1024x603.png 1024w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.48.01-300x177.png 300w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.48.01-768x452.png 768w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.48.01.png 1674w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<ol class="wp-block-list"><li>Host选择Github Enterprise。</li><li>Team or User Account填写你的组织的名字。</li><li>Host URL就是你的企业版的首页地址</li><li>Client ID和Client Secret就是之前我们在Github企业版里面获得的。</li><li>然后点击Add，后面就会跟你的Github企业版连接，一路选择确定即可。</li></ol>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="481" src="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.55.03-1024x481.png" alt="" class="wp-image-998" srcset="https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.55.03-1024x481.png 1024w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.55.03-300x141.png 300w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.55.03-768x361.png 768w, https://codechina.org/wp-content/uploads/2019/09/截屏2019-09-19上午10.55.03.png 1460w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>成功以后，在DVCS页面下方就有已经连接的组织和代码库的列表了。</p>



<h2 class="wp-block-heading">第三步：代码提交的时候加入Jira的issue id</h2>



<p>前面的步骤成功了以后，你在Github代码提交的时候，只要在message里提及了Jira的issue，在相应的issue页面里，就可以查看相关的代码提交记录了。</p>



<p>比如你有一个Jira的issue id叫做JIRA-11，那么你的github提交记录可以这么写：</p>



<pre class="wp-block-code"><code>git commit -m "JIRA-11 do some test about jira"
git push origin &lt;branchname></code></pre>



<h2 class="wp-block-heading">常见问题和解决</h2>



<h3 class="wp-block-heading">一、在Jira添加Github帐号的时候遇到错误信息“&nbsp;Error obtaining access token. Cannot access https from Jira.”</h3>



<p>有些Github企业版用户没有准备单独的购买的证书，所以它的https连接默认是不被浏览器和Jira的系统认可的。</p>



<p>解决方案有两个，购买证书给企业版服务域名，并配置好。或者我们可以把自带的证书，加入到Jira的Java实例的信任列表里。</p>



<p>步骤如下：</p>



<p>1、 从自己的网站获得证书文件（其中mygithub.mycorp.com为企业版的域名,mycert.cert为要保存的文件名）</p>



<p><code>echo -n | openssl s_client -connect mygithub.mycorp.com:443 &nbsp; | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' &gt; mycert.cert</code></p>



<p>2、把cert格式的证书转化成pem格式的</p>



<p><code>openssl x509 -in mycert.crt -out mycert.pem -outform PEM</code></p>



<p>3、把证书加入到Jira服务的Java实例里（假定你的Jira实例安装目录在/opt/atlassian/jira/）</p>



<p><code>keytool -import -alias githubcert -keystore /opt/atlassian/jira/jre/lib/security/cacerts -file mycert.pem</code></p>



<p>在这个过程，可能会询问你信任证书库的密码，默认密码为 changeit。</p>



<p>做好信任后，重启你的Jira实例，一般，就可以正常进行了。</p>
<p><a href="https://codechina.org/2019/09/992/">如何集成Jira和Github企业版</a>最先出现在<a href="https://codechina.org">Tinyfool的个人网站</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codechina.org/2019/09/992/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
