<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Filipe Mondaini on Medium]]></title>
        <description><![CDATA[Stories by Filipe Mondaini on Medium]]></description>
        <link>https://medium.com/@mondaini?source=rss-a7fa23cf59de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2CRPgY2y2YIu-EmQnKAtrQ.jpeg</url>
            <title>Stories by Filipe Mondaini on Medium</title>
            <link>https://medium.com/@mondaini?source=rss-a7fa23cf59de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:54:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mondaini/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Git para corajosos — Rebase — Parte 2]]></title>
            <link>https://medium.com/@mondaini/git-para-corajosos-rebase-parte-2-8e189e45959b?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e189e45959b</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[rebase]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Fri, 04 May 2018 00:21:51 GMT</pubDate>
            <atom:updated>2018-05-04T00:21:51.176Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jIVhcwjiQK2oJjj85GOcDw.jpeg" /><figcaption>“Aprova esse Pull Request, garoto!”</figcaption></figure><h4>Segundo post da série sobre coisas legais e perigosas de se fazer com Git</h4><p>No <a href="https://medium.com/@mondaini/git-para-corajosos-parte-1-4564e2d00090">primeiro post desta série eu falei um pouco sobre o <strong>rebase</strong>, substituindo o <strong>merge</strong> e como as coisas acontecem.</a> Hoje vamos abordar outros recursos interessantes do Rebase fazendo uso do seu modo interativo.</p><h3><strong>Rebase Interactive</strong></h3><p>Antes de chamar o rebase, vamos ver o que precisamos fazer, executando o comando <strong><em>git log:</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ebec0a71a0d82c744c179f02e570905c/href">https://medium.com/media/ebec0a71a0d82c744c179f02e570905c/href</a></iframe><p>Podemos fazer uma limpeza nesses commits. Vamos criar um branch para começar a limpeza:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*J2F5aqKmPU6p9Lj3b5K2kA.jpeg" /><figcaption>O commit da discórdia.</figcaption></figure><pre>git checkout -b rebase/biff-tannen</pre><p>Agora vamos executar o rebase:</p><pre>git rebase -i HEAD~10</pre><p>O que este comando faz é entrar no modo interativo <strong>-i</strong> contando 10 commits a partir do HEAD (útltimo commit) do repositório local.</p><p>Após executar o comando, é aberto o editor com essas informações:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/975adfd7230a9a41e95e6d82a0e821de/href">https://medium.com/media/975adfd7230a9a41e95e6d82a0e821de/href</a></iframe><p>Agora com base nesses commits que pegamos, podemos fazer:</p><h4>Reordenar commits:</h4><p>Caso você tenha segurança e saiba que o commit que você criou não vai interferir, você pode recortar a linha do commit e colar em outra ordem. Quando o Rebase executar, os commits serão reescritos na ordem que você criou.</p><p>Vamos começar a criar nossa própria versão da timeline, alterando a ordem dos acontecimentos(commits): Agora o Biff irá roubar o Delorean(<strong>40ac52e</strong>) antes de roubar o Almanaque de Esportes (<strong>1cb414d</strong>).</p><pre>$ git rebase -i HEAD~10 <br>Successfully rebased and updated refs/heads/master.</pre><p>Vamos ver o <em>git log</em> novamente:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bab416f748ef41cd3621c7322170b73e/href">https://medium.com/media/bab416f748ef41cd3621c7322170b73e/href</a></iframe><h4>Renomear commits em série:</h4><p>Podemos renomear qualquer commit da lista trocando a palavra <strong>pick</strong> do commit por <strong>r</strong> ou <strong>reword</strong>. Quando o Rebase for executado, ele irá perguntar pelos nomes novos dos commits. Após salvar, o editor irá perguntar a cada commit, qual o novo nome:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c3ed3d47e46e3a2acda5242e5806cb3/href">https://medium.com/media/5c3ed3d47e46e3a2acda5242e5806cb3/href</a></iframe><p>Vamos ver o resultado mais uma vez:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c402308682368e44c69aa058d27ad186/href">https://medium.com/media/c402308682368e44c69aa058d27ad186/href</a></iframe><p>Na parte 3 iremos explorar mais dos outros recursos do rebase interativo e explicar como efetivar todas estas mudanças que conversamos nas partes 1 e 2.</p><h3>Fontes:</h3><ul><li>Merging vs. Rebasing — Atlassian: <a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing">https://www.atlassian.com/git/tutorials/merging-vs-rebasing</a></li><li>Git Rebase Interactive :: A Practical Example: <a href="https://www.youtube.com/watch?v=tukOm3Afd8s">https://www.youtube.com/watch?v=tukOm3Afd8s</a></li><li>David Baumgold — Advanced Git — PyCon 2015: <a href="https://www.youtube.com/watch?v=4EOZvow1mk4">https://www.youtube.com/watch?v=4EOZvow1mk4</a></li><li>Ry’s Git Tutorial (ebook): <a href="https://www.amazon.com/Rys-Git-Tutorial-Ryan-Hodson-ebook/dp/B00QFIA5OC">https://www.amazon.com/Rys-Git-Tutorial-Ryan-Hodson-ebook/dp/B00QFIA5OC</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e189e45959b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git For The Brave — Rebase — Part 1]]></title>
            <link>https://medium.com/@mondaini/git-for-the-brave-part-1-18a2250e451b?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/18a2250e451b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Mon, 12 Mar 2018 17:20:51 GMT</pubDate>
            <atom:updated>2018-04-05T19:59:11.957Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOOPptU4fNq-GblL1jupVQ.jpeg" /></figure><h4>First post in the series about cool and dangerous things to do with Git</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*_vaDat_cJOpK99PaFKvYVg.jpeg" /><figcaption>Wait a minute. Wait a minute, Doc. Ah… Are you telling me that you built a time machine… out of a DeLorean?</figcaption></figure><h4>Rebase Versus Merge</h4><p>Rebase is a command that has a bad fame. Quite often I hear from other people that one of the first lessons they had in learning Git is that rebase is a forbidden command because it is too dangerous. But what most people do not know is that Rebase, when mastered, can considerably help the life of the Developer or DevOps.</p><h4>Merge</h4><p>One of the most significant things about Rebase is that it solves the same Merge problem: they both integrate changes from one branch to another, each one in a distinct way.</p><p>Imagine that you start by working on a new branch, called ‘Feature’. And then another team member updates the master branch. What we have as a result is a history fork, which is well-known to anyone who has ever used Git:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*tPyUeh9YkAc_tFyyv64Dbw.jpeg" /><figcaption>credit: Atlassian</figcaption></figure><p>Now let’s say that the new commits in the master branch are important to the feature you’re working on. To add new commits to the <strong><em>feature</em></strong> branch you have two options: <strong>merge</strong> or <strong>rebase</strong>. Let us compare both scenarios.</p><p>Merging it’s the simplest option. We can merge master into our <strong><em>feature </em></strong>branch through the commands:</p><pre>git checkout feature<br>git merge master</pre><p>The result is a brand new commit, joining the two histories. So we now have a structure similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9mMLGmfGxajot8-FHNqxWw.jpeg" /><figcaption>credit: Atlassian</figcaption></figure><p><strong>Merging</strong> is interesting because it is a non-destructive operation. The commits from the existing branches were not changed. This avoids some of the risks we face using <strong>rebase</strong>.</p><p>However, it also means that the <strong><em>feature</em></strong> branch will have an irrelevant commit whenever you consolidate new changes. If the main branch has a lot of activity, this will dirty the branch which everyone is working. This has a direct impact on the project’s documentation, affecting the readability of the project history.</p><p>Then, as an alternative to <strong>merge</strong>, you can <strong>rebase</strong> the <strong><em>feature</em></strong> branch on to the master branch using the commands:</p><pre>git checkout feature<br>git rebase master</pre><p>Essentially, what <strong>rebase</strong> does is replay the commits, one by one, doing the actions you want. In our case, reproducing the new master commits on the <strong><em>feature</em></strong> branch.</p><p>And if you’re not comfortable yet with <strong>git rebase</strong>, you can practice using a temporary branch. So if you mess things up, you can try again by doing a <strong>git reset</strong> command:</p><pre>git checkout feature<br>git checkout -b temporary-branch</pre><pre>git rebase -i temporary-branch HEAD~10 # where 10 is the number of commits we&#39;re going to rebase.</pre><pre># Oops, let&#39;s try again<br>git reset --hard<br>git rebase -i temporary-branch HEAD~10</pre><p>After doing things right, lets apply our rebase:</p><pre># we&#39;re going to replay the feature commits onto master.<br>git checkout master<br>git rebase temporary-branch</pre><p>Here is how our branch look like after rebasing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*BHUGGIah2rMUdxAWtM5t7w.jpeg" /><figcaption>credit: Atlassian</figcaption></figure><p>Now that you basically understand the rebase is, we need to talk about the Golden Rule:</p><blockquote>”<em>No one shall rebase a shared branch”</em></blockquote><p>The obstacle here is that it must be agreed by every other people involved in the repository. Remember, with the Rebase we’re rewriting the project’s history, so it’s like a conspiracy: everyone needs to be inside the grand scheme to get it right. And the more people involved, the harder it gets.</p><p>That’s all for now, folks! In part 2 of this series, we will see more about other tasks we can do with Git Rebase using interactive mode.</p><p><em>Originally published at </em><a href="https://concrete.com.br/2017/09/04/git-para-corajosos-rebase-parte-1/"><em>www.concrete.com.br</em></a><em> on September 4, 2017.</em></p><p><em>Translated to English on March 15th, 2018</em></p><h3>References:</h3><ul><li><a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing">Merging vs. Rebasing — Atlassian</a>;</li><li><a href="https://blog.axosoft.com/2016/10/20/golden-rule-of-rebasing-in-git">The Golden Rule Of Rebasing</a>;</li><li><a href="https://www.toptal.com/git/the-advanced-git-guide">The Advanced Git Guide: Git Stash, Reset, Rebase, and More</a>;</li><li><a href="https://www.youtube.com/watch?v=tukOm3Afd8s">Git Rebase Interactive :: A Practical Example</a>;</li><li><a href="https://www.youtube.com/watch?v=4EOZvow1mk4">David Baumgold — Advanced Git — PyCon 2015</a>.</li><li><a href="https://medium.freecodecamp.org/git-rebase-and-the-golden-rule-explained-70715eccc372">https://medium.freecodecamp.org/git-rebase-and-the-golden-rule-explained-70715eccc372</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18a2250e451b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git para Corajosos (Parte 1)]]></title>
            <link>https://medium.com/@mondaini/git-para-corajosos-parte-1-4564e2d00090?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/4564e2d00090</guid>
            <category><![CDATA[scm]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[vc]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Mon, 12 Mar 2018 17:20:51 GMT</pubDate>
            <atom:updated>2018-05-09T18:24:14.336Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GOOPptU4fNq-GblL1jupVQ.jpeg" /></figure><h4>Primeiro post da série sobre coisas legais e perigosas de se fazer com Git</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*_vaDat_cJOpK99PaFKvYVg.jpeg" /><figcaption>Wait a minute. Wait a minute, Doc. Ah… Are you telling me that you built a time machine… out of a DeLorean?</figcaption></figure><h3>Rebase versus Merge</h3><p>O rebase é um comando que tem uma reputação ruim. Com bastante frequência ouço de outras pessoas que uma das primeiras lições que tiveram ao aprender Git é que o rebase é um comando proibido por ser muito perigoso. Mas o que muita gente não sabe é que o Rebase, quando dominado, pode ajudar muito a vida do desenvolvedor ou do DevOps.</p><h4>Merge</h4><p>Uma das coisas mais importantes sobre o rebase é que ele resolve o mesmo problema do merge: ambos integram mudanças de um branch para outro, só que de maneira diferente.</p><p>Imagine que você começa trabalhando em uma nova feature de um branch e então outro membro do time atualiza o branch master. O que temos como resultado é um fork do histórico que é bem familiar para qualquer um que já usou o Git:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HbQo_L88ukM4dkwb3rRLog.png" /><figcaption>credit: Atlassian</figcaption></figure><p>Agora digamos que os novos commits no branch <em>master</em> são importantes para a feature que você está trabalhando. Para adicionar os novos commits, no branch <em>feature</em> você tem duas opções: <strong>merge</strong> ou <strong>rebase. </strong>Sendo mais comum fazer um merge.</p><h3>Fazendo o merge</h3><p>É a opção mais fácil. Podemos fazer o merge do master no nosso branch através dos comandos:</p><pre>git checkout feature<br>git merge master</pre><p>O resultado é a criação de um commit do próprio merge, unindo os históricos dos dois branches. Então temos agora uma estrutura parecida com esta:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*qasb40KwSeeeJojtJYTrZQ.png" /><figcaption>credit: Atlassian</figcaption></figure><p>O merge é interessante porque é uma operação não destrutiva. Os commits dos branches existentes não são alterados e isso evita alguns riscos do Rebase.</p><p>Por outro lado, também significa que o branch feature terá um commit irrelevante todas as vezes que você precisar incorporar mudanças. Se o branch principal tem muita atividade, isso vai poluir bastante o branch no qual está trabalhando e isso gera impacto direto aos outros desenvolvedores, que não vão conseguir entender o histórico do projeto.</p><h4>Rebase</h4><p>Então, como alternativa ao merge, você pode fazer o rebase do branch feature no branch master utilizando os comandos:</p><pre>git checkout feature<br>git rebase master</pre><p>Basicamente, o que o rebase faz é reproduzir, commit por commit, as ações que você desejar. No nosso caso, reproduzindo os novos commits de master no branch feature.</p><p>E se você não se sente confortável com o git rebase, você pode treinar o rebase em um branch temporário. Assim, se você fizer besteira, você pode tentar de novo fazendo um checkout do branch original:</p><pre>git checkout feature<br>git checkout -b temporary-branch<br>git rebase -i master<br># [Clean up the history]<br>git checkout master<br>git merge temporary-branch</pre><p>Depois do rebase, o nosso histórico fica assim:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Y9ik-efoHTZP-Doo3XdcqQ.png" /></figure><h4>A Regra Áurea do Rebase</h4><p>Agora que já entendemos basicamente o que é o rebase, precisamos falar da Regra Áurea:</p><blockquote><strong><em>“Nunca faça um rebase enquanto você está trabalhando em um branch público.”</em></strong></blockquote><p>O problema é que isso precisa ser combinado com as outras pessoas envolvidas no repositório. Lembre-se, com o rebase nós estamos reescrevendo a história, então é como uma conspiração: todos precisam estar dentro do esquema para tudo dar certo. E quanto mais pessoas envolvidas, mais difícil fica.</p><p>Por enquanto é isso, pessoal! Na parte 2 desta série vou falar um pouco mais de outras coisas que podemos fazer com o Git Rebase, usando o modo interativo.</p><h3>Algumas referências, se você quiser estudar mais:</h3><ul><li><a href="https://www.atlassian.com/git/tutorials/merging-vs-rebasing">Merging vs. Rebasing — Atlassian</a>;</li><li><a href="https://blog.axosoft.com/2016/10/20/golden-rule-of-rebasing-in-git">The Golden Rule Of Rebasing</a>;</li><li><a href="https://www.toptal.com/git/the-advanced-git-guide">The Advanced Git Guide: Git Stash, Reset, Rebase, and More</a>;</li><li><a href="https://www.youtube.com/watch?v=tukOm3Afd8s">Git Rebase Interactive :: A Practical Example</a>;</li><li><a href="https://www.youtube.com/watch?v=4EOZvow1mk4">David Baumgold — Advanced Git — PyCon 2015</a>.</li></ul><p>Até a próxima!</p><p><em>Originally published at </em><a href="https://concrete.com.br/2017/09/04/git-para-corajosos-rebase-parte-1/"><em>www.concrete.com.br</em></a><em> on September 4, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4564e2d00090" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[O QA Programador]]></title>
            <link>https://medium.com/@mondaini/o-qa-programador-5061924bdc1e?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/5061924bdc1e</guid>
            <category><![CDATA[agile-testing]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Mon, 19 Dec 2016 18:00:48 GMT</pubDate>
            <atom:updated>2017-01-18T14:36:43.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8JzZcCkHgAl1bZPGZDolw.jpeg" /><figcaption>Cockpit of the First All-Electric Propulsion Aircraft — NASA Pic Of The Day</figcaption></figure><h4>Reflexões sobre a transição do meu papel como Desenvolvedor para Analista de QA.</h4><p><strong>Aviso</strong>: as opiniões deste artigo são minhas e qualquer pessoa é livre para discordar. :-)</p><h4>O início da carreira como Desenvolvedor</h4><p>Eu programo profissionalmente faz um pouco mais de sete anos, principalmente para web e usando tecnologias variadas. Nesse período, eu mudei de posição algumas vezes: antes de ser Programador eu já trabalhei como Suporte e tinha vontade de me tornar um Analista de Infraestrutura (cheguei até a estudar para certificações Linux). Alguns anos depois um caminho se abriu com uma oportunidade como programador e eu abracei.</p><p>Agora não foi diferente… Depois de sete anos exclusivamente como programador surgiu a oportunidade de trabalhar como QA e eu achei válido experimentar.</p><h4>A mudança para QA</h4><p>A reação inicial de praticamente todos os meus amigos e colegas desenvolvedores ao falar sobre o meu novo papel foi essa:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*xPekixCkqCo7wqHI2Pwkkg.gif" /></figure><p>Mas algumas pessoas reagiram positivamente:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*wvtVx4RBvKM1YydxUoE6_w.gif" /></figure><p>No início eu fiquei bastante incomodado com essas reações. Eram praticamente um aviso pra eu desistir e pedir pra voltar a ser um desenvolvedor normal. Mas eu decidi continuar no projeto e participar das reuniões do <a href="https://labs.spotify.com/2014/03/27/spotify-engineering-culture-part-1/">Capítulo de QA</a> da empresa — a estrutura de engenharia do Spotify possui áreas de conhecimento chamadas “Capítulos”, e o Capítulo de QA reúne todos os profissionais dessa área na empresa — e ouvir a experiência dos outros QAs da Concrete e de fora, participando inclusive do <a href="https://www.meetup.com/pt-BR/qasaopaulo/">Meetup de Qualidade de Software em SP</a>.</p><p>Com isso, descobri que o mercado de QA está mudando. A figura do profissional que faz somente testes manuais está cada vez mais deixada de lado, enquanto a demanda por profissionais que saibam programar não pára de crescer. Em um mundo onde o desenvolvimento ágil é a norma, os testes precisam de ser automatizados para não perdermos tempo.</p><p>As reações negativas que recebi, na verdade, eram fruto de um preconceito com o cargo e não refletem a realidade -talvez por pensarem apenas no QA que faz teste manual.</p><p>Então, quando comecei a estudar sobre o assunto descobri que existem diferentes perfis de QAs no mercado (<a href="https://www.thoughtworks.com/pt/insights/blog/agile-tester-30">veja este artigo falando sobre o Testador Ágil</a>). Dos perfis apresentados, o perfil que mais me chamou a atenção foi o técnico:</p><blockquote>Os QAs técnicos trabalham em par com desenvolvedores para construir a aplicação sem gap técnico. Eles codam juntos. Eles também ajudam os desenvolvedores a desenvolver usando TDD, promovendo boas práticas como código limpo e padrões de desenvolvimento, garantindo um código de alta qualidade.</blockquote><h4>A epifania: o QA Desenvolvedor</h4><p>Após essas descobertas houve uma epifania: o profissional de QA é um desenvolvedor, mesmo que ele não saiba disso.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*DBGdHlkB6DVjBy62d3TANQ.gif" /></figure><p>Sim, ainda existe uma barreira entre os Desenvolvedores e os QAs, e alguns Desenvolvedores pensam que o seu trabalho é diminuído pelos QAs e vice-versa. Essa é uma barreira que o QA Desenvolvedor de hoje p̶o̶d̶e deve ajudar a quebrar.</p><h4>O que eu já sabia e percebi que podia ajudar</h4><p>E depois desse momento mágico, eu vi que com a minha experiência existe uma quantidade de coisas que eu poderia ajudar ao Time, agora como QA:</p><ul><li><strong>Testes de API</strong>: já trabalhei em projetos de desenvolvimento de API e esse conhecimento foi bastante útil para lidar com os <a href="https://www.thoughtworks.com/radar/techniques/consumer-driven-contract-testing"><em>Testes de API (ou Testes de Contrato)</em></a></li><li><strong>TDD e Testes unitários</strong> — <a href="https://en.wikipedia.org/wiki/Pair_programming"><em>pareando</em></a> com os desenvolvedores do time. Basicamente duas pessoas escrevem código no mesmo computador onde uma possui o papel do Piloto, que escreve o código, e o Navegador que observa. Pra quem conhece pouco ou nada de testes unitários ou TDD, recomendo participar de um <a href="http://code.joejag.com/2009/the-coding-dojo.html"><em>Coding Dojo</em></a><em>.</em></li><li><strong>Testes <em>end-to-end</em></strong><em>: </em>antes de atuar como QA eu já havia implementado algumas vezes testes <em>end-to-end. </em>Na <a href="https://medium.com/u/a791b2313cef">Concrete Solutions</a> nós criamos duas ferramentas para facilitar a vida para criar estes tipos de teste: o <a href="http://www.github.com/concretesolutions/magneton">Magneton</a> e o <a href="https://github.com/concretesolutions/sunomono">Sunomono</a> (Web e Mobile respectivamente).</li><li><a href="https://www.docker.com/"><strong>Docker</strong></a><strong>, Linux e outros conhecimentos de Infra do passado</strong>: este tópico não está diretamente ligado à minha vida como programador, mas foi um conhecimento importante que adquiri ao longo dos anos — antes e durante — a minha carreira como programador. Esse tipo de conhecimento é importante quando você precisa lidar com um CI/CD, ambientes de desenvolvimento, conversar com os DevOps, explicar alguma tecnicalidade para o cliente, etc.</li></ul><h4>O que descobri que posso aprender</h4><p>Devido ao tempo curto de um Sprint, é necessário que o QA esteja bastante próximo ao negócio, ajudando a identificar os percalços antes que os desenvolvedores passem por eles, prevenindo bloqueios ao time.</p><p>Acredito que por ter estado do lado do Desenvolvedor por tantos anos pode me ajudar a estreitar o abismo entre o negócio e os desenvolvedores. Ainda assim não é algo simples e requer uma <a href="https://en.wikipedia.org/wiki/Soft_skills"><em>soft skill</em></a><em> </em>de comunicação que eu acredito que preciso melhorar.</p><p>Outros assuntos que são importantes de aprender são testes de segurança e de carga. Poder garantir que o software que o time está produzindo possui uma segurança aceitável e que ela aguenta pancada são argumentos mais do que suficientes pra mim.</p><h4>O que você pode aprender</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tF1TpUwTgdlGuZPFBXF1vA.jpeg" /></figure><p>Estamos chegando em 2017 gente. Acredito que já passamos do tempo onde saber programar era algo opcional. Eu entendo que pode ser complicado, mas é necessário dar o primeiro passo. Não faltam materiais gratuitos ou pagos de estudo ou comunidades onde é possível obter informação:</p><ul><li><a href="http://agiletesters.com.br/">agiletesters.com.br</a> — Comunidade brasileiras de Analistas de Teste</li><li><a href="http://codecademy.com/">codecademy.com</a> — Aulas interativas de programação em várias linguagens diferentes</li><li><a href="http://khanacademy.com/">khanacademy.com</a> — Também possui aulas de programação</li><li><a href="http://tryruby.org/">tryruby.org</a> — Mais uma aula interativa, apresentando Ruby</li><li><a href="http://alura.com.br/">alura.com.br</a> — Ensino a distância de linguagens, frameworks, todos relacionados à Desenvolvimento de software.</li></ul><p>Esses são apenas alguns lugares onde podemos obter conhecimento.</p><h4>Considerações finais</h4><p>Espero com este texto ter ajudado de certa forma tanto o Desenvolvedor que não conhece bem o papel de QA hoje quanto o QA que não sabe da sua relevância no mercado atual.</p><p>Caso tenham dúvidas, críticas ou elogios, por favor comentem. :-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Ixfu2MsbuOAe1Ef5-Dgqg.jpeg" /></figure><p>1 — A estrutura de engenharia do Spotify possui áreas de conhecimento chamadas “Capítulos”. O Capítulo de QA reúne todos os profissionais dessa área na empresa.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5061924bdc1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arduino + Python = Pequeno projeto de IoT]]></title>
            <link>https://medium.com/@mondaini/arduino-python-paci%C3%AAncia-little-iot-project-710c690cad88?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/710c690cad88</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Sun, 15 May 2016 22:47:10 GMT</pubDate>
            <atom:updated>2016-05-16T14:04:45.133Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-sa/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DF9a0uzxxu6f_31uFPcPg.jpeg" /></figure><p>Alguns anos atrás eu senti interesse no Arduino. Vi nessa placa uma oportunidade de saciar meu interesse em eletrônica e unir a programação. Porém, no meio do caminho encontrei alguns problemas: preço dos componentes, problemas com os correios (quem nunca) ou apenas falta de conhecimento mesmo.</p><p>Recentemente eu apresentei este projeto no <a href="http://pythonrio.python.org.br/grupy-granderio/">GruPy Grande Rio,</a> o primeiro evento sobre Python na Baixada Fluminense. Minha ideia foi justamente mostrar uma integração do Arduino com um projeto Python. Uma vez que eu já tinha feito a proposta, faltava realizar o projeto <em>de facto</em>. O objetivo deste post é mostrar um pouco partes desse quebra-cabeças de peças simples, porém com um resultado interessante.</p><h4><strong>Parte 1 — Componentes necessários</strong></h4><p>Os componentes do Arduino utilizados foram estes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DF9a0uzxxu6f_31uFPcPg.jpeg" /><figcaption>Arduino Nano: encontrado em qualquer birosca por aí.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*S7ga4FWFLXJCGczfpVQ_kQ.jpeg" /><figcaption><a href="http://www.dx.com/p/arduino-compatible-4-channel-relay-shield-module-144762">Relay Shield</a> em todo seu esplendor. Comprado na DealExtreme</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*zg1qrtai2sQvoadKMizlMQ.jpeg" /><figcaption>Espelho de parede com tomadas modulares. Poderia ser uma extensão, mas achei o espelho mais prático. Comprado em loja de material de construção.</figcaption></figure><h4>Parte 2 — Botando o Arduino pra trabalhar</h4><p>Com estes componentes em mãos, imaginei o seguinte cenário: integrar o Arduino a uma página web, fazendo a comunicação pela porta serial. O setup inicial foi este:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0KxWORjlwvGxRuOF." /></figure><p>No exemplo ao lado, o <em>Relay Shield </em>possui apenas um relé, enquanto no meu caso seriam quatro fios verdes, um para cada relé.</p><p>Estes fios verdes representam cada pino digital do Arduino.</p><p>Com o Shield em mãos, eu comecei a escrever o código do Arduino e cheguei neste estado:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbf69c7c76a1f5e25c231574184a8be8/href">https://medium.com/media/bbf69c7c76a1f5e25c231574184a8be8/href</a></iframe><p>O resultado foi este aqui :</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FC__HacG8SRE%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DC__HacG8SRE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FC__HacG8SRE%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/07368094698f603779f44623360b9992/href">https://medium.com/media/07368094698f603779f44623360b9992/href</a></iframe><h4>Parte 3 — Give me power!</h4><p>Depois desse passo, fiquei tentado a testar isso pra valer e então fiz este esquema elétrico:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*TGEGXVdJ_3fIrdZsa_Ixpg.jpeg" /></figure><p>Depois de ligar os relés à rede elétrica, o resultado foi este:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLLdrwF9DDeg%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLLdrwF9DDeg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FLLdrwF9DDeg%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d2da7ba70baa2d6c331f4b86618e6c5/href">https://medium.com/media/8d2da7ba70baa2d6c331f4b86618e6c5/href</a></iframe><p>Com o Arduino ligando e desligando as coisas pelo monitor da serial, resolvi partir pro Python, com o <a href="https://github.com/pyserial/pyserial">PySerial</a>.</p><h4>Parte 4 — Python!</h4><p>A minha primeira missão era usar o PySerial para comunicar com o Arduino. Consegui provar que funcionava bastante rápido, com o snippet abaixo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/561aebc010c74a4bc094046849a213d7/href">https://medium.com/media/561aebc010c74a4bc094046849a213d7/href</a></iframe><p>Note que usei a porta <em>COM3</em>, porquê estava no windows. No Linux ou OSX seria algo como <em>/dev/ttyUSB0</em> ou algo parecido.</p><p>Com isso vc já consegue, através do python, mandar as strings que o Arduino está esperando.</p><p>O próximo passo foi criar uma maneira intuitiva de mandar esses dados. Para isso decidi usar o Flask (um microframework web enxuto) e o Bootstrap pela responsividade: assim eu posso acessar a página de qualquer dispositivo com uma boa experiência.</p><h4>Parte 4.1 — Flask</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d4347d5bfb748c47e42fa3cfa6d70f/href">https://medium.com/media/f9d4347d5bfb748c47e42fa3cfa6d70f/href</a></iframe><p>Perceba que estou usando as classes <em>danger</em> e <em>success</em> do bootstrap para setar se o botão estará ligado ou desligado. Essa informação vai pro template que será renderizado para o usuário.</p><h4>Parte 4.2 — Bootstrap</h4><p>Para fazer o template, utilizei o Bootstrap e o Jinja. O código ficou desse jeito:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b7d6fd2de923af4f7f97ee91517c7969/href">https://medium.com/media/b7d6fd2de923af4f7f97ee91517c7969/href</a></iframe><p>O resultado da página sendo servida pelo Flask+Bootstrap ficou assim:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*kTie5Avq_aed-dSb4htnRw.jpeg" /></figure><h4>Conclusão</h4><p>Espero que tenham curtido o post. Para mim o interessante foi saber que com um conjunto de pequenos conhecimentos que acumulei, foi possível montar um projeto simples e útil.</p><p>O código dessa aventura está no <a href="https://github.com/fmondaini/Flask2Arduino">github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=710c690cad88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Montando um serviço de integração contínua para um projeto Django no Jenkins]]></title>
            <link>https://medium.com/@mondaini/montando-um-servi%C3%A7o-de-integra%C3%A7%C3%A3o-cont%C3%ADnua-para-um-projeto-django-no-jenkins-7deee55c4604?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/7deee55c4604</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Fri, 10 Apr 2015 02:59:16 GMT</pubDate>
            <atom:updated>2015-04-10T03:01:25.495Z</atom:updated>
            <content:encoded><![CDATA[<p>Neste tutorial vamos fazer uma demonstração de como incluir um projeto Django em Integração Contínua utilizando o Jenkins. Já falamos bastante sobre integração contínua <a href="http://blog.concretesolutions.com.br/2014/03/como-fazer-integracao-continua-no-android-parte-1/">em Android</a>, <a href="http://blog.concretesolutions.com.br/2014/02/como-desenvolver-app-ios-com-tdd-cobertura-e-integracao-continua-parte-1/">em iOS</a> e <a href="http://blog.concretesolutions.com.br/2013/02/22-integracao-continua-com-net-fazendo-na-mao-parte-1-de-3/">em .NET</a>, além de <a href="http://blog.concretesolutions.com.br/tag/integracao-continua/">alguns posts gerais sobre o assunto</a>, mas hoje vamos finalmente falar sobre integração contínua em Django.</p><p>Assumindo que já terminamos esse tutorial, vamos colocar o Jenkins para efetuar os testes da nossa aplicação sempre que um novo commit for enviado para o repositório.</p><p>Então, mãos à obra!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/0*GaN_Ry4lJGdWOtiw.gif" /></figure><h3>O projeto</h3><p>Para este tutorial, vamos utilizar como projeto <a href="https://docs.djangoproject.com/en/1.7/intro/tutorial01/">o tutorial oficial do site do Django</a> para a versão 1.7, pois ele já tem uns testes unitários para servir de exemplo.</p><h4>Instalação do projeto</h4><p>Para baixar o projeto, faça um git clone:</p><pre>git clone <a href="https://bitbucket.org/suporte_concrete/cs-django-jenkins.git">https://bitbucket.org/suporte_concrete/cs-django-jenkins.git</a></pre><p>Em seguida, crie um virtualenv<a href="https://docs.google.com/a/concretesolutions.com.br/document/d/1cpRo3ptXtjqsdCYu-U5cu75rqOej9M4TuqvvMY5_-yc/edit#heading=h.uil12u329ys6">*</a> para o projeto:</p><pre>virtualenv ~/projetos/virtualenvs/blog</pre><p>Ative o virtualenv:</p><p>source ~/projetos/virtualenvs/blog/bin/activate</p><p><strong>* O que é Virtualenv</strong></p><p>Ferramenta utilizada para criar ambientes isolados. Assim, você pode instalar os pacotes do seu projeto sem interferir nos pacotes instalados no escopo global do sistema operacional. Para saber mais, <a href="https://virtualenv.pypa.io/en/latest/">visite esse site</a>.</p><p>Instale os requirements do projeto:</p><pre>pip install -r requirements.txt</pre><p>Agora que já temos o nosso virtualenv com os pacotes necessários, vamos rodar um comando que irá efetuar as migrations:</p><pre>python manage.py migrate</pre><p>Feito isso, agora podemos rodar nosso projeto.</p><h4>Rodando o projeto localmente</h4><p>Para rodar o projeto na máquina, execute:</p><pre>python manage.py runserver</pre><p><strong>Importante: este comando deve ser usado somente em ambiente de desenvolvimento local. Para rodar em produção devem ser utilizados outros serviços, como apache + modwsgi, gunicorn + nginx, entre outros.</strong></p><h4>Rodando os testes</h4><p>Para rodar os testes, execute:</p><pre>python manage.py test</pre><p>O resultado deverá ser o seguinte:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/0*YIq8GURQreTFgDsF.jpg" /></figure><p>Agora que já sabemos como preparar o projeto e executar os testes, vamos instalar o Jenkins na máquina de integração contínua.</p><h3>Preparando a máquina</h3><h4>Instalação das dependências</h4><p>Precisamos instalar alguns pacotes para que o Jenkins consiga montar o ambiente e fazer os builds. Instale os seguintes pacotes com o <em>apt-get:</em></p><pre>sudo apt-get install -y git python-pip python-virtualenv</pre><h4>Instalando o Jenkins</h4><p>O primeiro passo é instalar o Jenkins na máquina. Como estamos utilizando no exemplo uma máquina Ubuntu, conseguimos instalá-lo facilmente com o comando <em>apt-get:</em></p><pre># Adicione a chave do repositório do Jenkins</pre><pre>wget -q -O — <a href="https://jenkins-ci.org/debian/jenkins-ci.org.key">https://jenkins-ci.org/debian/jenkins-ci.org.key</a> | sudo apt-key add –<br> sudo sh -c ‘echo deb <a href="http://pkg.jenkins-ci.org/debian">http://pkg.jenkins-ci.org/debian</a> binary/ &gt; /etc/apt/sources.list.d/jenkins.list’<br> sudo apt-get update<br> sudo apt-get install jenkins</pre><p>Após a instalação, verifique se o serviço está rodando com o comando:</p><pre>sudo service jenkins status</pre><p>Caso o serviço esteja rodando, o resultado será este:</p><pre>Jenkins Continuous Integration Server is running with the pid XXX</pre><p>Para iniciar o serviço execute:</p><pre>sudo service jenkins start</pre><p>Agora já podemos acessar o Jenkins na porta 8080 da máquina que instalamos (nesse caso, na minha própria máquina). Vamos acessar o endereço localhost:8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*6eKXRSLoL7zOrUjf.jpg" /></figure><h4>Dependências</h4><p>Por padrão, o Jenkins não permite acessar repositórios Git. Por isso, vamos precisar instalar um plugin do Git no Jenkins. Acesse o Jenkins na porta 8080, clique na opção “Manage Jenkins” e, na página seguinte, escolha a opção “Manage Plugins”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*QjHBlIS2_4ZHxG_c.jpg" /></figure><p>Na página de plugins, clique na aba “Available”, e filtre por “git plugin”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*bufDrk6duL-lYBx_.jpg" /></figure><p>Selecione o plugin e clique no botão “Download now and install after restart”. O download do plugin será exibido como a seguir:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/0*j64yoGaBCRvA1250.jpg" /></figure><h3>Configurando o nosso Job</h3><p>Agora que já temos no nosso servidor o Jenkins e o Git instalados, precisamos configurar o job para que o Jenkins consulte nosso repositório.</p><h4>Configurações iniciais</h4><p>Na página inicial, clique no link “New Item” para criar um novo Job. Preencha o nome do job e selecione a opção “Freestyle project”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*hLd-qS8u6X1822Xl.jpg" /></figure><p>Na página seguinte, selecione a opção “Discard Old Builds” para que os builds mais antigos sejam apagados automaticamente.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*7RvC3EPLlSarBlaZ.jpg" /></figure><h4><strong>Acesso ao repositório</strong></h4><p>Essa parte é vital. Nela, vamos selecionar o tipo de repositório, endereço, qual branch buscar por padrão, etc. Como nosso projeto está no bitbucket da Concrete, selecione a opção Git. Em seguida, insira a URL para o repositório:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*_iAPrsb8AFc_5XkN.jpg" /></figure><h4><strong>Gatilho para o Build — Build Triggers</strong></h4><p>Aqui podemos configurar a periodicidade que o Jenkins deve verificar alterações no servidor. No nosso caso, escolhi que ele consulte o repositório a cada 15 minutos. Caso exista alguma mudança, ele vai baixar a nova versão e testar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*7g_LELNe-fUo2dMI.jpg" /></figure><h4><strong>Build</strong></h4><p>Depois de baixar a versão mais nova, só precisamos conseguir rodar o código pra validar. Para isso, vamos inserir uma etapa na parte de <em>Build</em>. Para configurar, vamos adicionar um shell script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/0*m0GgxHdsD9yjfLDL.jpg" /></figure><p>Depois de escrito, nosso script ficou assim:</p><pre>#!/bin/bash</pre><pre>export WORKSPACE=pwd</pre><pre># Create/Activate virtualenv</pre><pre>virtualenv venv</pre><pre>source venv/bin/activate</pre><pre># Install Requirements</pre><pre>pip install -r requirements.txt</pre><pre># Run tests</pre><pre>python manage.py test</pre><p>Para concluir, salve a configuração.</p><h3>Será que está funcionando?</h3><p>Vamos forçar um novo build clicando no botão “Build Now”. Podemos acompanhar andamento do build na barra lateral ou clicar no link do número do build para ver o andamento com mais detalhes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*kDO5kzYZSulzK-zI.jpg" /></figure><p>Como podem ver, o Jenkins foi ao nosso repositório do Bitbucket, baixou o projeto e rodou os testes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/0*WV8pwdwVHWWk2pp_.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*wxwigyhGmbnbrXnF.gif" /></figure><h3>Bonus(!)</h3><p>Vamos instalar estes plugins: “Green Balls” e “ChuckNorris Plugin”, porque um indicador verde é muito melhor para indicar um sucesso do que um azul. Já o Chuck Norris, bem… quem melhor pra nos convencer a não quebrar um build do que ele?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*QPDFH6c8f7FDwzKX.jpg" /></figure><p>Com os plugins instalados, o resultado dos builds fica assim:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/0*TXNWF56liTMD0I3F.jpg" /><figcaption>Build quebrado</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*dAnn8C3i95phSAlg.jpg" /><figcaption>Build OK</figcaption></figure><p>Bom, é isso! Espero que tenham curtido e caso tenham alguma dúvida, postem nos comentários ou entrem em contato comigo pelo twitter @filipecm.</p><p>Lembrando que <a href="https://bitbucket.org/suporte_concrete/cs-django-jenkins">o projeto utilizado no post está hospedado no bitbucket da Concrete</a>.</p><p>Até a próxima!</p><p><em>Originally published at </em><a href="http://blog.concretesolutions.com.br/2015/03/integracao-continua-para-django-no-jenkins/"><em>blog.concretesolutions.com.br</em></a><em> on March 6, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7deee55c4604" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Assembling a Continuous Integration Service for a Django project on Jenkins]]></title>
            <link>https://medium.com/@mondaini/assembling-a-continuous-integration-service-for-a-django-project-on-jenkins-5f979d4c4184?source=rss-a7fa23cf59de------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f979d4c4184</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Filipe Mondaini]]></dc:creator>
            <pubDate>Fri, 10 Apr 2015 02:43:42 GMT</pubDate>
            <atom:updated>2017-08-15T22:52:02.812Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>Disclaimer: this post is the English version of the one I wrote on <a href="http://blog.concretesolutions.com.br/2015/03/integracao-continua-para-django-no-jenkins/">Concrete Solutions’ blog</a>.</p><p>In this tutorial, we will do a demonstration of how to add a Django project in Continuous Integration using Jenkins.</p><p>Assuming you’ve already finished this tutorial, let’s put Jenkins to run the tests of our application whenever we push new commits to the repository.</p><p>So let’s get down to business!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*sP-ObG6J0NTyaam5lERHZw.gif" /></figure><h3>The project</h3><p>For this tutorial, we are going to use as project the official <a href="https://docs.djangoproject.com/en/1.7/intro/tutorial01/">Django tutorial from version 1.7</a> because it already has unit tests for this example.</p><h4>Project installation</h4><p>First of all, let’s clone the project:</p><pre>git clone <a href="https://bitbucket.org/suporte_concrete/cs-django-jenkins.git">https://bitbucket.org/suporte_concrete/cs-django-jenkins.git</a></pre><p>Afterward, create a new Virtualenv* for our project:</p><pre>virtualenv ~/projetos/virtualenvs/blog</pre><p>Activate the Virtualenv:</p><pre>source ~/projetos/virtualenvs/blog/bin/activate</pre><p><strong>*But what is a Virtualenv?</strong></p><p>It is a tool used to create python isolated environments. That allows us to install the project’s dependencies without interfering on the dependencies from the OS’s global scope. To know more, <a href="https://virtualenv.pypa.io/en/latest/">visit this site</a>.</p><p>Install the project’s dependencies::</p><pre>pip install -r requirements.txt</pre><p>Now that we have our Virtualenv with the needed packages installed, let’s run a command to run our database migrations:</p><pre>python manage.py migrate</pre><p>Once this is done, we can now run our project.</p><h4>Running the project locally</h4><p>To run the project, execute:</p><pre>python manage.py runserver</pre><p><strong>Warning: this command should only be executed in a development environment. If you wish to run this project in Production, you must be relying on services Apache + modwsgi, gunicorn + Nginx, etc.</strong></p><h4>Executing the tests</h4><p>To run the tests, execute:</p><pre>python manage.py test</pre><p>The result must be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*WQnQ-cGJ3p4P-wAgEZT0Dw.jpeg" /><figcaption>All tests passing! :D</figcaption></figure><p>Now that we already know how to prepare the project and execute the tests, we are going to install Jenkins on the Continous Integration server.</p><h4>Preparing the server</h4><p><strong>Installing the dependencies</strong></p><p>We must install some packages for Jenkins to be able to create the environment and build the project. Install the following packages using <em>apt-get:</em></p><pre>sudo apt-get install -y git python-pip python-virtualenv</pre><p>The next step is to install Jenkins on the server. As for this post we are using a Ubuntu instance, we can easily install using <em>apt-get:</em></p><pre># Add the Jenkins repository key</pre><pre>wget -q -O — <a href="https://jenkins-ci.org/debian/jenkins-ci.org.key">https://jenkins-ci.org/debian/jenkins-ci.org.key</a> | sudo apt-key add -<br>sudo sh -c ‘echo deb <a href="http://pkg.jenkins-ci.org/debian">http://pkg.jenkins-ci.org/debian</a> binary/ &gt; /etc/apt/sources.list.d/jenkins.list’</pre><pre>sudo apt-get update<br>sudo apt-get install jenkins</pre><p>After the installation, check if the server is running with the command:</p><pre>sudo service jenkins status</pre><p>If the server is running correctly, you will receive this message:</p><pre>Jenkins Continuous Integration Server is running with the pid XXX</pre><p>To start the service, run:</p><pre>sudo service jenkins start</pre><p>Now we can access Jenkins on port 8080 from the server. Go to your browser and go to localhost:8080 (where localhost is the name or the IP of your server).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*cX3Lcix2y0GFZon-9YQIbg.jpeg" /></figure><h4>Dependencies</h4><p>Jenkins by default do not access git repositories, so we must install a Git plugin. Go to the Jenkins server, select the “Manage Jenkins” option and on the next page click on “Manage Plugins”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*nYyXI7zxxSMRQ2kozE4T5g.jpeg" /></figure><p>On the plugins page, click on the “Available” tab and then filter by “git plugin”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*Nhvhxqfut2HWGPRwhPN3BA.jpeg" /></figure><p>Select the plugin and click on “Download now and install after restart”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*TPbpuQv_Ywe1BDt-xXXdlA.jpeg" /><figcaption>Installing plugins</figcaption></figure><p><strong>Warning: If the page stops responding after a while, go back to the Jenkins home manually because the installation might be already done. ☹</strong></p><h3>Configuring our Job</h3><p>Now with our Jenkins server installed with the Git plugin, we must configure our job for Jenkins to be able to poll our repository for changes.</p><h4>Initial configuration</h4><p>On Jenkins homepage, click on “New Item” to create a new Job. Write the job name and select the “Freestyle project” option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*DUA8AkS359CXyJR40wqNDA.jpeg" /></figure><p>On the next page, select the “Discard Old Builds” option so the older builds to be discarded automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*wf3H_RtC2DIo7Yn-tJyOEg.jpeg" /></figure><p><strong>Accessing the repository:</strong></p><p>This step is vital. Here we are going to select the type of the repository (Git, Subversion, CVS), address, which branch to pick up and so on. As our project is a git repository, select the Git option and type the Repository URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*KR95sqGxE3VfX63f0ZOoPQ.jpeg" /></figure><p><strong>Warning: the URL from this repository is public. In a private repository, you will probably need to configure a ssh key on the server so Jenkins can have access to the repository.</strong></p><h4><strong>Build Triggers</strong></h4><p>Here we can schedule the Job according to our needs. In this case, I chose to poll the repository on every 15 minutes. If there is a change, Jenkins will download it and do the tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*RFg2vR7jAPmsAijlihuTkw.jpeg" /></figure><h4><strong>Build</strong></h4><p>After downloading the newer version, Jenkins must run the tests to finally validate our project. Let’s add a step on <em>Build</em>. In order to configure we will add a small shell script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*N5O276L8RRXEzh_EYLWeJQ.jpeg" /></figure><p>Our shell script for the Job:</p><pre>#!/bin/bash</pre><pre>export WORKSPACE=`pwd`</pre><pre># Create/Activate virtualenv</pre><pre>virtualenv venv</pre><pre>source venv/bin/activate</pre><pre># Install Requirements</pre><pre>pip install -r requirements.txt</pre><pre># Run tests</pre><pre>python manage.py test</pre><p>The Job configuration is now done, so click on save! ☺</p><h3>Is it working?</h3><p>As you can see, Jenkins polled our Bitbucket repository, downloaded the latest version and ran the tests:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*ZIeFBMP3k9N7EyJ6A-7TUg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*GX4TtZiuNaaEz2a7k0WZpg.gif" /></figure><h3>Bonus(!)</h3><p>Let’s install these plugins: “Green Balls” and “ChuckNorris Plugin”. Because a green light is much better than a blue one and Chuck Norris because who is best to persuade someone not to break the build than him? :-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*xi8WRqgbHJh4W_pWCRGSzw.jpeg" /></figure><p>These are the results of the builds with the new installed plugins:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/0*NV8cM6nSK3Yaz66v." /><figcaption>Broken build</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/0*q27SRf7pWgvF5P7-." /><figcaption>Build OK</figcaption></figure><p>Well, this is it! I hope you liked it and if you had any doubts, post a comment or get in touch with me on my Twitter @filipecm. Remember that <a href="https://bitbucket.org/suporte_concrete/cs-django-jenkins">the project from this post is hosted on Concrete Solutions’ Bitbucket.</a></p><p>If you are feeling generous, send me some bitcoin on the address: <a href="https://blockchain.info/address/17JXnDAf4DGMYs4RaSYF4Hh1dPHbCyzSD1"><strong>17JXnDAf4DGMYs4RaSYF4Hh1dPHbCyzSD1</strong></a></p><p>Until next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f979d4c4184" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>