<?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: Imanol Valiente</title>
    <description>The latest articles on DEV Community by Imanol Valiente (@imvalient).</description>
    <link>https://dev.to/imvalient</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%2F183427%2Feb2783df-4d5c-4cb5-b43a-edfff38ab77f.png</url>
      <title>DEV Community: Imanol Valiente</title>
      <link>https://dev.to/imvalient</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imvalient"/>
    <language>en</language>
    <item>
      <title>Improve Your Remote Work</title>
      <dc:creator>Imanol Valiente</dc:creator>
      <pubDate>Fri, 08 Nov 2019 00:44:48 +0000</pubDate>
      <link>https://dev.to/imvalient/improve-your-remote-work-2pae</link>
      <guid>https://dev.to/imvalient/improve-your-remote-work-2pae</guid>
      <description>&lt;p&gt;For the last two years, I‘ve been working from home; actually, I have the freedom to choose from where I work, but it’s funny that I always end up working from home.&lt;/p&gt;

&lt;p&gt;It is probably one of the most grateful experiences I had in my career. I have proven I am trustworthy and reliable while independent, I have learned to be more organized, and I can focus on my career while keeping close to my known beings.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Life is short, spend it with people you love.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Remote working indeed gives you a lot of freedom and the chance to choose how and where you live your life, but it also involves responsibility and discipline. According to the type of schedule your company demands, fixed or not, you need to plan and comply with your schedule as if you went, every morning, to the office.&lt;/p&gt;

&lt;p&gt;Having a routine that you can stick and follow helps in developing the discipline, but it’s easier to follow a group of people than going on your own. So you have to learn to be confident with the decisions you take and stick to a routine based on those productivity techniques that make you a better professional.&lt;/p&gt;

&lt;p&gt;I will list a few tips from my experience to make the best of your remote work.&lt;/p&gt;

&lt;h1&gt;
  
  
  Adjust your habits to the new experience
&lt;/h1&gt;

&lt;p&gt;A good thing about not working in an office is that you can choose where to work from and how your workspace looks.&lt;/p&gt;

&lt;p&gt;The first thing you should take care of if you decide to always work from your home is the routine you are going to follow, make a generic plan of a working morning that is realistic, and compromise to achieve it every day. It’s quite important to be careful with loneliness and know how to deal with it.&lt;/p&gt;

&lt;p&gt;A piece of advice, focus when you are working and once you finish, get off your computer, try to spend time with your friends or family, go to the gym and do some exercise, There’s nothing better than releasing endorphins after a hard day at work.&lt;/p&gt;

&lt;p&gt;I always try to go out throughout the week and spend most of the weekends relaxing at home, focusing on my learning and feeding my entrepreneurship spirit.&lt;/p&gt;

&lt;p&gt;Every two months or so, I try to plan a trip and visit a new country to heal a bit my mind from the repetitive cycle of work, eat and sleep.&lt;/p&gt;

&lt;p&gt;It’s also an excellent habit to eventually meet with your teammates and spend a few days working with each other face to face doing some team building and sharing experiences. You will find the human side of that voice behind the screen that feeds you with tasks, questions, and GIFs.&lt;/p&gt;

&lt;h1&gt;
  
  
  Improve your communication skills
&lt;/h1&gt;

&lt;p&gt;It looks like a contradiction, but working on a distributed team enhanced my communication skills in a way that I never thought when I started that I was so bad at communicating my ideas.&lt;/p&gt;

&lt;p&gt;I don’t usually share video, just voice. But after a few calls with teammates and other people involved in the project, I realized that face to face communication is less productive than calling through phone or any VoIP software.&lt;/p&gt;

&lt;p&gt;When you are standing in a room having a meeting, discussing ideas or sharing knowledge, it’s a common thing to have people asking questions, speaking with each other or just interrupting. If you have to explain or transmit a complex idea, you can help your words with gestures and physical interactions. Sometimes when we tell stuff, we expect a confirmation gesture from our listeners, like a nod.&lt;/p&gt;

&lt;p&gt;When you are behind a microphone, with a call going on and you have to explain a complex topic, even if you are sending video, due to the latency of the network, it’s not easy to coordinate your explanation with gestures or physical interactions. It just doesn’t feel the same as doing it in place.&lt;/p&gt;

&lt;p&gt;Also, if you add those that interrupt the meeting with questions that aren’t questions because they realize later that what was going to be asked, it’s already answered, the whole session can become chaos.&lt;/p&gt;

&lt;p&gt;For example, when you are on a VoIP call explaining something and someone starts to speak at the same time, both voices mix up and people don’t understand you anymore. That kind of interruptions takes a few minutes to be recovered as both voices are heard at the same time and both parties have to decide who’s turn is.&lt;/p&gt;

&lt;p&gt;So for anyone starting with voice calls I suggest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mute your microphone always unless you have something to say.&lt;/li&gt;
&lt;li&gt;Don’t interrupt with a question that you are not sure you are going to end asking.&lt;/li&gt;
&lt;li&gt;Pay attention; most doubts arise for not following the speaker.&lt;/li&gt;
&lt;li&gt;Always be concrete and concise.&lt;/li&gt;
&lt;li&gt;Buy quality equipment and always use headphones, software-based echo filters do not work and it’s quite annoying to be interrupted with your voice when you are explaining a complex topic.
*You already know that latency is present on every internet communication. Be flexible with human errors that happen on-screen shared sessions and wait a bit before interrupting for a mistake that probably it’s already fixed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Improving your communication skills will speed up your meetings, as it’s proven that long meetings are the bottleneck of most of the employee’s productivity; it will help you be more efficient.&lt;/p&gt;

&lt;h1&gt;
  
  
  Be productive and measure it
&lt;/h1&gt;

&lt;p&gt;When I started with the remote experience, the first month or so, I used to think that I wasn’t working enough. Not having a teammate near me knowing that I was working made me feel, when I spent more than a day or so to finish a task, that I wasn’t working enough.&lt;/p&gt;

&lt;p&gt;This is a matter of trust and if you are remote working, you have to trust your teammates, so if you work hard, don’t bother with that feeling like I did, probably you’re working more than enough.&lt;/p&gt;

&lt;p&gt;The best thing you can do is measure it, if you work on a distributed team you have fewer eyes on you, which means that you can try different ways of working to improve your productivity. Don’t miss the opportunity, measure and compare it, there’s is a business behind productivity techniques, people get paid for coaching workers that want to boost their productiveness and I’ve seen tons of books on this topic already.&lt;/p&gt;

&lt;p&gt;For sure, you make use of a task tracker, so take a batch of your tasks, organize them, plan them, follow a known productivity technique and measure the result. Try changing something on your method for the next batch of tasks and compare it with the previous results. This way, you will achieve a continuous improvement that adapts to your way of working better than sticking to the already existing techniques.&lt;/p&gt;

&lt;p&gt;I’ve seen and been suggested a ton of techniques to improve my productivity, I am seriously into these techniques and actually, I spend time trying to understand them enough to see if they adapt to the tasks and kind of work I perform. For example, when I am into tasks that require investigation and document reading, I like the way the Pomodoro technique splits the work into intervals of 25 minutes, this way I don’t get overwhelmed with all the new stuff, but if I am into a more repetitive task where all I have to do is throw lines of code to describe the resources of a cloud environment in Terraform I tend to ignore this technique, take my headphones, put some music on and get the things done.&lt;/p&gt;

&lt;p&gt;I’ve found a few techniques that work and make me stay more focused, increase my productivity and my desire to get things done.&lt;/p&gt;

&lt;p&gt;At the end of every day, I try to plan what I need to do for the next day, this is not my primary source of tasks, I work with an issue tracker known as Jira where my team plans all the tasks that must be achieved in a period of time (usually 2 or 3 weeks). So I take the main tasks I am working on and split them into smaller tasks, the goal is to plan shortly, so I keep myself motivated through the days by finishing earlier smaller chunks of the main tasks.&lt;/p&gt;

&lt;p&gt;I try to keep track of everything I do and plan what I have to do for the day to come. Still, sometimes there are a few tasks that appear throughout the day, those are tasks that I try to finish as soon as they arise, but they’re not always short enough to finish them without losing context on the main task I was working. I once heard about a simple rule, and that’s what I follow.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If it takes less than 5 minutes do it now.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My day to day involves a lot of tasks, to keep track of what I’ve to do I always write everything in a notebook or a To-Do list. That’s a habit I started when I realized my mind could not remember all the things I had to do.&lt;/p&gt;

&lt;p&gt;There’re a few conclusions I got from working from home; an office has too many distractions for me, a job should not be the main reason for an employee to move to another city and if all the companies promoted remote working, the population between towns and villages would be more balanced. I think we can fight climate change as well by not taking the car every morning to move to the office.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>remotework</category>
    </item>
    <item>
      <title>Jenkins Configuration As Code</title>
      <dc:creator>Imanol Valiente</dc:creator>
      <pubDate>Mon, 30 Sep 2019 00:38:03 +0000</pubDate>
      <link>https://dev.to/imvalient/jenkins-built-from-code-42l0</link>
      <guid>https://dev.to/imvalient/jenkins-built-from-code-42l0</guid>
      <description>&lt;p&gt;It has been some time since I started working with Jenkins. One of my daily duties with this tool goes from, supervise the execution of legacy Jobs, to maintain and enhance declarative multibranch pipelines, always trying to achieve continuous integration and continuous delivery practices to promote packaged software through many environments until it gets the client's hands.&lt;/p&gt;

&lt;p&gt;Reaching out such a level of automation involves time, teams &amp;amp; processes. From my experience, It's a task that requires a lot of time and effort, everyone involved in the Software Development &amp;amp; Delivery process has to take hands on this new way of thinking &amp;amp; working, and adapt to it.&lt;/p&gt;

&lt;p&gt;After spreading a bit my thoughts on the DevOps culture, I would like to focus once again on the Jenkins topic. I spend most of my time between environments, and for each environment I work on an entirely different Jenkins, actually I test new features from fancy plugins that improve and clarifies the Software Delivery process on a Dev environment and once I verify the new feature works well I spend more time promoting it to the rest of the environments, this sounds like a repetitive task, actually I tend to avoid this kind of tasks, for over the years I pursue the adoption of EaC, Everything as Code, but for some reason, I had no chance to apply it yet on the Jenkins installation scope.&lt;/p&gt;

&lt;p&gt;So that's the main topic, I found a weakness on my daily duty, I am trying to achieve a solution, and I'll write about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Goal.
&lt;/h2&gt;

&lt;p&gt;The desired state I would like to reach is to be able to build a Jenkins instance where all of its configuration and Job definitions goes in declarative files, this way we have immutable Jenkins instances that deploy on any environment, whenever you add a plugin, job or modify a configuration it gets stored and versioned on Git, this way, no unknown configuration is able to break the desired state of the instances anymore and anyone can deploy the exact state on their localhost, for testing purposes for example.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to?
&lt;/h2&gt;

&lt;p&gt;I have decided to structure the project in two repositories.&lt;/p&gt;

&lt;p&gt;There's an initial project to set up the configuration at Jenkins instance level. On a file, we add the plugins to install and lock their versions, one of the plugins &lt;code&gt;Jenkins Configuration as Code&lt;/code&gt; lets us predefine the global configuration of Jenkins and the rest of the plugins without interacting with the Jenkins UI, finally a Dockerfile is used to build a Docker image that includes all the initialization files.&lt;/p&gt;

&lt;p&gt;A second project is used to interact with the &lt;code&gt;Jenkins DSL&lt;/code&gt; plugin; the goal is to store the jobs, folders, and views as code on groovy files, so only what we have defined on our Git repository applies to the Jenkins instance.&lt;/p&gt;

&lt;p&gt;I have decided to structure the project in two repositories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker.
&lt;/h3&gt;

&lt;p&gt;A widely known implementation of the Container software abstraction is used to pack, gather dependencies, and automate the deployment. We are going to build the Jenkins Instance using a Dockerfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; jenkins/jenkins:lts&lt;/span&gt;


&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; init-scripts /usr/share/jenkins/ref/init.groovy.d&lt;/span&gt;

&lt;span class="k"&gt;ADD&lt;/span&gt;&lt;span class="s"&gt; plugins.txt /usr/share/jenkins/ref/&lt;/span&gt;
&lt;span class="k"&gt;ADD&lt;/span&gt;&lt;span class="s"&gt; jenkins.yaml /usr/share/jenkins/ref/&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;/usr/local/bin/install-plugins.sh &amp;lt; /usr/share/jenkins/ref/plugins.txt

&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; CASC_JENKINS_CONFIG /usr/share/jenkins/ref/&lt;/span&gt;

&lt;span class="k"&gt;VOLUME&lt;/span&gt;&lt;span class="s"&gt; /var/jenkins_home&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The following shell script can be a useful resource to launch the build phase.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;

docker build &lt;span class="nt"&gt;-t&lt;/span&gt; jenkins_as_code:0.1.0 &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;There are two phases, the one that builds the container image and the phase that runs it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build phase.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Plugins Installation.
&lt;/h3&gt;

