Run reformat code for whole project
This commit is contained in:
parent
ae8c9840cd
commit
61f5325d47
2
pom.xml
2
pom.xml
|
@ -1,4 +1,4 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
|
|
|
@ -20,9 +20,8 @@ public class GitLabProjectBranchesService {
|
|||
|
||||
private static final Logger LOGGER = Logger.getLogger(GitLabProjectBranchesService.class.getName());
|
||||
|
||||
private final Cache<String, List<String>> projectBranchCache;
|
||||
|
||||
private static transient GitLabProjectBranchesService gitLabProjectBranchesService;
|
||||
private final Cache<String, List<String>> projectBranchCache;
|
||||
|
||||
GitLabProjectBranchesService() {
|
||||
this.projectBranchCache = CacheBuilder.<String, String>newBuilder()
|
||||
|
|
|
@ -96,6 +96,36 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
|
|||
initializeBranchFilter();
|
||||
}
|
||||
|
||||
@Initializer(after = InitMilestone.JOB_LOADED)
|
||||
public static void migrateJobs() throws IOException {
|
||||
GitLabPushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GitLabPushTrigger.DescriptorImpl.class);
|
||||
if (!oldConfig.jobsMigrated) {
|
||||
GitLabConnectionConfig gitLabConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
|
||||
gitLabConfig.getConnections().add(new GitLabConnection(oldConfig.gitlabHostUrl,
|
||||
oldConfig.gitlabHostUrl,
|
||||
oldConfig.gitlabApiToken,
|
||||
oldConfig.ignoreCertificateErrors));
|
||||
|
||||
String defaultConnectionName = gitLabConfig.getConnections().get(0).getName();
|
||||
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
|
||||
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
|
||||
if (trigger != null) {
|
||||
if (trigger.addCiMessage) {
|
||||
project.getPublishersList().add(new GitLabCommitStatusPublisher());
|
||||
}
|
||||
if (trigger.branchFilterType == null) {
|
||||
trigger.branchFilterType = trigger.branchFilterName;
|
||||
}
|
||||
project.addProperty(new GitLabConnectionProperty(defaultConnectionName));
|
||||
project.save();
|
||||
}
|
||||
}
|
||||
gitLabConfig.save();
|
||||
oldConfig.jobsMigrated = true;
|
||||
oldConfig.save();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getTriggerOnPush() {
|
||||
return triggerOnPush;
|
||||
}
|
||||
|
@ -177,11 +207,11 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
|
|||
@Extension
|
||||
public static class DescriptorImpl extends TriggerDescriptor {
|
||||
|
||||
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting);
|
||||
private boolean jobsMigrated = false;
|
||||
private String gitlabApiToken;
|
||||
private String gitlabHostUrl = "";
|
||||
private boolean ignoreCertificateErrors = false;
|
||||
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting);
|
||||
|
||||
public DescriptorImpl() {
|
||||
load();
|
||||
|
@ -261,34 +291,4 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
|
|||
return ProjectBranchesProvider.instance().doCheckBranchesSpec(project, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Initializer(after = InitMilestone.JOB_LOADED)
|
||||
public static void migrateJobs() throws IOException {
|
||||
GitLabPushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GitLabPushTrigger.DescriptorImpl.class);
|
||||
if (!oldConfig.jobsMigrated) {
|
||||
GitLabConnectionConfig gitLabConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
|
||||
gitLabConfig.getConnections().add(new GitLabConnection(oldConfig.gitlabHostUrl,
|
||||
oldConfig.gitlabHostUrl,
|
||||
oldConfig.gitlabApiToken,
|
||||
oldConfig.ignoreCertificateErrors));
|
||||
|
||||
String defaultConnectionName = gitLabConfig.getConnections().get(0).getName();
|
||||
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
|
||||
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
|
||||
if (trigger != null) {
|
||||
if (trigger.addCiMessage) {
|
||||
project.getPublishersList().add(new GitLabCommitStatusPublisher());
|
||||
}
|
||||
if (trigger.branchFilterType == null) {
|
||||
trigger.branchFilterType = trigger.branchFilterName;
|
||||
}
|
||||
project.addProperty(new GitLabConnectionProperty(defaultConnectionName));
|
||||
project.save();
|
||||
}
|
||||
}
|
||||
gitLabConfig.save();
|
||||
oldConfig.jobsMigrated = true;
|
||||
oldConfig.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @author Robin Müller
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.kohsuke.stapler.StaplerRequest;
|
|||
|
||||
import javax.ws.rs.ProcessingException;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.kohsuke.stapler.DataBoundConstructor;
|
|||
import javax.ws.rs.NotFoundException;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
|
|
@ -10,12 +10,12 @@ import java.util.HashSet;
|
|||
*/
|
||||
class AntPathMatcherSet extends HashSet<String> {
|
||||
|
||||
private transient final AntPathMatcher matcher = new AntPathMatcher();
|
||||
|
||||
public AntPathMatcherSet(Collection<? extends String> c) {
|
||||
super(c);
|
||||
}
|
||||
|
||||
private transient final AntPathMatcher matcher = new AntPathMatcher();
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
for (String s : this) {
|
||||
|
|
|
@ -5,10 +5,6 @@ import com.dabsquared.gitlabjenkins.Messages;
|
|||
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Sets;
|
||||
import hudson.model.AutoCompletionCandidates;
|
||||
import hudson.model.Item;
|
||||
import hudson.model.Job;
|
||||
|
@ -23,7 +19,6 @@ import org.eclipse.jgit.transport.URIish;
|
|||
import org.kohsuke.stapler.AncestorInPath;
|
||||
import org.kohsuke.stapler.QueryParameter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.dabsquared.gitlabjenkins.webhook;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.util.ACLUtil;
|
||||
import com.dabsquared.gitlabjenkins.util.LoggerUtil;
|
||||
import com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction;
|
||||
import com.dabsquared.gitlabjenkins.webhook.build.PushBuildAction;
|
||||
import com.dabsquared.gitlabjenkins.webhook.status.BranchBuildPageRedirectAction;
|
||||
|
|
|
@ -15,17 +15,16 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Daniel Brooks
|
||||
*/
|
||||
|
||||
@Extension
|
||||
public class GitLabWebHook implements UnprotectedRootAction {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GitLabWebHook.class.getName());
|
||||
|
||||
public static final String WEBHOOK_URL = "project";
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(GitLabWebHook.class.getName());
|
||||
|
||||
private transient final ActionResolver actionResolver = new ActionResolver();
|
||||
|
||||
public String getIconFileName() {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.dabsquared.gitlabjenkins.webhook.status;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.webhook.WebHookAction;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.Job;
|
||||
import hudson.model.Run;
|
||||
import hudson.util.HttpResponses;
|
||||
import jenkins.model.Jenkins;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.dabsquared.gitlabjenkins.webhook.status;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.util.BuildUtil;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.Job;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
-->
|
||||
<?jelly escape-by-default='true'?>
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
|
||||
<l:layout>
|
||||
<st:include it="${it.owner}" page="sidepanel.jelly"/>
|
||||
<l:main-panel>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?jelly escape-by-default='true'?>
|
||||
<div>
|
||||
This plugin integrates <a href="http://gitlab.com/">GitLab</a> to Jenkins by faking a GitLab CI Server.
|
||||
This plugin integrates
|
||||
<a href="http://gitlab.com/">GitLab</a>
|
||||
to Jenkins by faking a GitLab CI Server.
|
||||
</div>
|
|
@ -1,4 +1,5 @@
|
|||
<p>Comma-separated list of source branches allowed to trigger a build from a <b>Push event</b> or a <b>Merge Request event</b>.
|
||||
<p>
|
||||
Comma-separated list of source branches allowed to trigger a build from a <b>Push event</b> or a <b>Merge Request event</b>.
|
||||
If both fields are left empty, all branches are allowed to trigger this job.
|
||||
For <b>Merge Request events</b> only the target branch name is filtered out by the include and exclude lists.
|
||||
</div>
|
||||
</p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div>
|
||||
<div>
|
||||
<p>The target branch regex allows to limit the execution of this job to certain branches. Any branch matching the specified pattern triggers the
|
||||
job. No filtering is performed if the field is left empty.</p>
|
||||
<p>The target branch regex allows to limit the execution of this job to certain branches. Any branch matching the specified pattern triggers
|
||||
the job. No filtering is performed if the field is left empty.</p>
|
||||
<p>Examples:</p>
|
||||
<pre># Allow execution for debug and release branches: (.*debug.*|.*release.*) </pre>
|
||||
<pre># Ignore any branch with `Release` or `release` as subword: ^(?:(?![R|r]elease).)*$ </pre>
|
||||
|
|
|
@ -23,13 +23,13 @@ import static org.mockito.Mockito.when;
|
|||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class GitLabProjectBranchesServiceTest {
|
||||
|
||||
private final static List<String> BRANCH_NAMES_PROJECT_B = asList("master", "B-branch-1", "B-branch-2");
|
||||
|
||||
private GitLabProjectBranchesService branchesService;
|
||||
|
||||
@Mock
|
||||
private GitLabApi gitlabApi;
|
||||
|
||||
private final static List<String> BRANCH_NAMES_PROJECT_B = asList("master", "B-branch-1", "B-branch-2");
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
List<Branch> branchNamesProjectA = convert(asList("master", "A-branch-1"));
|
||||
|
|
|
@ -28,12 +28,12 @@ import static org.junit.Assert.assertThat;
|
|||
*/
|
||||
public class GitLabConnectionConfigSSLTest {
|
||||
|
||||
@Rule
|
||||
public JenkinsRule jenkins = new JenkinsRule();
|
||||
|
||||
private static int port;
|
||||
private static Server server;
|
||||
|
||||
@Rule
|
||||
public JenkinsRule jenkins = new JenkinsRule();
|
||||
|
||||
@BeforeClass
|
||||
public static void startJetty() throws Exception {
|
||||
port = PortFactory.findFreePort();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.dabsquared.gitlabjenkins.publisher;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
|
||||
import com.dabsquared.gitlabjenkins.connection.GitLabConnection;
|
||||
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig;
|
||||
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
|
||||
import com.dabsquared.gitlabjenkins.gitlab.api.model.BuildState;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.AbstractProject;
|
||||
|
|
|
@ -1,23 +1,14 @@
|
|||
package com.dabsquared.gitlabjenkins.trigger.handler.push;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.gitlab.hook.model.PushHook;
|
||||
import com.dabsquared.gitlabjenkins.testhelpers.GitLabPushRequestSamples;
|
||||
import com.dabsquared.gitlabjenkins.testhelpers.GitLabPushRequestSamples_7_10_5_489b413;
|
||||
import com.dabsquared.gitlabjenkins.testhelpers.GitLabPushRequestSamples_7_5_1_36679b5;
|
||||
import com.dabsquared.gitlabjenkins.testhelpers.GitLabPushRequestSamples_8_1_2_8c8af7b;
|
||||
import com.dabsquared.gitlabjenkins.trigger.exception.NoRevisionToBuildException;
|
||||
import hudson.plugins.git.RevisionParameterAction;
|
||||
import org.eclipse.jgit.transport.RemoteConfig;
|
||||
import org.junit.Rule;
|
||||
|
||||
import com.dabsquared.gitlabjenkins.testhelpers.GitLabPushRequestSamples;
|
||||
|
||||
import hudson.plugins.git.RevisionParameterAction;
|
||||
import org.junit.experimental.theories.DataPoints;
|
||||
import org.junit.experimental.theories.Theories;
|
||||
import org.junit.experimental.theories.Theory;
|
||||
|
@ -26,6 +17,11 @@ import org.junit.runner.RunWith;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@RunWith(Theories.class)
|
||||
public class PushHookTriggerHandlerGitlabServerTest {
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@ public class ActionResolverTest {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private static class ResourceServletInputStream extends ServletInputStream {
|
||||
|
||||
private final InputStream input;
|
||||
|
|
|
@ -33,13 +33,11 @@ public abstract class BuildPageRedirectActionTest {
|
|||
|
||||
@Rule
|
||||
public TemporaryFolder tmp = new TemporaryFolder();
|
||||
|
||||
@Mock
|
||||
private StaplerResponse response;
|
||||
|
||||
private String gitRepoUrl;
|
||||
protected String commitSha1;
|
||||
protected String branch = "master";
|
||||
@Mock
|
||||
private StaplerResponse response;
|
||||
private String gitRepoUrl;
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
|
|
|
@ -6,9 +6,7 @@ import hudson.model.BuildListener;
|
|||
import hudson.model.FreeStyleBuild;
|
||||
import hudson.model.FreeStyleProject;
|
||||
import hudson.model.Result;
|
||||
import hudson.model.queue.QueueTaskFuture;
|
||||
import hudson.plugins.git.GitSCM;
|
||||
import hudson.tasks.Shell;
|
||||
import hudson.util.OneShotEvent;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
|
@ -44,12 +42,13 @@ public abstract class BuildStatusActionTest {
|
|||
@Rule
|
||||
public TemporaryFolder tmp = new TemporaryFolder();
|
||||
|
||||
protected String commitSha1;
|
||||
protected String branch = "master";
|
||||
|
||||
@Mock
|
||||
private StaplerResponse response;
|
||||
|
||||
private String gitRepoUrl;
|
||||
protected String commitSha1;
|
||||
protected String branch = "master";
|
||||
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
|
|
|
@ -43,8 +43,12 @@
|
|||
"name": "Jordi Mallach",
|
||||
"email": "jordi@softcatala.org"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
},
|
||||
{
|
||||
|
@ -56,8 +60,12 @@
|
|||
"name": "GitLab dev user",
|
||||
"email": "gitlabdev@dv6700.(none)"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
}
|
||||
],
|
||||
|
|
|
@ -43,8 +43,12 @@
|
|||
"name": "Jordi Mallach",
|
||||
"email": "jordi@softcatala.org"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
},
|
||||
{
|
||||
|
@ -56,8 +60,12 @@
|
|||
"name": "GitLab dev user",
|
||||
"email": "gitlabdev@dv6700.(none)"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
}
|
||||
],
|
||||
|
|
|
@ -42,8 +42,12 @@
|
|||
"name": "Jordi Mallach",
|
||||
"email": "jordi@softcatala.org"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
},
|
||||
{
|
||||
|
@ -55,8 +59,12 @@
|
|||
"name": "GitLab dev user",
|
||||
"email": "gitlabdev@dv6700.(none)"
|
||||
},
|
||||
"added": ["CHANGELOG"],
|
||||
"modified": ["app/controller/application.rb"],
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
"app/controller/application.rb"
|
||||
],
|
||||
"removed": []
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue