jenkinsci / jenkinsci/docker-plugin

Add Instance Number to Environment Variables

Open
#1,070 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
498
Forks
324
Avg merge
1d 2h
Merged PRs (30d)
2

Description

I run multiple builds on a single host by setting "Instance Capacity" > 1. While this works fine, I have a monolithic app that takes a while to do a fresh git clone with each build. I could speed this up by bind mounting my "Remote File System Root" to a volume so that previous git clones can be reused but, as far as I can tell, this currently wouldn't work properly with multiple concurrent instances.

I think I could address this by having a volume mount declaration like:
type=volume,src=jenkins_agent,dst=/home/jenkins/agent_$INSTANCE_NUMBER

OR perhaps by having a static volume mount and setting my Remote File System Root to something like:
/home/jenkins/agent/workspace_$INSTANCE_NUMBER

But for the above to work, I believe the return value of the following method needs to be saved to the INSTANCE_NUMBER environment variable:

https://github.com/jenkinsci/docker-plugin/blob/ae073a3dd095ab4dc1331d64b169101b125b42cf/src/main/java/com/nirima/jenkins/plugins/docker/DockerCloud.java#L341

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.