&lt;p&gt;To automate the installation of the desired plugins, we are going to make use of an existing shell script included in Jenkins. The script its located at &lt;code&gt;/usr/local/bin/&lt;/code&gt;, inside the container, with the following name &lt;code&gt;install-plugins.sh&lt;/code&gt;, to install the plugins save them inside a file and call the script with the file as a parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;workflow-aggregator:2.6
configuration-as-code:1.30
configuration-as-code-support:1.18
credentials:2.3.0
blueocean:1.19.0
job-dsl:1.74
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we can store in code the plugins that need to be installed and lock their versions.&lt;/p&gt;

&lt;h3&gt;
  
  
  JCaC Jenkins Plugin.
&lt;/h3&gt;

&lt;p&gt;Working on Jenkins involves many plugin installations, for each plugin a specific configuration must be set up. All these configuration changes add up through time; a Jenkins instance tends to evolve based on the needs of the software delivery process.&lt;/p&gt;

&lt;p&gt;The GUI is used to configure Jenkins; the thing is that there is no place to centralize and store what configurations are applied other than browsing it through the Web.&lt;/p&gt;

&lt;p&gt;Most of the people have been solving this issue using groovy initialization scripts. It works, but as it involves some coding, its not as friendly and readable as desired.&lt;/p&gt;

&lt;p&gt;The good news is the existence of a &lt;a href="https://plugins.jenkins.io/configuration-as-code"&gt;plugin&lt;/a&gt; that lets you define the global and plugin configurations through a YAML file. It's great because it handles the configuration changes and we can deploy an initial Jenkins install with all the configurations already applied.&lt;/p&gt;

&lt;p&gt;So we can progress on the primary goal, the deployment of immutable Jenkins instances defined by versioned configuration files.&lt;/p&gt;

&lt;p&gt;This plugin even lets you define a seed job, its a job that fetches DSL files and applies the changes creating other Jobs, views, and many more features.&lt;/p&gt;

&lt;p&gt;In our case the following &lt;code&gt;jenkins.yaml&lt;/code&gt; file is used to provide the configuration. The seed job fetches another project from Github that contains a few DSL based objects to create resources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;jenkins&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;systemMessage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Jenkins&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;As&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Code&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Concept."&lt;/span&gt;
  &lt;span class="na"&gt;views&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;myView&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Jobs&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Config&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;as&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Code"&lt;/span&gt;
&lt;span class="na"&gt;security&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;globalJobDslSecurityConfiguration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;useScriptSecurity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="s"&gt;freeStyleJob("Jobs Generator") {&lt;/span&gt;
        &lt;span class="s"&gt;scm {&lt;/span&gt;
            &lt;span class="s"&gt;github('imanol-dev/jenkins_as_code_jobs', 'master')&lt;/span&gt;
        &lt;span class="s"&gt;}&lt;/span&gt;
        &lt;span class="s"&gt;steps {&lt;/span&gt;
            &lt;span class="s"&gt;dsl {&lt;/span&gt;
              &lt;span class="s"&gt;external('*.groovy')&lt;/span&gt;
            &lt;span class="s"&gt;}&lt;/span&gt;
        &lt;span class="s"&gt;}&lt;/span&gt;
      &lt;span class="s"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A great thing about this plugin is that you can modify the YAML file and reload the new configuration, applying all the changes without the need to recreate the Jenkins instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Runtime phase.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Default User.
&lt;/h3&gt;

&lt;p&gt;While working on this, I faced an issue trying to automate the creation of a default administrator user through a configuration file.&lt;/p&gt;

&lt;p&gt;To solve it, I did some research and found a &lt;a href="https://github.com/thbkrkr/jks/blob/master/init.groovy.d/1-create-admin-user.groovy"&gt;repository&lt;/a&gt; that makes use of Groovy initialization scripts; the script goes inside the container in the &lt;code&gt;/usr/share/jenkins/ref/init.groovy.d&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;This way, to create the user, we only have to fill the following environment variables&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ADMIN_USERNAME=
ADMIN_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Skip the Wizard.
&lt;/h3&gt;

&lt;p&gt;Every time you deploy a new Jenkins instance, the first time you log in, you get prompted with a Configuration Wizard that helps you set up a few initial parameters and install some suggested plugins.&lt;/p&gt;

&lt;p&gt;For newcomers, this can be kind of helpful, but we are trying to achieve automation that deploys what it's written in the configuration files, so we don't need this feature.&lt;/p&gt;

&lt;p&gt;The way to avoid it is to run the container with the following environment variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;JAVA_OPTS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-Djenkins.install.runSetupWizard=false"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Get It Running.
&lt;/h2&gt;

&lt;p&gt;I work on a Linux based OS; it makes it easier for me to get things done, if you're not already on a Unix based OS I suggest you think about the change.&lt;/p&gt;

&lt;p&gt;To get this working, you need Bash and Docker. Once you satisfy these requirements, you can clone the &lt;a href="https://github.com/imanol-dev/jenkins_as_code"&gt;project&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── init-scripts
│   └── admin-user.groovy
├── config
│   └── runtime.env
├── Dockerfile
├── jenkins.yaml
├── plugins.txt
├── build
└── run
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The first step is building the Docker image from the current directory. There's a bash script to do this named &lt;code&gt;build&lt;/code&gt;. It's a basic docker build command to generate the &lt;code&gt;jenkins_as_code&lt;/code&gt; image in your local registry.&lt;/p&gt;

&lt;p&gt;Once the image builds, it is time to get it running. There's another script &lt;code&gt;run&lt;/code&gt; that runs the built image; it shares a volume to store the data Jenkins generates on the &lt;code&gt;/var/jenkins_home&lt;/code&gt; directory (It's a must to create the &lt;code&gt;jenkins_home&lt;/code&gt; directory before running the container), exposes the 8080 port and loads the &lt;code&gt;config/runtime.env&lt;/code&gt; file as an environment file.&lt;/p&gt;

&lt;p&gt;The Jenkins instance can be accessed through a web browser on the following &lt;code&gt;localhost:8080&lt;/code&gt; URL, sign in using the credentials initially set on the &lt;code&gt;config/runtime.env&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Once inside, there's a seed job to generate, through the DSL plugin, the rest of the desired jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Job DSL Plugin. Jobs definition.
&lt;/h2&gt;

&lt;p&gt;I have found a few ways to create Jenkins jobs; you can create them manually through the web interface, define them on XML files using the Jenkins CLI to import them, and make use of the DSL plugin.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://plugins.jenkins.io/job-dsl"&gt;DSL plugin&lt;/a&gt; lets you define jobs on a declarative form, more human-readable.&lt;/p&gt;

&lt;p&gt;I have defined a few jobs on a separate &lt;a href="https://github.com/imanol-dev/jenkins_as_code_jobs"&gt;repository&lt;/a&gt;, using the seed job, I reference this repository, so after executing it, all the new jobs appear automatically. The seed job can be triggered off a git change, so if you delete or modify a job through code, this gets updated on the Jenkins instance without manual execution.&lt;/p&gt;

&lt;p&gt;If you have the Jenkins instance running, roll the seed job to create the new Jenkins objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about Ansible?
&lt;/h2&gt;

&lt;p&gt;I did some research about this matter solved with Ansible, and I've found a few roles that let you install Jenkins in remote machines through Ansible Roles. There's a role that caught my attention that lets you tune up the configurations, setting up the variables associated to the role, this approach lets you choose between Containerized or VM deployments and define as code all your Jenkins Jobs in an XML format.&lt;/p&gt;

&lt;p&gt;From my point of view &lt;a href="https://github.com/emmetog/ansible-jenkins"&gt;this role&lt;/a&gt; its a great option but I wrote this post to easily store all your Jenkins Configurations and Job definitions as code in Docker containers, I am planning to evolve this first approach to end deploying a Jenkins cluster in Kubernetes using Helm so, from my point of view, Ansible does not fit for what I initially planned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;There are plenty of better approaches for the multi-environment deployment matter. A single Jenkins across all the environments could do the job, but sometimes it's not only about the best technical solution.&lt;/p&gt;

&lt;p&gt;In my case, sometimes, I have to adapt to entirely isolated environments, with independent data centers and different network settings for the same project. A few years already in the business world have taught me that there's probably something more significant than my ideas already running and I have to adapt to it.&lt;/p&gt;

&lt;p&gt;I enjoyed this research; I wanted to find a way to automate a few repetitive and manual tasks so I could deploy multiple Jenkins instances with the same configurations but with different Jobs.&lt;/p&gt;

&lt;p&gt;Thanks for reading and if in some manner, this is helpful for you, do not hesitate writing me.&lt;/p&gt;

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