<?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: Simone</title>
    <description>The latest articles on DEV Community by Simone (@simone_a).</description>
    <link>https://dev.to/simone_a</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%2F717736%2F119a7267-a6c3-4081-9958-86d619df7ecc.jpg</url>
      <title>DEV Community: Simone</title>
      <link>https://dev.to/simone_a</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/simone_a"/>
    <language>en</language>
    <item>
      <title>Git hooks and Docker for Continuous integration - part 2</title>
      <dc:creator>Simone</dc:creator>
      <pubDate>Mon, 04 Oct 2021 15:00:24 +0000</pubDate>
      <link>https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-part-2-54jb</link>
      <guid>https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-part-2-54jb</guid>
      <description>&lt;h1&gt;
  
  
  Local Continuous integration flow
&lt;/h1&gt;




&lt;h2&gt;
  
  
  User branch - pre-push git hook
&lt;/h2&gt;

&lt;p&gt;A CI build process will be triggered by a User &lt;em&gt;pre-push&lt;/em&gt; Git Hook. At the end of each build the CI pipeline status will be displayed on the Git repository (if you want, you can even stop user pushing code change if the CI process fails 🛑 )&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4a3oh0nqeegct78w8n8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4a3oh0nqeegct78w8n8k.png" alt="Alt User git branch"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Main branch - after merge
&lt;/h2&gt;

&lt;p&gt;If the User branch or Pull request is ✅ , we can use Github or Bitbucket api for merging the code/Pull Request.&lt;br&gt;
Once the Pr has been merged we can trigger an automatic CI pipeline on Main/Master branch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzbwavjt74tnya0nwtxft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzbwavjt74tnya0nwtxft.png" alt="Alt Master branch merge"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  How to run multiple parallel CI pipelines with Docker
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyltc42fqfiwlh7krlwn.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyltc42fqfiwlh7krlwn.jpeg" alt="Alt Docker networks"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First we should know how to create private sub-networks with Docker engine.&lt;br&gt;
In Docker you can create multiple bridge networks.&lt;br&gt;
Containers connected to the same user-defined bridge network effectively can resolve each other.&lt;br&gt;
Using a user-defined network provides a scoped network in which only containers attached to that network are able to communicate.&lt;/p&gt;

&lt;p&gt;Docker engine allows you to create multiple networks.&lt;br&gt;
Example: we want max 254 parallel CI pipelines with max 126 &lt;strong&gt;containers&lt;/strong&gt; for each network.&lt;/p&gt;

&lt;p&gt;The Docker configuration will be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Subnet": "172.20.X.0/24",  // 172.20.X.1 - 172.20.X.254&lt;/li&gt;
&lt;li&gt;"IPRange": "172.20.X.0/25", // 172.20.X.1 - 172.20.X.126&lt;/li&gt;
&lt;li&gt;"Gateway": "172.20.X.12"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;where 1 &amp;lt;= X &amp;lt;= 254&lt;/p&gt;

&lt;p&gt;Single network configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;availableNetwork&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Subnet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`172.20.&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;availableNetwork&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.0/24`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;IPRange&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`172.20.&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;availableNetwork&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.0/25`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Gateway&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`172.20.&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;availableNetwork&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.12`&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkOption&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;networkName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Driver&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bridge&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Labels&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;networkLabel&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;IPAM&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Config&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;networkConfig&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Article part 1: &lt;a href="https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-1c36"&gt;Git hooks and Docker for Continuous integration - part 1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check LocalCI: &lt;a href="//localci.io"&gt;localci.io&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>cloud</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Git hooks and Docker for Continuous integration - part 1</title>
      <dc:creator>Simone</dc:creator>
      <pubDate>Sat, 02 Oct 2021 19:59:48 +0000</pubDate>
      <link>https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-1c36</link>
      <guid>https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-1c36</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vihzk09exdwfgu710kk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vihzk09exdwfgu710kk.png" alt="Alt continuous integration"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Continuous Integration is a great software development practice, we can reduce integration problems and we can allow teams to develop cohesive software more rapidly.&lt;/p&gt;

&lt;p&gt;There are many interesting CI tools in the market but I think the dev CI experience can still be improved. I see companies and dev teams struggling and disappointed when they have to run and setup CI pipelines.&lt;/p&gt;




&lt;h3&gt;
  
  
  Security:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Most of the IT companies care about code privacy and they don’t like the idea to run their code on external public CI platforms. It's possible to have CI solutions on-premise but most of the time this kind of solutions are expensive for the company. For example, Atlassian has stopped selling new on-prem server licenses. &lt;a href="https://www.atlassian.com/migration/assess/journey-to-cloud" rel="noopener noreferrer"&gt;ref.&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Build queue and CI debug:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;As a developer and member of a tech team I’d like to see our CI builds running immediately after a code change and I’d like to see an easy way for debugging the code when it’s running on CI. Most of the time I see teams and developers complaining about long builds queues and usually it’s even quite difficult debugging the code if an error happens during the CI process.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Cloud costs:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How many times we see commits failing on CI because the code has not been tested enough locally or the code has not been rebased with the main branch yet. Every time we run a build on Cloud it’s a cost for the team and the company. The good news is we can now easily avoid this scenario. Few years ago, Git has introduced "Git hooks", this new technology allows developers to execute pre-tests before a commit will trigger a new CI process in Cloud.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;After a long brainstorming with some friends, we created a small CI tool &lt;a href="//localci.io"&gt;localci.io&lt;/a&gt; to address all these issues. This tool doesn’t fit with any IT infrastructure, but this could be useful at least for some team. Probably, in the future it will be completely free but currently we still need to cover some cloud costs.&lt;/p&gt;

&lt;p&gt;Article part 2: &lt;a href="https://dev.to/simone_a/git-hooks-and-docker-for-continuous-integration-part-2-54jb"&gt;Git hooks and Docker for Continuous integration - part 1&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>cloud</category>
      <category>codequality</category>
    </item>
  </channel>
</rss>
