<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.7.4">Jekyll</generator><link href="https://devopslakes.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://devopslakes.github.io/" rel="alternate" type="text/html" /><updated>2019-01-09T03:45:25+00:00</updated><id>https://devopslakes.github.io/feed.xml</id><title type="html">DevOps Beatiful Lakes</title><subtitle>会运维的开发真幸福，会开发的运维真洒脱</subtitle><entry><title type="html">Gitlab_ci</title><link href="https://devopslakes.github.io/GitLab_CI/" rel="alternate" type="text/html" title="Gitlab_ci" /><published>2018-12-26T00:00:00+00:00</published><updated>2018-12-26T00:00:00+00:00</updated><id>https://devopslakes.github.io/GitLab_CI</id><content type="html" xml:base="https://devopslakes.github.io/GitLab_CI/">&lt;h2 id=&quot;闲话-gitlab自带的ci&quot;&gt;[闲话] Gitlab自带的CI&lt;/h2&gt;

&lt;h4 id=&quot;两个前提条件&quot;&gt;两个前提条件&lt;/h4&gt;
&lt;ul&gt;
  &lt;li&gt;根目录下必须有 .gitlab-ci.yml 配置文件&lt;/li&gt;
  &lt;li&gt;启用 GitLab 的 Runner&lt;/li&gt;
&lt;/ul&gt;</content><author><name></name></author><summary type="html">[闲话] Gitlab自带的CI</summary></entry><entry><title type="html">Gitlab_and_jenkins</title><link href="https://devopslakes.github.io/GitLab_and_Jenkins/" rel="alternate" type="text/html" title="Gitlab_and_jenkins" /><published>2018-12-26T00:00:00+00:00</published><updated>2018-12-26T00:00:00+00:00</updated><id>https://devopslakes.github.io/GitLab_and_Jenkins</id><content type="html" xml:base="https://devopslakes.github.io/GitLab_and_Jenkins/">&lt;h2 id=&quot;个人实践-献给热爱ci的同事--gitlab-携手-jenkins-助力ci&quot;&gt;[个人实践] 献给热爱CI的同事 —— GitLab 携手 Jenkins 助力CI&lt;/h2&gt;
&lt;blockquote&gt;
  &lt;p&gt;撰稿的时间在2017-3-17   作者：苏玲（ git2019@163.com ）&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;外文参考资料&quot;&gt;外文参考资料：&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/jenkinsci/gitlab-plugin&quot;&gt;gitlab-plugin&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/@teeks99/continuous-integration-with-jenkins-and-gitlab-fa770c62e88a&quot;&gt;continuous-integration-with-jenkins-and-gitlab&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;闪亮点&quot;&gt;闪亮点：&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;每个 commit 有 CI 的结果&lt;/li&gt;
  &lt;li&gt;每个 merge request 有 CI 的结果&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;前提&quot;&gt;前提：&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;采用公司的 gitlab 服务。&lt;/li&gt;
  &lt;li&gt;jenkins已安装 git-lugin , gitlab-plugin 。&lt;/li&gt;
  &lt;li&gt;创建了一对公私钥( ssh-keygen -trsa方式）&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;jenkins和gitlab的配置&quot;&gt;jenkins和gitlab的配置：&lt;/h3&gt;
&lt;h4 id=&quot;jenkins创建credentialsssh-username-with-private-key-建好后第5步骤会用到如图&quot;&gt;jenkins：创建credentials（SSH Username with private key） ，建好后第5步骤会用到。如图：&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_credentials.JPG&quot; alt=&quot;创建credentials（SSH Username with private key） &quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;gitlab粘贴公钥&quot;&gt;gitlab：粘贴公钥。&lt;/h4&gt;
&lt;p&gt;上面 credentials 中输入的是私钥（private key），我们得把对应的公钥（public key）放到gitlab某账号的ssh keys中去（略）。1）和 2）结合，才能在jenkins处获取代码仓库。&lt;/p&gt;

&lt;h4 id=&quot;jenkins创建credentialsgitlab-api-token-建好后过会儿再用&quot;&gt;jenkins：创建credentials（Gitlab API token） ，建好后过会儿再用。&lt;/h4&gt;
&lt;p&gt;jenkins跑好ci后，要把状态写回到 gitlab ，因此，在jenkins服务这边必须做相应的配置，配置jenkins job访问gitlab。注意，图中的“API token”来自gitlab上某账户的 Private token 。
如下图：
&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_credentials.JPG&quot; alt=&quot;创建credentials（Gitlab API token）&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;jenkins配置gitlab-plugin用上面创建的credentialsgitlab-api-token&quot;&gt;jenkins：配置gitlab-plugin，用上面创建的credentials（Gitlab API token）。&lt;/h4&gt;
&lt;p&gt;系统管理 -&amp;gt; 系统设置 -&amp;gt; Gitlab
&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_config_gitlab-plugin.JPG&quot; alt=&quot;配置 gitlab-plugin&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;jenkins创建job配置源码管理---git&quot;&gt;jenkins：创建job，配置源码管理 -&amp;gt; git。&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_config_job_git.JPG&quot; alt=&quot;配置 job-git&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;jenkins配置构建触发器build-triggers&quot;&gt;jenkins：配置构建触发器/Build Triggers。&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_job_trigger.JPG&quot; alt=&quot;配置触发器&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;jenkins-配置构建后操作post-build-actions&quot;&gt;jenkins: 配置构建后操作/Post-build Actions。&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_job_post_build.JPG&quot; alt=&quot;配置构建后操作&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;jenkins-配置-gitlab-connection-&quot;&gt;jenkins: 配置 GitLab connection 。&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/jenkins_job_gitlab_connection.JPG&quot; alt=&quot;配置GitLab connection&quot; /&gt;&lt;/p&gt;

&lt;h4 id=&quot;gitlab--配置-webhook-&quot;&gt;gitlab:  配置 webhook 。&lt;/h4&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DevOpsLakes/devopslakes.github.io/master/images/jenkins/gitlab_webhook.JPG&quot; alt=&quot;到gitlab上配置 webhook&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><summary type="html">[个人实践] 献给热爱CI的同事 —— GitLab 携手 Jenkins 助力CI 撰稿的时间在2017-3-17 作者：苏玲（ git2019@163.com ）</summary></entry></feed>