Skip to main content

Integrate Jenkins on Docker hosted in Ubuntu

Docker is a platform for running applications in an isolated environment called a Docker container. Applications like Jenkins can be downloaded as read-only images, each of which is run in Docker as a container.

However, when your Jenkins is installed on a dynamic Docker hosted in Ubuntu without GUI, you might not be able to configure build and integration with Katalon Studio from the user interface normally.

This tutorial will guide you through configuring and building your Katalon Project with Jenkins on Docker hosted in Ubuntu. Your Katalon project will run with the Katalon Studio Docker image; therefore, pre-installed Katalon Studio and Katalon Runtime Engine on your local machine are not required.

You can pull Katalon Studio Docker Image at Docker Hub.
Important:

Integrate Jenkins with Docker

To integrate with Docker on Jenkins, you need to install the Docker plugin and Docker Pipeline, then set an environment path to Jenkins. Do as follows:

  1. Install plugins.
    1. Open Jenkins, then go to Dashboard > Manage Jenkins > Manage Plugins.
      manage plugins

    2. The Plugin Manager page appears. In the Available tab, search for Docker plugin and Docker Pipeline, then select them.
      plugins

    3. Click Install without restart.
  2. Add an environment path.

    To run Docker commands from Jenkins, you need to add an environment path to Jenkins. The PATH specifies where to find the folder containing Docker commands.

    Go to Dashboard > Manage Jenkins > Configure System > Global properties. Select the Environment variables to add a global variable named PATH with this value: $PATH:/usr/local/bin:.

    global properties

    Note: To find the correct Docker installation path, open Terminal, copy and paste the following command line: which docker. The result will tell you where the Docker is.

Upload your Katalon project on Jenkins

Note:
  • Ensure Docker is running and that both the Docker plugin and Docker Pipeline are active on Jenkins.
  • Clone or download our sample CI/CD project at ourGitHub repository.

You have two options for uploading your Katalon project to Jenkins:

  • From a Git repository.

  • From your local workspace.

Upload a Git repository

To upload your Katalon project as a Git repository to Jenkins, follow these steps:
  1. Prepare your Katalon project repository on GitHub.
  2. In the Jenkins Dashboard, go to New Item and create a Freestyle project.
    new item

  3. In the Source Code Management section, choose Git.
  4. Enter your repository URL, select branches to build, repository browser, and additional behaviors, if any.
    add git repository

Upload in the local workspace

To upload your Katalon project from a local workspace to Jenkins, follow these steps:
  1. Put your CI/CD project folder in this directory: Users/Your_user_name/.jenkins/workspace. Copy your project folder name.
  2. In the Jenkins Dashboard, go to New Item and create a Freestyle project. Name your project the same name as your project folder in your local Jenkins workspace.

Build your project

To build your Katalon project in Jenkins, follow these steps:
  1. In the Build section, click Add build step and choose Execute shell.
    Input your command, for example:
    docker run -t --rm -v "$(pwd)":/tmp/project katalonstudio/katalon katalonc.sh -projectPath=/tmp/project -browserType="Chrome" -retry=0 -statusDelay=15 -testSuitePath="Test Suites/TS_RegressionTest" -apikey=<YOUR_API_KEY>
    command

    Note:

    You can find more command line options at Command syntax.

    After you are done with the configuration, click Save.

  2. In your project, click Build Now.
    build now

  3. To view the console log, click on your current build on Jenkins and select Console Output.

    In the Console Output, you can view the status when Docker starts finding the katalonstudio/katalon image, verifies your licenses, reloads plugins, and executes your test. If Docker cannot find the katalonstudio/katalon image locally, it automatically pulls this image.

    console output

    When the test is being run, you can also view this console log in Docker.
    docker log

    To view your report files, you can go to this directory: Users/Your_user_name/.jenkins/workspace/Your_project_name/Reports or your third-party integration like Katalon TestOps, Azure DevOps, or qTest.

    Note:

    For real-time monitoring and better reporting capabilities, consider integrating your project with Katalon TestOps. See also Upload test results to Katalon TestOps from Katalon Studio.