Reputation: 177
We have setup jenkins in kubernetes cluster. In a pipeline we are calling an agent, actually this agent contains 3 containers of which 1 container can be used by next stage. But the problem is since I'm mentioning agent in every stage, each stage pulls new pod which in return increase build time, how will I rectify this so that the build time can be decreased.
We use a total of 4 different agents for a pipeline.
Upvotes: 0
Views: 435
Reputation: 3220
You can attach a shared persistent volume to the build container to speed up the build process and If you are using Jenkins & kubernetes, you should definitely try out the container-based agents. Scaling your jenkins agents on kubernetes helps you from a lot of administrative overhead that you get with static build VMs.
The below information extracted from the document authored by Bibin Wilson might be helpful to you:
For example, if you take a Java application, it has many Maven package dependencies.
When you build the Java apps, it downloads dependencies added in the pom.xml from the remote maven repository the first time, and it creates a local .m2 cache directory where the dependent packages are cached.
The .m2 cache is not possible in Docker agent-based builds as it gets destroyed after the build.
We can create a persistent volume for the maven cache and attach it to the agent pod via the container template to solve this issue.
Upvotes: 1