title: Automated testing using Jenkins for software install scripts (*.sh) ==> Automated testing of "apt-get install" commands (among others)
body: <p>I'm running a Ubuntu 20.10 notebook with all my software setups and configurations scripted. This came in handy several times when setting up the machine from scratch. Basically these scripts are a huge collection of apt-get install, snap install, npm install, curl, etc.</p>
  <p>However since I'm not testing the setup regularly, I'm running the risk of install failures the next time I have to re-setup my machine (e.g. due to outdated URLs or packages).</p>
  <p>That is why I wanna test my install scripts automatically and on a regular basis. I imagine it this way:</p>
  <ul>
  <li>Trigger script to start a vagrant box (same Ubuntu Version as my Notebook, Vagrantbox with UI)</li>
  <li>Run basic provisioning</li>
  <li>Run each Install script in parallel in the Vagrantbox</li>
  <li>Maybe write a test report in Asciidoc</li>
  </ul>
  <p>I think I already have a matching Vagrantbox: <a href="https://gitlab.com/sommerfeld.sebastian/vagrantboxes/-/tree/main/src/main/ubuntu-with-desktop" rel="nofollow noreferrer">https://gitlab.com/sommerfeld.sebastian/vagrantboxes/-/tree/main/src/main/ubuntu-with-desktop</a></p>
  <p>My question is: Is there a simple way top use Jenkins for test automation? Can Jenkins easily start up a Vagrantbox, provision the box (which basically is a Vagrant feature) and then send bash scripts to the Vagrantbox, run these scripts inside the box and capture the responses to write a complete test report?</p>
  <p>My Jenkins is running as a container (<code>FROM jenkins/jenkins:2.321</code>). So there is no Vagrant inside my jenkins container. Is there a way to &quot;pass&quot; the vagrant of my host machine into my container? I tried to mount the vagrant binary from my host system as a volume. But I always get &quot;/usr/bin/vagrant: not found, script returned exit code 127&quot;</p>
  <p>My docker-compose.yml</p>
  <pre class="lang-yaml prettyprint-override"><code>version: &quot;3.3&quot;
  services:
  
    jenkins-master:
      image: kobol/jenkins-master:latest
      container_name: jenkins-master
      environment:
        - SSH_AUTH_SOCK=${PARAM_SSH_AUTH_SOCK}
      restart: unless-stopped
      ports:
        - 9080:8080
        - 9081:9081
      volumes:
        - /usr/bin/vagrant:/usr/bin/vagrant
        - /var/run/docker.sock:/var/run/docker.sock
        - ${PARAM_HOME}/.ssh/known_hosts:/root/.ssh/known_hosts
        - ${PARAM_SSH_AUTH_SOCK}:${PARAM_SSH_AUTH_SOCK}
        - /etc/timezone:/etc/timezone:ro
        - /etc/localtime:/etc/localtime:ro
  </code></pre>
  <p>I mounted some docker binaries etc. in order to use the docker engine from my host. This works. So I thought can do the same for vagrant. But so far no success.</p>
  <p>If there is a way to use vagrant inside a container or something similar I would consider this as well. I just thought since I can pass docker from my host to my jenkins container, I try the same for vagrant as well.</p>
  <p>Anyone got some experience with that? Thanks guys and best regards</p>