Shariq Nawaz
Shariq Nawaz

Reputation: 31

Configuring different build tools for Jenkins Instance in Openshift

We are providing Jenkins As a Service using Openshift as orchestration platform in our corporate environment. Different teams use different tools and their version to configure jobs.

For instance, we have 3 different combinations of java and maven. 5 different version of npm, 2 different version of python.

I wanted to know what is the best practice of configuring different tools?

Do I need to create and use slave image for each combination and different version of tool?

Is it a good practice to keep a simple slave image like different jdk versions (1.7, 1.8 etc) and configure JDK, NPM, Maven, Python packages as tools and use a persistent volume on slave. So that, during build these packages are setup on the fly in the PVC.

Is that an anti-pattern to use tools this way in docker slave images?

Upvotes: 1

Views: 414

Answers (2)

Chris Bolton
Chris Bolton

Reputation: 2314

I have accomplished this by creating a git repository called jenkins and the structure of the repository looks like

master/
  plugins.txt
  config-stuff

agents/
  base/
  nodejs8/
  nodejs10/
  nodejs12/
  maven/
  java8/

openshift/
  templates/
    build.yaml
    deploy.yaml (this includes the deployment and configmaps to attach the agents)
  params/
    build
    deploy

We are able to build each agent independently and the master independently. We place the deployment template on the OpenShift cluster so the user has to do oc process openshift//jenkins | oc apply -f - to install Jenkins in a namespace. However, you should also look into helm for installing Jenkins as a helm chart.

Upvotes: 1

Malgorzata
Malgorzata

Reputation: 7031

In my view is better to create images separately for tools for specific apps - Java for Java tools, Python, only Python tools. You can use Docker Compose that you will have all tools available from single host. You will preserve volume data when containers are created. Compose supports variables in the compose file. You can use these variables to customize your composition for different environments, or different users.

Compose preserves all volumes used by your services. When docker-compose up runs, if it finds any containers from previous runs, it copies the volumes from the old container to the new container. This process ensures that any data you’ve created in volumes isn’t lost.

Compose caches the configuration used to create a container. When you restart a service that has not changed, Compose re-uses the existing containers. Re-using containers means that you can make changes to your environment very quickly.

Here is example of compose file: compose-file.

Upvotes: 0

Related Questions