<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Jenkins on iMil.net</title>
    <link>http://imil.net/blog/tags/jenkins/</link>
    <description>Recent content in Jenkins on iMil.net</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 26 Mar 2017 10:44:50 +0000</lastBuildDate>
    <atom:link href="http://imil.net/blog/tags/jenkins/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Extract data-bits from your Jenkins jobs</title>
      <link>http://imil.net/blog/posts/2017/extract-data-bits-from-your-jenkins-jobs/</link>
      <pubDate>Sun, 26 Mar 2017 10:44:50 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2017/extract-data-bits-from-your-jenkins-jobs/</guid>
      <description>&lt;p&gt;Another quicky.&lt;/p&gt;&#xA;&lt;p&gt;I read &lt;a href=&#34;http://mlawire.blogspot.com.es/2009/07/alias-for-quickly-encodingdecoding-html.html&#34;&gt;here&lt;/a&gt; that cool trick to convert &lt;em&gt;HTML entities&lt;/em&gt; to plain text:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alias htmldecode&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;perl -MHTML::Entities -pe &amp;#39;decode_entities(\$_)&amp;#39;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In a &lt;em&gt;Debian&lt;/em&gt; based system, this suppose to &lt;code&gt;apt-get install libhtml-parser-perl&lt;/code&gt;.&#xA;Why bother you may ask? Well because the (awful) &lt;a href=&#34;https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI&#34;&gt;Jenkins-cli&lt;/a&gt; outputs text areas content in encoded &lt;em&gt;HTML entities&lt;/em&gt;, and for example I like the idea of being able to test a standalone &lt;em&gt;packer&lt;/em&gt; template that&amp;rsquo;s failing.&lt;/p&gt;&#xA;&lt;p&gt;Finally, here&amp;rsquo;s the full usecase:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Ansible playbook with packer in Jenkins</title>
      <link>http://imil.net/blog/posts/2017/ansible-playbook-with-packer-in-jenkins/</link>
      <pubDate>Sat, 25 Mar 2017 12:23:18 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2017/ansible-playbook-with-packer-in-jenkins/</guid>
      <description>&lt;p&gt;Quick one.&lt;/p&gt;&#xA;&lt;p&gt;While working on a build chain in order to register home-baked &lt;em&gt;AMIs&lt;/em&gt;, I wanted to use the &lt;code&gt;ansible-local&lt;/code&gt; &lt;a href=&#34;https://www.packer.io/&#34;&gt;packer&lt;/a&gt; &lt;em&gt;provisioner&lt;/em&gt; to setup the instance with a very basic &lt;em&gt;playbook&lt;/em&gt;. I needed to provide &lt;code&gt;ansible&lt;/code&gt; a playbook but didn&amp;rsquo;t find immediately how to achieve this within the &lt;a href=&#34;https://wiki.jenkins-ci.org/display/JENKINS/Packer+Plugin&#34;&gt;Jenkins-packer&lt;/a&gt; module. Turns out it&amp;rsquo;s tricky, in the &lt;em&gt;JSON Template Text&lt;/em&gt; (or the template file), declare the &lt;code&gt;playbook_file&lt;/code&gt; like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  [{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;type&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ansible-local&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;playbook_file&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{{ user `test_yml` }}&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;command&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;PYTHONUNBUFFERED=1 ansible-playbook&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then in the &lt;em&gt;File Entries&lt;/em&gt; field, the &lt;em&gt;Variable Name&lt;/em&gt; must be &lt;code&gt;test_yml&lt;/code&gt; and &lt;em&gt;File Contents&lt;/em&gt; filled with the playbook.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
