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

Provide GitInDocker class for more deterministic Git Commands #42

Open
schnatterer opened this issue May 29, 2020 · 0 comments
Open

Provide GitInDocker class for more deterministic Git Commands #42

schnatterer opened this issue May 29, 2020 · 0 comments

Comments

@schnatterer
Copy link
Member

schnatterer commented May 29, 2020

Especially when implementing extensive Git Operations in Jenkins (e.g. GitFlow or GitOps) it might be important to rely specific git features (or avoid bugs fixed in specific versions).

However, when using the Git class as is, the calls are executed by the git client provided by the Jenkins agent. This makes the outcome of calls to the methods of Git strongly dependend on the agent.

This fact can be changed by executing all Git Commands in a Container that contains a deterministic version of git.
We could implement this similar to MavenInDocker, by deriving from Git and overriding a method that executes all script.sh calls for Git.
In this method we could wrap the original method to be executed in a container, e.g. like so:

  new Docker(this).image("alpine/git:v${gitVersion}")
          .mountJenkinsUser()
          .inside('--entrypoint=""') {
               super.method()
          }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant