Skip to content

Commit f606207

Browse files
committed
Merge branch 'stable-3.x'
2 parents d20a84b + 922bc65 commit f606207

File tree

3 files changed

+223
-55
lines changed

3 files changed

+223
-55
lines changed

README.md

Lines changed: 219 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,244 @@
1-
# Git SCM plugin for Jenkins
1+
# Git plugin
22

3-
![Plugin Version](https://img.shields.io/jenkins/plugin/v/git.svg?label=version) [![Build Status](https://ci.jenkins.io/buildStatus/icon?job=Plugins/git-plugin/master)](https://ci.jenkins.io/job/Plugins/job/gitplugin/job/master/)
3+
[![Build Status](https://ci.jenkins.io/job/Plugins/job/git-plugin/job/master/badge/icon)](https://ci.jenkins.io/job/Plugins/job/git-plugin/job/master/)
4+
[![Contributors](https://img.shields.io/github/contributors/jenkinsci/git-plugin.svg)](https://github.com/jenkinsci/git-plugin/graphs/contributors)
5+
[![GitHub release](https://img.shields.io/github/release/jenkinsci/git-plugin.svg?label=release)](https://github.com/jenkinsci/git-plugin/releases/latest)
46

5-
Git software configuration management for Jenkins.
7+
<img src="https://git-scm.com/images/logos/downloads/Git-Logo-2Color.png" width="303">
68

7-
* see [Jenkins Wiki](https://plugins.jenkins.io/git) for feature descriptions
8-
* use [Jenkins JIRA](https://issues.jenkins-ci.org) to report issues or request features
9+
## Introduction
910

10-
## Requirements
11+
The git plugin provides fundamental git operations for Jenkins projects.
12+
It can poll, fetch, checkout, branch, list, merge, and tag repositories.
1113

12-
* Jenkins `2.138.4` or newer
14+
## Contents
1315

14-
## Development
16+
* [Changelog](#changelog)
17+
* [Configuration](#configuration)
18+
* [Extensions](#extensions)
19+
* [Environment Variables](#environment-variables)
20+
* [Properties](#properties)
21+
// * [Pipelines](#pipelines)
22+
// * [Performance Tuning](#performance-tuning)
23+
// * [Reference repositories](#reference-repositories)
24+
* [Combining repositories](#combining-repositories)
25+
* [Bug Reports](#bug-reports)
26+
* [Contributing to the Plugin](#contributing-to-the-plugin)
1527

16-
### Branches
28+
## Changelog
1729

18-
The `master` branch is the primary development branch.
30+
Release notes are recorded in [GitHub](https://github.com/jenkinsci/git-plugin/releases) beginning with git plugin 3.10.1.
31+
Prior release notes are recorded on the [Jenkins wiki](https://wiki.jenkins.io/display/JENKINS/Git+Plugin#GitPlugin-ChangeLog-MovedtoGitHub).
1932

20-
Branches using name pattern `stable-{VERSION}` are development branches
21-
for changes from a base release `VERSION`. For example `stable-3.x` is the
22-
branch used to release fixes for plugin version `3.x`.
33+
## Configuration
2334

24-
### Building the Plugin
35+
### Using Credentials
2536

26-
To build the plugin you will need
27-
* [Maven](https://maven.apache.org/) version `3.5.4` or newer
28-
* [Java Development Kit (JDK)](https://jdk.java.net/) version `8` or version `11`
37+
The git plugin supports username / password credentials and private key credentials provided by the [Jenkins credentials plugin](https://plugins.jenkins.io/credentials).
38+
Select credentials from the job definition drop down menu or enter their identifiers in Pipeline job definitions.
2939

30-
Run the following command to build the plugin (Java 8)
40+
### Push Notifications
3141

32-
```shell
33-
mvn package
34-
```
42+
### Enabling JGit
3543

36-
Run the following command to build the plugin (Java 11)
44+
See the [git client plugin documentation](https://plugins.jenkins.io/git-client) for instructions to enable JGit.
45+
JGit becomes available throughout Jenkins once it has been enabled.
3746

38-
```shell
39-
mvn -Djenkins.version=2.164.1 package
40-
```
47+
## Extensions
4148

42-
### Contributing to the Plugin
49+
### Advanced checkout behaviors
4350

44-
Plugin source code is hosted on [GitHub](https://github.com/jenkinsci/git-plugin).
45-
New feature proposals and bug fix proposals should be submitted as
46-
[pull requests](https://help.github.com/articles/creating-a-pull-request).
47-
Fork the repository. Make the desired changes in your forked copy. Submit
48-
a pull request to the `master` branch. Your pull request will be evaluated
49-
by the [Jenkins job](https://ci.jenkins.io/job/Plugins/job/git-plugin/).
51+
Timeout (in minutes) for checkout operation::
52+
Specify a timeout (in minutes) for checkout.
5053

51-
Before submitting your pull request, please add tests which verify your
52-
change. There have been many developers involved in the git plugin and
53-
there are many users who depend on the git plugin. Tests help us assure
54-
that we're delivering a reliable plugin and that we've communicated
55-
our intent to other developers in a way that they can detect when they
56-
run tests.
54+
### Advanced clone behaviours
5755

58-
Code coverage reporting is available as a maven target and is actively
59-
monitored. Please improve code coverage with the tests you submit.
60-
Code coverage reporting is written to `target/site/jacoco/` by the maven command
56+
Fetch tags::
57+
Deselect this to perform a clone without tags, saving time and disk space when you just want to access what is specified by the refspec.
6158

62-
```shell
63-
mvn -P enable-jacoco clean install jacoco:report
64-
```
59+
Honor refspec on initial clone::
60+
Perform initial clone using the refspec defined for the repository.
61+
This can save time, data transfer and disk space when you only need to access the references specified by the refspec.
62+
63+
Shallow clone::
64+
Perform shallow clone.
65+
Git will not download the complete history of the project, saving time and disk space when you just want to access the latest version of a repository.
66+
67+
Shallow clone depth::
68+
Set shallow clone depth to the specified numebr of commits.
69+
Git will only download that many commits from the remote repository, saving time and disk space.
70+
71+
[[clone-reference-repository-path,reference repository path]]
72+
Path of the reference repo to use during clone::
73+
Specify a folder containing a repository that will be used by git as a reference during clone operations.
74+
This option will be ignored if the folder is not available on the agent.
75+
76+
Timeout (in minutes) for clone and fetch operations::
77+
Specify a timeout (in minutes) for clone and fetch operations.
78+
79+
### Advanced sub-modules behaviours
80+
81+
Disable submodules processing::
82+
Ignore submodules in the repository.
83+
84+
Recursively update submodules::
85+
Retrieve all submodules recursively.
86+
Without this option, submodules which contain other submodules will ignore the contained submodules.
87+
88+
Update tracking submodules to tip of branch::
89+
Retrieve the tip of the configured branch in .gitmodules.
90+
91+
Use credentials from default remote of parent repository::
92+
Use credentials from the default remote of the parent project.
93+
Submodule updates do not use credentials by default.
94+
Enabling this extension will provide the parent repository credentials to each of the submodule repositories.
95+
Submodule credentials require that the submodule repository must accept the same credentials as the parent project.
96+
If the parent project is cloned with https, then the authenticated submodule references must use https as well.
97+
If the parent project is cloned with ssh, then the authenticated submodule references must use ssh as well.
98+
99+
Shallow clone::
100+
Perform shallow clone of submodules.
101+
Git will not download the complete history of the project, saving time and disk space.
102+
103+
Shallow clone depth::
104+
Set shallow clone depth for submodules.
105+
Git will only download recent history of the project, saving time and disk space.
106+
107+
Path of the reference repo to use during submodule update::
108+
Folder containing a repository that will be used by git as a reference during submodule clone operations.
109+
This option will be ignored if the folder is not available on the agent running the build.
110+
A reference repository may contain multiple subprojects.
111+
See the [combining repositories](#combining-repositories) section for more details.
112+
113+
Timeout (in minutes) for submodules operations::
114+
Specify a timeout (in minutes) for submodules operations.
115+
This option overrides the default timeout.
116+
117+
Number of threads to use when updating submodules::
118+
Number of parallel processes to be used when updating submodules.
119+
Default is to use a single thread for submodule updates
120+
121+
### Calculate changelog against a specific branch
122+
123+
Name of repository::
124+
Name of the repository, such as origin, that contains the branch.
125+
126+
Name of branch::
127+
Name of the branch used for the changelog calculation within the named repository.
128+
129+
### Checkout to a sub-directory
130+
131+
Specify a local directory (relative to the workspace root) where the git repository will be checked out.
132+
If left empty, the workspace root itself will be used.
133+
134+
### Checkout to specific local branch
135+
136+
Branch name::
137+
If given, checkout the revision to build as HEAD on the named branch.
138+
If value is an empty string or "**", then the branch name is computed from the remote branch without the origin.
139+
In that case, a remote branch origin/master will be checked out to a local branch named master, and a remote branch origin/develop/new-feature will be checked out to a local branch named develop/newfeature.
140+
141+
### Clean after checkout
142+
143+
Clean the workspace **after** every checkout by deleting all untracked files and directories, including those which are specified in .gitignore.
144+
Resets all tracked files to their versioned state.
145+
Ensures that the workspace is in the same state as if cloned and checkout were performed in a new workspace.
146+
Reduces the risk that current build will be affected by files generated by prior builds.
147+
Does not remove files outside the workspace (like temporary files or cache files).
148+
Does not remove files in the `.git` repository of the workspace.
149+
150+
### Clean before checkout
65151

66-
Before submitting your change, review the SpotBugs output to
67-
assure that you haven't introduced new warnings.
152+
Clean the workspace **before** every checkout by deleting all untracked files and directories, including those which are specified in .gitignore.
153+
Resets all tracked files to their versioned state.
154+
Ensures that the workspace is in the same state as if cloned and checkout were performed in a new workspace.
155+
Reduces the risk that current build will be affected by files generated by prior builds.
156+
Does not remove files outside the workspace (like temporary files or cache files).
157+
Does not remove files in the `.git` repository of the workspace.
68158

69-
```shell
70-
mvn spotbugs:check
159+
### Create a tag for every build
160+
161+
Create a tag in the workspace for every build to unambiguously mark the commit that was built.
162+
You can combine this with Git publisher to push the tags to the remote repository.
163+
164+
### Custom SCM name - __Deprecated__
165+
166+
Unique name for this SCM.
167+
Was needed when using Git within the Multi SCM plugin.
168+
Pipeline is the robust and feature-rich way to checkout from multiple repositories in a single job.
169+
170+
### Custom user name/e-mail address
171+
172+
user.name::
173+
Defines the user name value which git will assign to new commits made in the workspace.
174+
If given, `git config user.name [this]` is called before builds.
175+
This overrides values from the global settings.
176+
177+
user.email::
178+
Defines the user email value which git will assign to new commits made in the workspace.
179+
If given, `git config user.email [this]` is called before builds.
180+
This overrides whatever is in the global settings.
181+
182+
// ### Don't trigger a build on commit notifications
183+
// ### Force polling using workspace
184+
// ### Git LFS pull after checkout
185+
// ### Merge before build
186+
// ### Polling ignores commits from certain users
187+
// ### Polling ignores commits in certain paths
188+
// ### Polling ignores commits with certain messages
189+
190+
### Prune stale remote tracking branches
191+
192+
Runs `git remote prune` for each remote to prune obsolete local branches.
193+
194+
// ### Sparse checkout paths
195+
// ### Strategy for choosing what to build
196+
197+
### Use commit author in changelog
198+
199+
The default behavior is to use the Git commit's "Committer" value in build changesets.
200+
If this option is selected, the git commit's "Author" value is used instead.
201+
202+
// ### Wipe out repository and force clone
203+
204+
## Environment Variables
205+
206+
## Properties
207+
208+
Some git plugin settings can only be controlled from command line properties set at Jenkins startup.
209+
210+
Default timeout::
211+
The default initial git timeout value can be overridden through the property `org.jenkinsci.plugins.gitclient.Git.timeOut` (see [JENKINS-11286](https://issues.jenkins-ci.org/browse/JENKINS-11286)).
212+
The property should be set on both master and agent to have effect (see [JENKINS-22547](https://issues.jenkins-ci.org/browse/JENKINS-22547)).
213+
214+
// ## Pipelines
215+
216+
// ## Performance Tuning
217+
218+
// ### Reference repositories
219+
220+
### Combining repositories
221+
222+
A single reference repository may contain commits from multiple repositories.
223+
For example, if a repository named `parent` includes references to submodules `child-1` and `child-2`, a reference repository could be created to cache commits from all three repositories using the commands:
224+
```
225+
$ mkdir multirepository-cache.git
226+
$ cd multirepository-cache.git
227+
$ git init --bare
228+
$ git remote add parent https://github.com/jenkinsci/git-plugin
229+
$ git remote add child-1 https://github.com/jenkinsci/git-client-plugin
230+
$ git remote add child-2 https://github.com/jenkinsci/platformlabeler-plugin
231+
$ git fetch --all
71232
```
72233

73-
## To Do
234+
Those commands will create a single bare repository which includes the current commits from all three repositories.
235+
If that reference repository is used in the advanced clone options <<clone-reference-repository-path>>, it will reduce data transfer and disc use for the parent repository.
236+
If that reference repository is used in the submodule options <<submodule-reference-repository-path>>, it will reduce data transfer and disc use for the submodule repositories.
237+
238+
## Bug Reports
239+
240+
Report issues and enhancements in the [Jenkins issue tracker](https://issues.jenkins-ci.org).
241+
242+
## Contributing to the Plugin
74243

75-
* Fix [bugs](https://issues.jenkins-ci.org/secure/IssueNavigator.jspa?mode=hide&reset=true&jqlQuery=project+%3D+JENKINS+AND+status+in+%28Open%2C+"In+Progress"%2C+Reopened%29+AND+component+%3D+git-plugin)
76-
* Improve code coverage
77-
* Improve javadoc
244+
Refer to [contributing to the plugin](CONTRIBUTING.md) for contribution guidelines.

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<packaging>hpi</packaging>
2121
<name>Jenkins Git plugin</name>
2222
<description>Integrates Jenkins with GIT SCM</description>
23-
<url>https://wiki.jenkins.io/display/JENKINS/Git+Plugin</url>
23+
<url>https://github.com/jenkinsci/git-plugin</url>
2424
<inceptionYear>2007</inceptionYear>
2525

2626
<properties>
@@ -32,9 +32,10 @@
3232
<useBeta>true</useBeta>
3333
<concurrency>1C</concurrency>
3434
<scm-api-plugin.version>2.6.3</scm-api-plugin.version>
35-
<jcasc.version>1.29</jcasc.version>
35+
<jcasc.version>1.30</jcasc.version>
3636
<maven.checkstyle.plugin.version>3.1.0</maven.checkstyle.plugin.version>
3737
<maven.checkstyle.version>8.24</maven.checkstyle.version>
38+
<linkXRef>false</linkXRef>
3839
</properties>
3940

4041
<build>

src/test/java/jenkins/plugins/git/GitJCasCCompatibilityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ protected void assertConfiguredAsExpected(RestartableJenkinsRule restartableJenk
3535

3636
@Override
3737
protected String stringInLogExpected() {
38-
return "Setting class hudson.plugins.git.SubmoduleConfig. branches = [mybranch-3, mybranch-4]";
38+
return "Setting class hudson.plugins.git.SubmoduleConfig.branches = [mybranch-3, mybranch-4]";
3939
}
4040
}

0 commit comments

Comments
 (0)