You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -668,7 +668,7 @@ <h1 id="deploy-application-to-kubernetes-with-ansible">Deploy application to Kub
668
668
<h2id="prerequisites">Prerequisites</h2>
669
669
<p>You will need a running Kubernetes cluster, that supports services with <code>LoadBalancer</code> type, and a kubeconfig file that can be used to deploy application (a deployment and a service) into the cluster.</p>
670
670
<h2id="preparing-the-jenkins-instance">Preparing the Jenkins instance</h2>
671
-
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access and can run pipeline stages with docker agent. For example, Jenkins configuration from <ahref="../dind-jenkins/">Docker-in-Docker</a> example can be used.</p>
671
+
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access and can run pipeline stages with docker agent. For example, Jenkins configuration from <ahref="../jenkins-host-docker/">Jenkins with access to hosts Docker engine</a> example can be used.</p>
672
672
<p>We will use secret file to configure credentials for managing the target Kubernetes cluster. To create the secret file credential, open <em>Global credentials</em> from <em>Jenkins</em> credentials store from <ahref="http://localhost:8080/credentials/">Manage Jenkins > Manage Credentials</a> and click <em>Add Credentials</em> from the left side menu.</p>
<h1id="build-status-pipelines-and-job-dsl">Build status pipelines and Job DSL</h1>
649
649
<p>This example contains pipelines to produce builds with success, unstable, failed, aborted, and not-built statuses as well as Job DSL script to create a folder with projects that have these five different statuses.</p>
650
650
<h2id="preparing-the-jenkins-instance">Preparing the Jenkins instance</h2>
651
-
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access. For example, Jenkins configuration from <ahref="../dind-jenkins/">Docker-in-Docker</a> example can be used.</p>
651
+
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access. For example, Jenkins configuration from <ahref="../jenkins-host-docker/">Jenkins with access to hosts Docker engine</a> example can be used.</p>
652
652
<p>In order to be able to run the seed project we will need <ahref="https://plugins.jenkins.io/job-dsl/">Job DSL</a> plugin. Install the plugin through Available tab in <ahref="http://localhost:8080/pluginManager/available">Manage Jenkins > Manage Plugins</a>.</p>
653
653
<h2id="creating-and-running-the-seed-project">Creating and running the seed project</h2>
654
654
<p>To run the job DSL script, create a new pipeline with following script as an inline pipeline script and run the created pipeline.</p>
<ahref="https://github.com/kangasta/cicd-examples/raw/main/docs/examples/jenkins/dind-jenkins/README.md" title="View source of this page" class="md-content__button md-icon">
641
+
<ahref="https://github.com/kangasta/cicd-examples/raw/main/docs/examples/jenkins/jenkins-host-docker/README.md" title="View source of this page" class="md-content__button md-icon">
<h1id="jenkins-with-hosts-docker-socket">Jenkins with hosts Docker socket</h1>
648
+
<h1id="jenkins-with-access-to-hosts-docker-engine">Jenkins with access to hosts Docker engine</h1>
631
649
<p>Note that by default each of the example docker compose configurations will create their own volumes for the data. This might not be what you want. In order to use the same volumes for every docker compose configuration, run docker compose with <code>-p</code> (or <code>--project-name</code>) option. This can also be done by setting <code>COMPOSE_PROJECT_NAME</code> environment variable:</p>
<h2id="jenkins-image-with-docker-in-docker-support">Jenkins image with Docker-in-Docker support</h2>
652
+
<h2id="jenkins-image-with-docker-client">Jenkins image with Docker client</h2>
635
653
<p>To be able run Docker commands from inside the Jenkins container, we will need to install the Docker client. This can be done with a suitable Dockerfile:</p>
@@ -644,7 +662,8 @@ <h2 id="jenkins-image-with-docker-in-docker-support">Jenkins image with Docker-i
644
662
</span><spanid="__span-1-9"><aid="__codelineno-1-9" name="__codelineno-1-9" href="#__codelineno-1-9"></a><spanclass="c"># Note that the user is not switched back to jenkins here. This is to avoid problems with docker socket permissions.</span>
645
663
</span><spanid="__span-1-10"><aid="__codelineno-1-10" name="__codelineno-1-10" href="#__codelineno-1-10"></a><spanclass="c"># Do not use root user in production. Instead, match group IDs of docker groups in host and container and add jenkins user to docker group.</span>
646
664
</span></code></pre></div>
647
-
<p>When running this container, we will want to define ports and volumes. To do this, we will use a <code>docker-compose.yml</code> configuration:</p>
665
+
<h2id="jenkins-container-with-access-to-hosts-docker-engine">Jenkins container with access to hosts Docker engine</h2>
666
+
<p>When running Jenkins in a container, we will want to define ports and volumes. To do this, we will use a <code>docker-compose.yml</code> configuration:</p>
<p>These files are available in the repository that provides this website. In order to run Jenkins container with Docker-in-Docker support, <code>cd</code> into <code>docs/examples/jenkins/dind-jenkins</code> directory and run <code>docker compose up</code>.</p>
<p>These files are available in the repository that provides this website. In order to run Jenkins container with Docker-in-Docker support, <code>cd</code> into <code>docs/examples/jenkins/jenkins-host-docker</code> directory and run <code>docker compose up</code>.</p>
</span><spanid="__span-3-3"><aid="__codelineno-3-3" name="__codelineno-3-3" href="#__codelineno-3-3"></a><spanclass="c1"># If you want to see logs in the current terminal</span>
<p>This directory provides an example of a Jenkins pipeline that executes Robot Framework automation tasks with docker agent in parallel stages as well as combines and stores the produced HTML/XML report files.</p>
668
668
<h2id="preparing-the-jenkins-instance">Preparing the Jenkins instance</h2>
669
-
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access and can run pipeline stages with docker agent. For example, Jenkins configuration from <ahref="../dind-jenkins/">Docker-in-Docker</a> example can be used.</p>
669
+
<p>The pipeline provided by this example can be added to any Jenkins instance you have administrator access and can run pipeline stages with docker agent. For example, Jenkins configuration from <ahref="../jenkins-host-docker/">Jenkins with access to hosts Docker engine</a> example can be used.</p>
670
670
<p>In order to be able to run the pipeline we will need <ahref="https://plugins.jenkins.io/docker-workflow/">Docker Pipeline</a> and <ahref="https://plugins.jenkins.io/robot/">Robot Framework</a> plugins. Install these plugins through <em>Available</em> tab in <ahref="http://localhost:8080/pluginManager/available">Manage Jenkins > Manage Plugins</a> and restart the Jenkins instance after these plugins have been installed. The restart can be done, for example, from the plugins page or by restarting the container with <code>docker compose down</code> and <code>docker compose up</code>.</p>
671
671
<h2id="configure-the-pipeline">Configure the pipeline</h2>
672
672
<p>First, create a new pipeline via <em><ahref="http://localhost:8080/view/all/newJob">New Item</a></em> button in the rigth side menu of the Jenkins dashboard. The name of the pipeline could be for example <code>Screenshots</code> and it should be an pipeline.</p>
0 commit comments