Skip to content

Commit

Permalink
Merge branch 'master' into incrementals
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed May 15, 2018
2 parents ddb8fad + 769e7ed commit 5080254
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 372 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
@@ -1,7 +1,7 @@
Contributing to the Git Plugin
==============================

The git plugin implements the [Jenkins SCM API](https://wiki.jenkins.io/display/JENKINS/SCM+API+Plugin).
The git plugin implements the [Jenkins SCM API](https://plugins.jenkins.io/scm-api).
Refer to the SCM API documentation for [plugin naming conventions]https://github.com/jenkinsci/scm-api-plugin/blob/master/docs/implementation.adoc#naming-your-plugin(),
and for the [preferred locations of new functionality](https://github.com/jenkinsci/scm-api-plugin/blob/master/CONTRIBUTING.md#add-to-core-or-create-extension-plugin).

Expand Down
9 changes: 6 additions & 3 deletions Jenkinsfile
@@ -1,9 +1,9 @@
#!groovy

// Test plugin compatibility to latest Jenkins LTS
// Test plugin compatibility to recent Jenkins LTS
// Allow failing tests to retry execution
buildPlugin(jenkinsVersions: [null, '2.60.1'],
findbugs: [run: true, archive: true, unstableTotalAll: '0'],
buildPlugin(jenkinsVersions: [null, '2.107.2'],
findbugs: [run:true, archive:true, unstableTotalAll: '0'],
failFast: false)

def branches = [:]
Expand All @@ -16,6 +16,9 @@ branches["ATH"] = {
dir(checkoutGit) {
checkout scm
infra.runMaven(["clean", "package", "-DskipTests"])
// Include experimental git-client in target dir for ATH
// This Git plugin requires experimental git-client
infra.runMaven(["dependency:copy", "-Dartifact=org.jenkins-ci.plugins:git-client:3.0.0-beta2:hpi", "-DoutputDirectory=target", "-Dmdep.stripVersion=true"])
dir("target") {
stash name: "localPlugins", includes: "*.hpi"
}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -2,7 +2,7 @@

Git software configuration management for Jenkins

* see [Jenkins wiki](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin) for detailed feature descriptions
* see [Jenkins wiki](https://plugins.jenkins.io/git) for detailed feature descriptions
* use [JIRA](https://issues.jenkins-ci.org) to report issues / feature requests

## Master Branch
Expand All @@ -28,13 +28,13 @@ run tests.
Code coverage reporting is available as a maven target and is actively
monitored. Please improve code coverage with the tests you submit.

Before submitting your change, please review the findbugs output to
Before submitting your change, review the findbugs output to
assure that you haven't introduced new findbugs warnings.

## Building the Plugin

```bash
$ java -version # Need Java 1.8, earlier versions are unsupported for build
$ java -version # Need Java 1.8
$ mvn -version # Need a modern maven version; maven 3.5.0 and later are known to work
$ mvn clean install
```
Expand Down
2 changes: 1 addition & 1 deletion essentials.yml
@@ -1,7 +1,7 @@
---
ath:
athRevision: "dad333092159cb368efc2f9869572f0a05d255ac"
jenkins: "2.121-rc15727.3b61b96119b9"
jenkins: "2.121"
tests:
- "GitPluginTest"
- "GitUserContentTest"
Expand Down
101 changes: 24 additions & 77 deletions pom.xml
Expand Up @@ -10,7 +10,7 @@
<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<url>https://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>
Expand All @@ -20,42 +20,21 @@
<packaging>hpi</packaging>
<name>Jenkins Git plugin</name>
<description>Integrates Jenkins with GIT SCM</description>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin</url>
<url>https://wiki.jenkins.io/display/JENKINS/Git+Plugin</url>
<inceptionYear>2007</inceptionYear>

<properties>
<revision>3.9.1</revision>
<revision>4.0.0</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>1.642.3</jenkins.version>
<java.level>7</java.level>
<jenkins.version>2.60.3</jenkins.version>
<java.level>8</java.level>
<no-test-jar>false</no-test-jar>
<concurrency>1C</concurrency>
<findbugs.failOnError>false</findbugs.failOnError>
<scm-api-plugin.version>2.2.0</scm-api-plugin.version>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-injector</artifactId>
Expand All @@ -68,34 +47,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>display-info</id>
<configuration>
<rules>
<enforceBytecodeVersion>
<excludes combine.children="append">
<!-- Loaded conditionally. -->
<exclude>org.eclipse.jgit:org.eclipse.jgit.java7</exclude>
</excludes>
</enforceBytecodeVersion>
</rules>
</configuration>
</execution>
</executions>
<configuration>
<rules>
<requireUpperBoundDeps>
<excludes combine.children="append">
<!-- workflow-cps requests 1.1.1, core 2.60.1 requests 1.2.1 -->
<exclude>org.jenkins-ci.ui:jquery-detached</exclude>
</excludes>
</requireUpperBoundDeps>
</rules>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -122,14 +73,12 @@
</developer>
</developers>


<dependencies>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.5</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
Expand All @@ -138,12 +87,12 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git-client</artifactId>
<version>2.7.0</version>
<version>3.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.1.14</version>
<version>2.1.13</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -164,7 +113,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.10</version>
<version>2.11</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down Expand Up @@ -245,7 +194,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>token-macro</artifactId>
<version>1.12.1</version> <!-- Depends on Jenkins 1.609 -->
<version>2.1</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -276,7 +225,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.10</version>
<version>2.11</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -326,31 +275,29 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-matchers</artifactId>
<version>2.2.0</version>
<version>2.5.1</version>
<scope>test</scope>
</dependency>
<dependency> <!-- TODO pending core upgrade or haveged, test against a newer sshd so we do not run into NativePRNG hangs -->
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>sshd</artifactId>
<version>1.11</version>
<!-- Satisfy upper bounds dependency warnings -->
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.18</version>
<scope>test</scope>
</dependency>
<!-- Satisfy upper bounds dependency warnings -->
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.14</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>instance-identity</artifactId>
</exclusion>
<exclusion>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>ssh-cli-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>http://github.com/jenkinsci/${project.artifactId}-plugin</url>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>${scmTag}</tag>
</scm>

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/hudson/plugins/git/GitChangeSet.java
Expand Up @@ -435,9 +435,6 @@ private boolean hasHudsonTasksMailer() {
justification = "Tests use null instance, Jenkins 2.60 declares instance is not null")
private boolean isCreateAccountBasedOnEmail() {
Hudson hudson = Hudson.getInstance();
if (hudson == null) {
return false;
}
DescriptorImpl descriptor = (DescriptorImpl) hudson.getDescriptor(GitSCM.class);

if (descriptor == null) {
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -1088,7 +1088,7 @@ public EnvVars getEnvironment() {
buildData.saveBuild(revToBuild);

if (buildData.getBuildsByBranchName().size() >= 100) {
log.println("JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://wiki.jenkins-ci.org/display/JENKINS/Remove+Git+Plugin+BuildsByBranch+BuildData");
log.println("JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://wiki.jenkins.io/display/JENKINS/Remove+Git+Plugin+BuildsByBranch+BuildData");
}

if (candidates.size() > 1) {
Expand Down Expand Up @@ -1871,10 +1871,6 @@ private boolean isRevExcluded(GitClient git, Revision r, TaskListener listener,
@Initializer(after=PLUGINS_STARTED)
public static void onLoaded() {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
LOGGER.severe("Jenkins.getInstance is null in GitSCM.onLoaded");
return;
}
DescriptorImpl desc = jenkins.getDescriptorByType(DescriptorImpl.class);

if (desc.getOldGitExe() != null) {
Expand Down
33 changes: 13 additions & 20 deletions src/main/java/hudson/plugins/git/GitStatus.java
Expand Up @@ -154,33 +154,26 @@ public HttpResponse doNotifyCommit(HttpServletRequest request, @QueryParameter(r

final List<ResponseContributor> contributors = new ArrayList<>();
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
return HttpResponses.error(SC_BAD_REQUEST, new Exception("Jenkins.getInstance() null for : " + url));
}
String origin = SCMEvent.originOf(request);
for (Listener listener : jenkins.getExtensionList(Listener.class)) {
contributors.addAll(listener.onNotifyCommit(origin, uri, sha1, buildParameters, branchesArray));
}

return new HttpResponse() {
@Override
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node)
throws IOException, ServletException {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
if (i == MAX_REPORTED_CONTRIBUTORS) {
rsp.addHeader("Triggered", "<" + (contributors.size() - i) + " more>");
break;
} else {
contributors.get(i).addHeaders(req, rsp);
}
}
PrintWriter w = rsp.getWriter();
for (ResponseContributor c : contributors) {
c.writeBody(req, rsp, w);
return (StaplerRequest req, StaplerResponse rsp, Object node) -> {
rsp.setStatus(SC_OK);
rsp.setContentType("text/plain");
for (int i = 0; i < contributors.size(); i++) {
if (i == MAX_REPORTED_CONTRIBUTORS) {
rsp.addHeader("Triggered", "<" + (contributors.size() - i) + " more>");
break;
} else {
contributors.get(i).addHeaders(req, rsp);
}
}
PrintWriter w = rsp.getWriter();
for (ResponseContributor c : contributors) {
c.writeBody(req, rsp, w);
}
};
}

Expand Down
6 changes: 1 addition & 5 deletions src/main/java/hudson/plugins/git/GitTagAction.java
Expand Up @@ -43,7 +43,7 @@ protected GitTagAction(Run build, FilePath workspace, Revision revision) {
super(build);
this.ws = workspace.getRemote();
for (Branch b : revision.getBranches()) {
tags.put(b.getName(), new ArrayList<String>());
tags.put(b.getName(), new ArrayList<>());
}
}

Expand All @@ -53,10 +53,6 @@ protected GitTagAction(Run build, FilePath workspace, Revision revision) {
justification = "Tests use null instance, Jenkins 2.60 declares instance is not null")
public Descriptor<GitTagAction> getDescriptor() {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
LOGGER.severe("Jenkins.getInstance() null in GitTagAction.getDescriptor");
return null;
}
return jenkins.getDescriptorOrDie(getClass());
}

Expand Down

0 comments on commit 5080254

Please sign in to comment.