Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MavenInDocker: Check if image is already built and reuse it #4

Closed
schnatterer opened this issue Jul 12, 2017 · 1 comment
Closed

MavenInDocker: Check if image is already built and reuse it #4

schnatterer opened this issue Jul 12, 2017 · 1 comment

Comments

@schnatterer
Copy link
Member

Less log cluttering on jenkins. Faster builds.

Note: Add a version of the image (like, 1, 2, 3, 4) so a rebuilt can be forced when the dockerfile is changed.

Example to illustrate basic concept:

private static final int DOCKER_FILE_VERSION=1

// ...
    def mvn(String args) {
// ....
if (!dockerImagePresent("ces-build-lib/maven/$dockerImageVersion-$DOCKER_FILE_VERSION")) {
 script.docker.build("ces-build-lib/maven/$dockerImageVersion-$DOCKER_FILE_VERSION", createDockerfilePath())
}

When writeDockerFile() is changed, DOCKER_FILE_VERSION is increased by one, forcing a rebuild of the archive.

schnatterer added a commit that referenced this issue Jul 15, 2017
Got rid of all user.home, argLine, etc. workarounds that cause a lot of trouble with surefire, failsafe, jacoco, pitest, etc.
Solution: Force java to use jenkins workspace as user.home by writing int into /etc/passwd.
Disadvantage: Docker image must be build once per workspace. Keep this in mind for #4!
@schnatterer
Copy link
Member Author

As of #7 now obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant