<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Liejun Tao</title>
    <description>The latest articles on DEV Community by Liejun Tao (@liejuntao001).</description>
    <link>https://dev.to/liejuntao001</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F145901%2F8653a6b5-1498-44fe-a307-f9b8c81cc026.png</url>
      <title>DEV Community: Liejun Tao</title>
      <link>https://dev.to/liejuntao001</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/liejuntao001"/>
    <language>en</language>
    <item>
      <title>Get a build number from service</title>
      <dc:creator>Liejun Tao</dc:creator>
      <pubDate>Sat, 04 May 2019 19:34:45 +0000</pubDate>
      <link>https://dev.to/liejuntao001/get-a-build-number-from-service-a9e</link>
      <guid>https://dev.to/liejuntao001/get-a-build-number-from-service-a9e</guid>
      <description>&lt;p&gt;Recently I get a requirement to retrieve build number from external service for Jenkins Jobs.&lt;br&gt;
Normally a Jenkins job uses BUILD_NUMBER in its display-name or as part of the version.&lt;br&gt;
BUILD_NUMBER is just a sequential number, and it's bound to the specific job.&lt;br&gt;
If several jobs are set up for the same project, either due to permission control, or sitting in multiple Jenkins instances, it's nice to retrieve build number from external service to keep consistent version.&lt;/p&gt;

&lt;p&gt;So I come up with 2 small projects on GitHub:&lt;br&gt;
&lt;a href="https://github.com/liejuntao001/jenkins-buildnumber-lib"&gt;Jenkins Shared Library to retrieve build number from remote service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/liejuntao001/buildnumber"&gt;A service to get an incremental number&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first one is a library used in Jenkins. Get a build number as simple as one line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def build_number = buildnumber.get(server, uuid)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The second one is a simple service written by Go. It returns the incremental number each time called.&lt;br&gt;
Deploy it on your own server, as a docker, or in a Kubernetes cluster.&lt;/p&gt;

&lt;p&gt;Quick demo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl  -i  -H "Content-Type: application/json" -X POST https://buildnumber1.herokuapp.com/e9461f1c-ef78-4162-bcb7-e83da7287614
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;My first post. Thanks for reading.&lt;/p&gt;

</description>
      <category>devops</category>
    </item>
  </channel>
</rss>
