diff --git a/README.md b/README.md index 983d06b..d7f86c9 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Version 1.2.0 of the plugin introduced improved logging for debugging purposes. 1. Go to Jenkins -> Manage Jenkins -> System Log 2. Add new log recorder 3. Enter 'Gitlab plugin' or whatever you want for the name -4. On the next page, enter 'com.dabsquared.gitlabjenkins' for Logger, set log level to FINEST, and save +4. On the next page, enter 'com.dabsquared.giteejenkins' for Logger, set log level to FINEST, and save 5. Then click on your Gitlab plugin log, click 'Clear this log' if necessary, and then use GitLab to trigger some actions 6. Refresh the log page and you should see output diff --git a/pom.xml b/pom.xml index a416fa5..efeefad 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,10 @@ false - gitlab-plugin + gitee-plugin 1.5.7-SNAPSHOT - GitLab Plugin - https://wiki.jenkins-ci.org/display/JENKINS/GitLab+Plugin + Gitee Plugin + hpi @@ -48,9 +48,9 @@ - scm:git:ssh://github.com:jenkinsci/gitlab-plugin.git - scm:git:git@github.com:jenkinsci/gitlab-plugin.git - https://github.com/jenkinsci/gitlab-plugin + scm:git:ssh://gitee.com:yashin/Gitee-Plugin.git + scm:git:git@gitee.com:yashin/Gitee-Plugin.git + https://gitee.com/yashin/Gitee-Plugin HEAD @@ -307,7 +307,7 @@ integration-test - 8.17.4 + 8.17.4 9.5-1 @@ -332,8 +332,8 @@ - gitlab.http.port - ${gitlab.http.port} + gitee.http.port + ${gitee.http.port} postgres.port @@ -357,10 +357,10 @@ - gitlab.http.port + gitee.http.port - gitlab.ssh.port + gitee.ssh.port postgres.port @@ -380,12 +380,12 @@ sameersbn/postgresql:${postgres.version} - it-gitlab-postgres + it-gitee-postgres alias - gitlabhq_production - gitlab + giteehq_production + gitee password pg_trgm @@ -396,38 +396,38 @@ sameersbn/redis - it-gitlab-redis + it-gitee-redis alias - sameersbn/gitlab:${gitlab.version} - it-gitlab-gitlab + sameersbn/gitee:${gitee.version} + it-gitee-gitee alias - it-gitlab-postgres:postgresql - it-gitlab-redis:redisio + it-gitee-postgres:postgresql + it-gitee-redis:redisio - ${gitlab.http.port}:80 - ${gitlab.ssh.port}:22 + ${gitee.http.port}:80 + ${gitee.ssh.port}:22 false Asia/Kolkata - Kolkata - ${gitlab.http.port} - ${gitlab.ssh.port} - long-and-random-alpha-numeric-string - long-and-random-alphanumeric-string - long-and-random-alpha-numeric-string - 172.17.0.1 + Kolkata + ${gitee.http.port} + ${gitee.ssh.port} + long-and-random-alpha-numeric-string + long-and-random-alphanumeric-string + long-and-random-alpha-numeric-string + 172.17.0.1 - http://localhost:${gitlab.http.port}/ + http://localhost:${gitee.http.port}/ diff --git a/src/docker/docker-compose.yml b/src/docker/docker-compose.yml index 64f6e5d..0bf0ebb 100644 --- a/src/docker/docker-compose.yml +++ b/src/docker/docker-compose.yml @@ -7,16 +7,16 @@ services: ports: - "5432:5432" environment: - - DB_USER=gitlab + - DB_USER=gitee - DB_PASS=password - DB_NAME=gitlabhq_production - DB_EXTENSION=pg_trgm volumes: - - /srv/docker/gitlab/postgresql:/var/lib/postgresql + - /srv/docker/gitee/postgresql:/var/lib/postgresql gitlab: restart: always - image: sameersbn/gitlab:9.4.1 + image: sameersbn/gitee:9.4.1 depends_on: - redis - postgresql @@ -29,7 +29,7 @@ services: - DB_ADAPTER=postgresql - DB_HOST=postgresql - DB_PORT=5432 - - DB_USER=gitlab + - DB_USER=gitee - DB_PASS=password - DB_NAME=gitlabhq_production @@ -80,13 +80,13 @@ services: - IMAP_SSL=true - IMAP_STARTTLS=false volumes: - - /srv/docker/gitlab/gitlab:/home/git/data + - /srv/docker/gitee/gitee:/home/git/data redis: restart: always image: sameersbn/redis:latest volumes: - - /srv/docker/gitlab/redis:/var/lib/redis + - /srv/docker/gitee/redis:/var/lib/redis jenkins: restart: always diff --git a/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java b/src/main/java/com/dabsquared/giteejenkins/GiteePushTrigger.java similarity index 80% rename from src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java rename to src/main/java/com/dabsquared/giteejenkins/GiteePushTrigger.java index 1075b41..529bd31 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java +++ b/src/main/java/com/dabsquared/giteejenkins/GiteePushTrigger.java @@ -1,31 +1,31 @@ -package com.dabsquared.gitlabjenkins; +package com.dabsquared.giteejenkins; -import com.dabsquared.gitlabjenkins.connection.GitLabConnection; -import com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig; -import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.MergeRequestHook; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.NoteHook; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.PipelineHook; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.PushHook; -import com.dabsquared.gitlabjenkins.publisher.GitLabAcceptMergeRequestPublisher; -import com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher; -import com.dabsquared.gitlabjenkins.publisher.GitLabMessagePublisher; -import com.dabsquared.gitlabjenkins.publisher.GitLabVotePublisher; -import com.dabsquared.gitlabjenkins.trigger.TriggerOpenMergeRequest; -import com.dabsquared.gitlabjenkins.trigger.branch.ProjectBranchesProvider; -import com.dabsquared.gitlabjenkins.trigger.filter.BranchFilter; -import com.dabsquared.gitlabjenkins.trigger.filter.BranchFilterFactory; -import com.dabsquared.gitlabjenkins.trigger.filter.BranchFilterType; -import com.dabsquared.gitlabjenkins.trigger.filter.MergeRequestLabelFilter; -import com.dabsquared.gitlabjenkins.trigger.filter.MergeRequestLabelFilterConfig; -import com.dabsquared.gitlabjenkins.trigger.filter.MergeRequestLabelFilterFactory; -import com.dabsquared.gitlabjenkins.trigger.handler.merge.MergeRequestHookTriggerHandler; -import com.dabsquared.gitlabjenkins.trigger.handler.note.NoteHookTriggerHandler; -import com.dabsquared.gitlabjenkins.trigger.handler.pipeline.PipelineHookTriggerHandler; -import com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandler; -import com.dabsquared.gitlabjenkins.trigger.label.ProjectLabelsProvider; -import com.dabsquared.gitlabjenkins.webhook.GitLabWebHook; +import com.dabsquared.giteejenkins.connection.GiteeConnection; +import com.dabsquared.giteejenkins.connection.GiteeConnectionConfig; +import com.dabsquared.giteejenkins.connection.GiteeConnectionProperty; +import com.dabsquared.giteejenkins.gitee.hook.model.MergeRequestHook; +import com.dabsquared.giteejenkins.gitee.hook.model.NoteHook; +import com.dabsquared.giteejenkins.gitee.hook.model.PipelineHook; +import com.dabsquared.giteejenkins.gitee.hook.model.PushHook; +import com.dabsquared.giteejenkins.publisher.GiteeAcceptMergeRequestPublisher; +import com.dabsquared.giteejenkins.publisher.GiteeCommitStatusPublisher; +import com.dabsquared.giteejenkins.publisher.GiteeMessagePublisher; +import com.dabsquared.giteejenkins.publisher.GiteeVotePublisher; +import com.dabsquared.giteejenkins.trigger.TriggerOpenMergeRequest; +import com.dabsquared.giteejenkins.trigger.branch.ProjectBranchesProvider; +import com.dabsquared.giteejenkins.trigger.filter.BranchFilter; +import com.dabsquared.giteejenkins.trigger.filter.BranchFilterFactory; +import com.dabsquared.giteejenkins.trigger.filter.BranchFilterType; +import com.dabsquared.giteejenkins.trigger.filter.MergeRequestLabelFilter; +import com.dabsquared.giteejenkins.trigger.filter.MergeRequestLabelFilterConfig; +import com.dabsquared.giteejenkins.trigger.filter.MergeRequestLabelFilterFactory; +import com.dabsquared.giteejenkins.trigger.handler.merge.MergeRequestHookTriggerHandler; +import com.dabsquared.giteejenkins.trigger.handler.note.NoteHookTriggerHandler; +import com.dabsquared.giteejenkins.trigger.handler.pipeline.PipelineHookTriggerHandler; +import com.dabsquared.giteejenkins.trigger.handler.push.PushHookTriggerHandler; +import com.dabsquared.giteejenkins.trigger.label.ProjectLabelsProvider; +import com.dabsquared.giteejenkins.webhook.GiteeWebHook; import hudson.Extension; import hudson.Util; import hudson.init.InitMilestone; @@ -61,19 +61,19 @@ import java.io.IOException; import java.io.ObjectStreamException; import java.security.SecureRandom; -import static com.dabsquared.gitlabjenkins.trigger.filter.BranchFilterConfig.BranchFilterConfigBuilder.branchFilterConfig; -import static com.dabsquared.gitlabjenkins.trigger.handler.merge.MergeRequestHookTriggerHandlerFactory.newMergeRequestHookTriggerHandler; -import static com.dabsquared.gitlabjenkins.trigger.handler.note.NoteHookTriggerHandlerFactory.newNoteHookTriggerHandler; -import static com.dabsquared.gitlabjenkins.trigger.handler.pipeline.PipelineHookTriggerHandlerFactory.newPipelineHookTriggerHandler; -import static com.dabsquared.gitlabjenkins.trigger.handler.push.PushHookTriggerHandlerFactory.newPushHookTriggerHandler; +import static com.dabsquared.giteejenkins.trigger.filter.BranchFilterConfig.BranchFilterConfigBuilder.branchFilterConfig; +import static com.dabsquared.giteejenkins.trigger.handler.merge.MergeRequestHookTriggerHandlerFactory.newMergeRequestHookTriggerHandler; +import static com.dabsquared.giteejenkins.trigger.handler.note.NoteHookTriggerHandlerFactory.newNoteHookTriggerHandler; +import static com.dabsquared.giteejenkins.trigger.handler.pipeline.PipelineHookTriggerHandlerFactory.newPipelineHookTriggerHandler; +import static com.dabsquared.giteejenkins.trigger.handler.push.PushHookTriggerHandlerFactory.newPushHookTriggerHandler; /** - * Triggers a build when we receive a GitLab WebHook. + * Triggers a build when we receive a Gitee WebHook. * * @author Daniel Brooks */ -public class GitLabPushTrigger extends Trigger> { +public class GiteePushTrigger extends Trigger> { private static final SecureRandom RANDOM = new SecureRandom(); @@ -112,18 +112,18 @@ public class GitLabPushTrigger extends Trigger> { private transient MergeRequestLabelFilter mergeRequestLabelFilter; /** - * @deprecated use {@link #GitLabPushTrigger()} with setters to configure an instance of this class. + * @deprecated use {@link #GiteePushTrigger()} with setters to configure an instance of this class. */ @Deprecated @GeneratePojoBuilder(intoPackage = "*.builder.generated", withFactoryMethod = "*") - public GitLabPushTrigger(boolean triggerOnPush, boolean triggerOnMergeRequest, boolean triggerOnAcceptedMergeRequest, boolean triggerOnClosedMergeRequest, - TriggerOpenMergeRequest triggerOpenMergeRequestOnPush, boolean triggerOnNoteRequest, String noteRegex, - boolean skipWorkInProgressMergeRequest, boolean ciSkip, - boolean setBuildDescription, boolean addNoteOnMergeRequest, boolean addCiMessage, boolean addVoteOnMergeRequest, - boolean acceptMergeRequestOnSuccess, BranchFilterType branchFilterType, - String includeBranchesSpec, String excludeBranchesSpec, String targetBranchRegex, - MergeRequestLabelFilterConfig mergeRequestLabelFilterConfig, String secretToken, boolean triggerOnPipelineEvent, - boolean triggerOnApprovedMergeRequest, String pendingBuildName, boolean cancelPendingBuildsOnUpdate) { + public GiteePushTrigger(boolean triggerOnPush, boolean triggerOnMergeRequest, boolean triggerOnAcceptedMergeRequest, boolean triggerOnClosedMergeRequest, + TriggerOpenMergeRequest triggerOpenMergeRequestOnPush, boolean triggerOnNoteRequest, String noteRegex, + boolean skipWorkInProgressMergeRequest, boolean ciSkip, + boolean setBuildDescription, boolean addNoteOnMergeRequest, boolean addCiMessage, boolean addVoteOnMergeRequest, + boolean acceptMergeRequestOnSuccess, BranchFilterType branchFilterType, + String includeBranchesSpec, String excludeBranchesSpec, String targetBranchRegex, + MergeRequestLabelFilterConfig mergeRequestLabelFilterConfig, String secretToken, boolean triggerOnPipelineEvent, + boolean triggerOnApprovedMergeRequest, String pendingBuildName, boolean cancelPendingBuildsOnUpdate) { this.triggerOnPush = triggerOnPush; this.triggerOnMergeRequest = triggerOnMergeRequest; this.triggerOnAcceptedMergeRequest = triggerOnAcceptedMergeRequest; @@ -155,14 +155,14 @@ public class GitLabPushTrigger extends Trigger> { } @DataBoundConstructor - public GitLabPushTrigger() { } + public GiteePushTrigger() { } @Initializer(after = InitMilestone.JOB_LOADED) public static void migrateJobs() throws IOException { - GitLabPushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GitLabPushTrigger.DescriptorImpl.class); + GiteePushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GiteePushTrigger.DescriptorImpl.class); if (!oldConfig.jobsMigrated) { - GitLabConnectionConfig gitLabConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class); - gitLabConfig.getConnections().add(new GitLabConnection( + GiteeConnectionConfig giteeConfig = (GiteeConnectionConfig) Jenkins.getInstance().getDescriptor(GiteeConnectionConfig.class); + giteeConfig.getConnections().add(new GiteeConnection( oldConfig.gitlabHostUrl, oldConfig.gitlabHostUrl, oldConfig.gitlabApiToken, @@ -171,33 +171,33 @@ public class GitLabPushTrigger extends Trigger> { 10, 10)); - String defaultConnectionName = gitLabConfig.getConnections().get(0).getName(); + String defaultConnectionName = giteeConfig.getConnections().get(0).getName(); for (AbstractProject project : Jenkins.getInstance().getAllItems(AbstractProject.class)) { - GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class); + GiteePushTrigger trigger = project.getTrigger(GiteePushTrigger.class); if (trigger != null) { if (trigger.addCiMessage) { - project.getPublishersList().add(new GitLabCommitStatusPublisher("jenkins", false)); + project.getPublishersList().add(new GiteeCommitStatusPublisher("jenkins", false)); } - project.addProperty(new GitLabConnectionProperty(defaultConnectionName)); + project.addProperty(new GiteeConnectionProperty(defaultConnectionName)); project.save(); } } - gitLabConfig.save(); + giteeConfig.save(); oldConfig.jobsMigrated = true; oldConfig.save(); } if (!oldConfig.jobsMigrated2) { for (AbstractProject project : Jenkins.getInstance().getAllItems(AbstractProject.class)) { - GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class); + GiteePushTrigger trigger = project.getTrigger(GiteePushTrigger.class); if (trigger != null) { if (trigger.addNoteOnMergeRequest) { - project.getPublishersList().add(new GitLabMessagePublisher()); + project.getPublishersList().add(new GiteeMessagePublisher()); } if (trigger.addVoteOnMergeRequest) { - project.getPublishersList().add(new GitLabVotePublisher()); + project.getPublishersList().add(new GiteeVotePublisher()); } if (trigger.acceptMergeRequestOnSuccess) { - project.getPublishersList().add(new GitLabAcceptMergeRequestPublisher()); + project.getPublishersList().add(new GiteeAcceptMergeRequestPublisher()); } project.save(); } @@ -492,13 +492,13 @@ public class GitLabPushTrigger extends Trigger> { return super.readResolve(); } - public static GitLabPushTrigger getFromJob(Job job) { - GitLabPushTrigger trigger = null; + public static GiteePushTrigger getFromJob(Job job) { + GiteePushTrigger trigger = null; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob p = (ParameterizedJobMixIn.ParameterizedJob) job; for (Trigger t : p.getTriggers().values()) { - if (t instanceof GitLabPushTrigger) { - trigger = (GitLabPushTrigger) t; + if (t instanceof GiteePushTrigger) { + trigger = (GiteePushTrigger) t; } } } @@ -506,7 +506,7 @@ public class GitLabPushTrigger extends Trigger> { } @Extension - @Symbol("gitlab") + @Symbol("gitee") public static class DescriptorImpl extends TriggerDescriptor { private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting); @@ -543,7 +543,7 @@ public class GitLabPushTrigger extends Trigger> { private StringBuilder retrieveProjectUrl(Job project) { return new StringBuilder() .append(Jenkins.getInstance().getRootUrl()) - .append(GitLabWebHook.WEBHOOK_URL) + .append(GiteeWebHook.WEBHOOK_URL) .append(retrieveParentUrl(project)) .append('/').append(Util.rawEncode(project.getName())); } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java b/src/main/java/com/dabsquared/giteejenkins/cause/CauseData.java similarity index 99% rename from src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java rename to src/main/java/com/dabsquared/giteejenkins/cause/CauseData.java index b49c843..3e6655d 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java +++ b/src/main/java/com/dabsquared/giteejenkins/cause/CauseData.java @@ -1,6 +1,6 @@ -package com.dabsquared.gitlabjenkins.cause; +package com.dabsquared.giteejenkins.cause; -import com.dabsquared.gitlabjenkins.gitlab.api.model.MergeRequest; +import com.dabsquared.giteejenkins.gitee.api.model.MergeRequest; import hudson.markup.EscapedMarkupFormatter; import jenkins.model.Jenkins; import net.karneim.pojobuilder.GeneratePojoBuilder; diff --git a/src/main/java/com/dabsquared/gitlabjenkins/cause/GiteeWebHookCause.java b/src/main/java/com/dabsquared/giteejenkins/cause/GiteeWebHookCause.java similarity index 92% rename from src/main/java/com/dabsquared/gitlabjenkins/cause/GiteeWebHookCause.java rename to src/main/java/com/dabsquared/giteejenkins/cause/GiteeWebHookCause.java index d228bb1..eb11adc 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/cause/GiteeWebHookCause.java +++ b/src/main/java/com/dabsquared/giteejenkins/cause/GiteeWebHookCause.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.cause; +package com.dabsquared.giteejenkins.cause; import hudson.triggers.SCMTrigger; diff --git a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiToken.java b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiToken.java similarity index 64% rename from src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiToken.java rename to src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiToken.java index cdcb00a..b784052 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiToken.java +++ b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiToken.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.connection; +package com.dabsquared.giteejenkins.connection; import com.cloudbees.plugins.credentials.CredentialsNameProvider; import com.cloudbees.plugins.credentials.NameWith; @@ -9,14 +9,14 @@ import hudson.util.Secret; /** * @author Robin Müller */ -@NameWith(GitLabApiToken.NameProvider.class) -public interface GitLabApiToken extends StandardCredentials { +@NameWith(GiteeApiToken.NameProvider.class) +public interface GiteeApiToken extends StandardCredentials { Secret getApiToken(); - class NameProvider extends CredentialsNameProvider { + class NameProvider extends CredentialsNameProvider { @Override - public String getName(GitLabApiToken c) { + public String getName(GiteeApiToken c) { String description = Util.fixEmptyAndTrim(c.getDescription()); return Messages.GitLabApiToken_name() + (description != null ? " (" + description + ")" : ""); } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiTokenImpl.java b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiTokenImpl.java similarity index 73% rename from src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiTokenImpl.java rename to src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiTokenImpl.java index 7987968..a12eec5 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabApiTokenImpl.java +++ b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeApiTokenImpl.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.connection; +package com.dabsquared.giteejenkins.connection; import com.cloudbees.plugins.credentials.CredentialsScope; import com.cloudbees.plugins.credentials.impl.BaseStandardCredentials; @@ -9,12 +9,12 @@ import org.kohsuke.stapler.DataBoundConstructor; /** * @author Robin Müller */ -public final class GitLabApiTokenImpl extends BaseStandardCredentials implements GitLabApiToken { +public final class GiteeApiTokenImpl extends BaseStandardCredentials implements GiteeApiToken { private Secret apiToken; @DataBoundConstructor - public GitLabApiTokenImpl(CredentialsScope scope, String id, String description, Secret apiToken) { + public GiteeApiTokenImpl(CredentialsScope scope, String id, String description, Secret apiToken) { super(scope, id, description); this.apiToken = apiToken; } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnection.java b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnection.java similarity index 69% rename from src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnection.java rename to src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnection.java index 4ca7555..41e2d0f 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnection.java +++ b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnection.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.connection; +package com.dabsquared.giteejenkins.connection; import com.cloudbees.plugins.credentials.CredentialsMatchers; @@ -9,9 +9,9 @@ import com.cloudbees.plugins.credentials.SystemCredentialsProvider; import com.cloudbees.plugins.credentials.common.StandardCredentials; import com.cloudbees.plugins.credentials.domains.Domain; import com.cloudbees.plugins.credentials.domains.DomainRequirement; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder; -import com.dabsquared.gitlabjenkins.gitlab.api.impl.AutodetectGitLabClientBuilder; +import com.dabsquared.giteejenkins.gitee.api.GiteeClient; +import com.dabsquared.giteejenkins.gitee.api.GiteeClientBuilder; +import com.dabsquared.giteejenkins.gitee.api.impl.AutodetectGiteeClientBuilder; import hudson.init.InitMilestone; import hudson.init.Initializer; import hudson.model.Item; @@ -29,30 +29,30 @@ import java.util.List; import java.util.UUID; import static com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials; -import static com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder.getGitLabClientBuilderById; +import static com.dabsquared.giteejenkins.gitee.api.GiteeClientBuilder.getGitLabClientBuilderById; /** * @author Robin Müller */ -public class GitLabConnection { +public class GiteeConnection { private final String name; private final String url; private transient String apiToken; // TODO make final when migration code gets removed private String apiTokenId; - private GitLabClientBuilder clientBuilder; + private GiteeClientBuilder clientBuilder; private final boolean ignoreCertificateErrors; private final Integer connectionTimeout; private final Integer readTimeout; - private transient GitLabClient apiCache; + private transient GiteeClient apiCache; - public GitLabConnection(String name, String url, String apiTokenId, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { + public GiteeConnection(String name, String url, String apiTokenId, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { this( name, url, apiTokenId, - new AutodetectGitLabClientBuilder(), + new AutodetectGiteeClientBuilder(), ignoreCertificateErrors, connectionTimeout, readTimeout @@ -60,7 +60,7 @@ public class GitLabConnection { } @DataBoundConstructor - public GitLabConnection(String name, String url, String apiTokenId, String clientBuilderId, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { + public GiteeConnection(String name, String url, String apiTokenId, String clientBuilderId, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { this( name, url, @@ -73,7 +73,7 @@ public class GitLabConnection { } @Restricted(NoExternalUse.class) - public GitLabConnection(String name, String url, String apiTokenId, GitLabClientBuilder clientBuilder, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { + public GiteeConnection(String name, String url, String apiTokenId, GiteeClientBuilder clientBuilder, boolean ignoreCertificateErrors, Integer connectionTimeout, Integer readTimeout) { this.name = name; this.url = url; this.apiTokenId = apiTokenId; @@ -111,7 +111,7 @@ public class GitLabConnection { return readTimeout; } - public GitLabClient getClient() { + public GiteeClient getClient() { if (apiCache == null) { apiCache = clientBuilder.buildClient(url, getApiToken(apiTokenId), ignoreCertificateErrors, connectionTimeout, readTimeout); } @@ -124,8 +124,8 @@ public class GitLabConnection { lookupCredentials(StandardCredentials.class, (Item) null, ACL.SYSTEM, new ArrayList()), CredentialsMatchers.withId(apiTokenId)); if (credentials != null) { - if (credentials instanceof GitLabApiToken) { - return ((GitLabApiToken) credentials).getApiToken().getPlainText(); + if (credentials instanceof GiteeApiToken) { + return ((GiteeApiToken) credentials).getApiToken().getPlainText(); } if (credentials instanceof StringCredentials) { return ((StringCredentials) credentials).getSecret().getPlainText(); @@ -135,12 +135,12 @@ public class GitLabConnection { } - protected GitLabConnection readResolve() { + protected GiteeConnection readResolve() { if (connectionTimeout == null || readTimeout == null) { - return new GitLabConnection(name, url, apiTokenId, new AutodetectGitLabClientBuilder(), ignoreCertificateErrors, 10, 10); + return new GiteeConnection(name, url, apiTokenId, new AutodetectGiteeClientBuilder(), ignoreCertificateErrors, 10, 10); } if (clientBuilder == null) { - return new GitLabConnection(name, url, apiTokenId, new AutodetectGitLabClientBuilder(), ignoreCertificateErrors, connectionTimeout, readTimeout); + return new GiteeConnection(name, url, apiTokenId, new AutodetectGiteeClientBuilder(), ignoreCertificateErrors, connectionTimeout, readTimeout); } return this; @@ -148,15 +148,15 @@ public class GitLabConnection { @Initializer(after = InitMilestone.PLUGINS_STARTED) public static void migrate() throws IOException { - GitLabConnectionConfig descriptor = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class); - for (GitLabConnection connection : descriptor.getConnections()) { + GiteeConnectionConfig descriptor = (GiteeConnectionConfig) Jenkins.getInstance().getDescriptor(GiteeConnectionConfig.class); + for (GiteeConnection connection : descriptor.getConnections()) { if (connection.apiTokenId == null && connection.apiToken != null) { for (CredentialsStore credentialsStore : CredentialsProvider.lookupStores(Jenkins.getInstance())) { if (credentialsStore instanceof SystemCredentialsProvider.StoreImpl) { List domains = credentialsStore.getDomains(); connection.apiTokenId = UUID.randomUUID().toString(); credentialsStore.addCredentials(domains.get(0), - new GitLabApiTokenImpl(CredentialsScope.SYSTEM, connection.apiTokenId, "GitLab API Token", Secret.fromString(connection.apiToken))); + new GiteeApiTokenImpl(CredentialsScope.SYSTEM, connection.apiTokenId, "GitLab API Token", Secret.fromString(connection.apiToken))); } } } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionConfig.java b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionConfig.java similarity index 80% rename from src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionConfig.java rename to src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionConfig.java index e1efd6d..b1aa876 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionConfig.java +++ b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionConfig.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.connection; +package com.dabsquared.giteejenkins.connection; import com.cloudbees.plugins.credentials.Credentials; @@ -7,8 +7,8 @@ import com.cloudbees.plugins.credentials.common.AbstractIdCredentialsListBoxMode import com.cloudbees.plugins.credentials.common.StandardCredentials; import com.cloudbees.plugins.credentials.common.StandardListBoxModel; import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder; +import com.dabsquared.giteejenkins.gitee.api.GiteeClient; +import com.dabsquared.giteejenkins.gitee.api.GiteeClientBuilder; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.Extension; import hudson.model.Item; @@ -30,27 +30,27 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder.getAllGitLabClientBuilders; +import static com.dabsquared.giteejenkins.gitee.api.GiteeClientBuilder.getAllGitLabClientBuilders; /** * @author Robin Müller */ @Extension -public class GitLabConnectionConfig extends GlobalConfiguration { +public class GiteeConnectionConfig extends GlobalConfiguration { private Boolean useAuthenticatedEndpoint = true; - private List connections = new ArrayList<>(); - private transient Map connectionMap = new HashMap<>(); + private List connections = new ArrayList<>(); + private transient Map connectionMap = new HashMap<>(); - public GitLabConnectionConfig() { + public GiteeConnectionConfig() { load(); refreshConnectionMap(); } @Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { - connections = req.bindJSONToList(GitLabConnection.class, json.get("connections")); + connections = req.bindJSONToList(GiteeConnection.class, json.get("connections")); useAuthenticatedEndpoint = json.getBoolean("useAuthenticatedEndpoint"); refreshConnectionMap(); save(); @@ -65,24 +65,24 @@ public class GitLabConnectionConfig extends GlobalConfiguration { this.useAuthenticatedEndpoint = useAuthenticatedEndpoint; } - public List getConnections() { + public List getConnections() { return connections; } - public void addConnection(GitLabConnection connection) { + public void addConnection(GiteeConnection connection) { connections.add(connection); connectionMap.put(connection.getName(), connection); } - public void setConnections(List newConnections) { + public void setConnections(List newConnections) { connections = new ArrayList<>(); connectionMap = new HashMap<>(); - for (GitLabConnection connection: newConnections){ + for (GiteeConnection connection: newConnections){ addConnection(connection); } } - public GitLabClient getClient(String connectionName) { + public GiteeClient getClient(String connectionName) { if (!connectionMap.containsKey(connectionName)) { return null; } @@ -138,7 +138,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration { @QueryParameter int connectionTimeout, @QueryParameter int readTimeout) { try { - new GitLabConnection("", url, apiTokenId, clientBuilderId, ignoreCertificateErrors, connectionTimeout, readTimeout).getClient().getCurrentUser(); + new GiteeConnection("", url, apiTokenId, clientBuilderId, ignoreCertificateErrors, connectionTimeout, readTimeout).getClient().getCurrentUser(); return FormValidation.ok(Messages.connection_success()); } catch (WebApplicationException e) { return FormValidation.error(Messages.connection_error(e.getMessage())); @@ -155,7 +155,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration { Jenkins.getActiveInstance(), StandardCredentials.class, URIRequirementBuilder.fromUri(url).build(), - new GitLabCredentialMatcher()); + new GiteeCredentialMatcher()); if (name != null && connectionMap.containsKey(name)) { String apiTokenId = connectionMap.get(name).getApiTokenId(); options.includeCurrentValue(apiTokenId); @@ -172,7 +172,7 @@ public class GitLabConnectionConfig extends GlobalConfiguration { public ListBoxModel doFillClientBuilderIdItems() { ListBoxModel model = new ListBoxModel(); - for (GitLabClientBuilder builder : getAllGitLabClientBuilders()) { + for (GiteeClientBuilder builder : getAllGitLabClientBuilders()) { model.add(builder.id()); } @@ -181,23 +181,23 @@ public class GitLabConnectionConfig extends GlobalConfiguration { private void refreshConnectionMap() { connectionMap.clear(); - for (GitLabConnection connection : connections) { + for (GiteeConnection connection : connections) { connectionMap.put(connection.getName(), connection); } } - private static class GitLabCredentialMatcher implements CredentialsMatcher { + private static class GiteeCredentialMatcher implements CredentialsMatcher { @Override public boolean matches(@NonNull Credentials credentials) { try { - return credentials instanceof GitLabApiToken || credentials instanceof StringCredentials; + return credentials instanceof GiteeApiToken || credentials instanceof StringCredentials; } catch (Throwable e) { return false; } } } //For backwards compatibility. ReadResolve is called on startup - protected GitLabConnectionConfig readResolve() { + protected GiteeConnectionConfig readResolve() { if (useAuthenticatedEndpoint == null) { setUseAuthenticatedEndpoint(false); } diff --git a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionProperty.java b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionProperty.java similarity index 65% rename from src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionProperty.java rename to src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionProperty.java index f24993e..7bd24bd 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionProperty.java +++ b/src/main/java/com/dabsquared/giteejenkins/connection/GiteeConnectionProperty.java @@ -1,7 +1,7 @@ -package com.dabsquared.gitlabjenkins.connection; +package com.dabsquared.giteejenkins.connection; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient; +import com.dabsquared.giteejenkins.gitee.api.GiteeClient; import hudson.Extension; import hudson.model.Job; import hudson.model.JobProperty; @@ -18,12 +18,12 @@ import org.kohsuke.stapler.StaplerRequest; /** * @author Robin Müller */ -public class GitLabConnectionProperty extends JobProperty> { +public class GiteeConnectionProperty extends JobProperty> { private String gitLabConnection; @DataBoundConstructor - public GitLabConnectionProperty(String gitLabConnection) { + public GiteeConnectionProperty(String gitLabConnection) { this.gitLabConnection = gitLabConnection; } @@ -31,16 +31,16 @@ public class GitLabConnectionProperty extends JobProperty> { return gitLabConnection; } - public GitLabClient getClient() { + public GiteeClient getClient() { if (StringUtils.isNotEmpty(gitLabConnection)) { - GitLabConnectionConfig connectionConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class); + GiteeConnectionConfig connectionConfig = (GiteeConnectionConfig) Jenkins.getInstance().getDescriptor(GiteeConnectionConfig.class); return connectionConfig != null ? connectionConfig.getClient(gitLabConnection) : null; } return null; } - public static GitLabClient getClient(Run build) { - final GitLabConnectionProperty connectionProperty = build.getParent().getProperty(GitLabConnectionProperty.class); + public static GiteeClient getClient(Run build) { + final GiteeConnectionProperty connectionProperty = build.getParent().getProperty(GiteeConnectionProperty.class); if (connectionProperty != null) { return connectionProperty.getClient(); } @@ -63,13 +63,13 @@ public class GitLabConnectionProperty extends JobProperty> { @Override public JobProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException { - return req.bindJSON(GitLabConnectionProperty.class, formData); + return req.bindJSON(GiteeConnectionProperty.class, formData); } public ListBoxModel doFillGitLabConnectionItems() { ListBoxModel options = new ListBoxModel(); - GitLabConnectionConfig descriptor = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class); - for (GitLabConnection connection : descriptor.getConnections()) { + GiteeConnectionConfig descriptor = (GiteeConnectionConfig) Jenkins.getInstance().getDescriptor(GiteeConnectionConfig.class); + for (GiteeConnection connection : descriptor.getConnections()) { options.add(connection.getName(), connection.getName()); } return options; diff --git a/src/main/java/com/dabsquared/gitlabjenkins/environment/GitLabEnvironmentContributor.java b/src/main/java/com/dabsquared/giteejenkins/environment/GiteeEnvironmentContributor.java similarity index 84% rename from src/main/java/com/dabsquared/gitlabjenkins/environment/GitLabEnvironmentContributor.java rename to src/main/java/com/dabsquared/giteejenkins/environment/GiteeEnvironmentContributor.java index bba34c5..8cec7fa 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/environment/GitLabEnvironmentContributor.java +++ b/src/main/java/com/dabsquared/giteejenkins/environment/GiteeEnvironmentContributor.java @@ -1,6 +1,6 @@ -package com.dabsquared.gitlabjenkins.environment; +package com.dabsquared.giteejenkins.environment; -import com.dabsquared.gitlabjenkins.cause.GiteeWebHookCause; +import com.dabsquared.giteejenkins.cause.GiteeWebHookCause; import hudson.EnvVars; import hudson.Extension; import hudson.matrix.MatrixRun; @@ -16,7 +16,7 @@ import java.io.IOException; * @author Robin Müller */ @Extension -public class GitLabEnvironmentContributor extends EnvironmentContributor { +public class GiteeEnvironmentContributor extends EnvironmentContributor { @Override public void buildEnvironmentFor(@Nonnull Run r, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException { GiteeWebHookCause cause = null; diff --git a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/JacksonConfig.java b/src/main/java/com/dabsquared/giteejenkins/gitee/JacksonConfig.java similarity index 95% rename from src/main/java/com/dabsquared/gitlabjenkins/gitlab/JacksonConfig.java rename to src/main/java/com/dabsquared/giteejenkins/gitee/JacksonConfig.java index 2bf37e6..6f26020 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/JacksonConfig.java +++ b/src/main/java/com/dabsquared/giteejenkins/gitee/JacksonConfig.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.gitlab; +package com.dabsquared.giteejenkins.gitee; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClient.java b/src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClient.java similarity index 88% rename from src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClient.java rename to src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClient.java index b65a160..0bb05de 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClient.java +++ b/src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClient.java @@ -1,11 +1,11 @@ -package com.dabsquared.gitlabjenkins.gitlab.api; +package com.dabsquared.giteejenkins.gitee.api; -import com.dabsquared.gitlabjenkins.gitlab.api.model.*; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.State; +import com.dabsquared.giteejenkins.gitee.api.model.*; +import com.dabsquared.giteejenkins.gitee.hook.model.State; import java.util.List; -public interface GitLabClient { +public interface GiteeClient { String getHostUrl(); Project createProject(String projectName); diff --git a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClientBuilder.java b/src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClientBuilder.java similarity index 54% rename from src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClientBuilder.java rename to src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClientBuilder.java index 8bba0e5..47885e5 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClientBuilder.java +++ b/src/main/java/com/dabsquared/giteejenkins/gitee/api/GiteeClientBuilder.java @@ -1,4 +1,4 @@ -package com.dabsquared.gitlabjenkins.gitlab.api; +package com.dabsquared.giteejenkins.gitee.api; import hudson.ExtensionPoint; @@ -15,9 +15,9 @@ import java.util.NoSuchElementException; import static java.util.Collections.sort; @Restricted(NoExternalUse.class) -public abstract class GitLabClientBuilder implements Comparable, ExtensionPoint, Serializable { - public static GitLabClientBuilder getGitLabClientBuilderById(String id) { - for (GitLabClientBuilder provider : getAllGitLabClientBuilders()) { +public abstract class GiteeClientBuilder implements Comparable, ExtensionPoint, Serializable { + public static GiteeClientBuilder getGitLabClientBuilderById(String id) { + for (GiteeClientBuilder provider : getAllGitLabClientBuilders()) { if (provider.id().equals(id)) { return provider; } @@ -26,8 +26,8 @@ public abstract class GitLabClientBuilder implements Comparable getAllGitLabClientBuilders() { - List builders = new ArrayList<>(Jenkins.getInstance().getExtensionList(GitLabClientBuilder.class)); + public static List getAllGitLabClientBuilders() { + List builders = new ArrayList<>(Jenkins.getInstance().getExtensionList(GiteeClientBuilder.class)); sort(builders); return builders; } @@ -35,7 +35,7 @@ public abstract class GitLabClientBuilder implements Comparable candidates = new ArrayList<>(getAllGitLabClientBuilders()); + candidates.remove(this); + return new AutodetectingGiteeClient(candidates, url, token, ignoreCertificateErrors, connectionTimeout, readTimeout); + } +} diff --git a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/impl/AutodetectingGitLabClient.java b/src/main/java/com/dabsquared/giteejenkins/gitee/api/impl/AutodetectingGiteeClient.java similarity index 69% rename from src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/impl/AutodetectingGitLabClient.java rename to src/main/java/com/dabsquared/giteejenkins/gitee/api/impl/AutodetectingGiteeClient.java index 6510f0a..f985f2c 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/impl/AutodetectingGitLabClient.java +++ b/src/main/java/com/dabsquared/giteejenkins/gitee/api/impl/AutodetectingGiteeClient.java @@ -1,27 +1,27 @@ -package com.dabsquared.gitlabjenkins.gitlab.api.impl; +package com.dabsquared.giteejenkins.gitee.api.impl; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient; -import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClientBuilder; -import com.dabsquared.gitlabjenkins.gitlab.api.model.*; -import com.dabsquared.gitlabjenkins.gitlab.hook.model.State; +import com.dabsquared.giteejenkins.gitee.api.GiteeClient; +import com.dabsquared.giteejenkins.gitee.api.GiteeClientBuilder; +import com.dabsquared.giteejenkins.gitee.api.model.*; +import com.dabsquared.giteejenkins.gitee.hook.model.State; import javax.ws.rs.NotFoundException; import java.util.List; import java.util.NoSuchElementException; -final class AutodetectingGitLabClient implements GitLabClient { - private final Iterable builders; +final class AutodetectingGiteeClient implements GiteeClient { + private final Iterable builders; private final String url; private final String token; private final boolean ignoreCertificateErrors; private final int connectionTimeout; private final int readTimeout; - private GitLabClient delegate; + private GiteeClient delegate; - AutodetectingGitLabClient(Iterable builders, String url, String token, boolean ignoreCertificateErrors, int connectionTimeout, int readTimeout) { + AutodetectingGiteeClient(Iterable builders, String url, String token, boolean ignoreCertificateErrors, int connectionTimeout, int readTimeout) { this.builders = builders; this.url = url; this.token = token; @@ -38,9 +38,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public Project createProject(final String projectName) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Project execute(GitLabClient client) { + Project execute(GiteeClient client) { return client.createProject(projectName); } }); @@ -49,9 +49,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public MergeRequest createMergeRequest(final Integer projectId, final String sourceBranch, final String targetBranch, final String title) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - MergeRequest execute(GitLabClient client) { + MergeRequest execute(GiteeClient client) { return client.createMergeRequest(projectId, sourceBranch, targetBranch, title); } }); @@ -60,9 +60,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public Project getProject(final String projectName) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Project execute(GitLabClient client) { + Project execute(GiteeClient client) { return client.getProject(projectName); } }); @@ -71,9 +71,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public Project updateProject(final String projectId, final String name, final String path) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Project execute(GitLabClient client) { + Project execute(GiteeClient client) { return client.updateProject(projectId, name, path); } }); @@ -82,9 +82,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void deleteProject(final String projectId) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.deleteProject(projectId); return null; } @@ -94,9 +94,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void addProjectHook(final String projectId, final String url, final Boolean pushEvents, final Boolean mergeRequestEvents, final Boolean noteEvents) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.addProjectHook(projectId, url, pushEvents, mergeRequestEvents, noteEvents); return null; } @@ -106,9 +106,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void changeBuildStatus(final String projectId, final String sha, final BuildState state, final String ref, final String context, final String targetUrl, final String description) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.changeBuildStatus(projectId, sha, state, ref, context, targetUrl, description); return null; } @@ -118,9 +118,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void changeBuildStatus(final Integer projectId, final String sha, final BuildState state, final String ref, final String context, final String targetUrl, final String description) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.changeBuildStatus(projectId, sha, state, ref, context, targetUrl, description); return null; } @@ -130,9 +130,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void getCommit(final String projectId, final String sha) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.getCommit(projectId, sha); return null; } @@ -142,9 +142,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void acceptMergeRequest(final MergeRequest mr, final String mergeCommitMessage, final boolean shouldRemoveSourceBranch) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.acceptMergeRequest(mr, mergeCommitMessage, shouldRemoveSourceBranch); return null; } @@ -155,9 +155,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public void createMergeRequestNote(final MergeRequest mr, final String body) { execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Void execute(GitLabClient client) { + Void execute(GiteeClient client) { client.createMergeRequestNote(mr, body); return null; } @@ -168,9 +168,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public List getMergeRequests(final String projectId, final State state, final int page, final int perPage) { return execute( - new GitLabOperation>() { + new GiteeOperation>() { @Override - List execute(GitLabClient client) { + List execute(GiteeClient client) { return client.getMergeRequests(projectId, state, page, perPage); } }); @@ -179,9 +179,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public List getBranches(final String projectId) { return execute( - new GitLabOperation>() { + new GiteeOperation>() { @Override - List execute(GitLabClient client) { + List execute(GiteeClient client) { return client.getBranches(projectId); } }); @@ -190,9 +190,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public Branch getBranch(final String projectId, final String branch) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - Branch execute(GitLabClient client) { + Branch execute(GiteeClient client) { return client.getBranch(projectId, branch); } }); @@ -201,9 +201,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public User getCurrentUser() { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - User execute(GitLabClient client) { + User execute(GiteeClient client) { return client.getCurrentUser(); } }); @@ -212,9 +212,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public User addUser(final String email, final String username, final String name, final String password) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - User execute(GitLabClient client) { + User execute(GiteeClient client) { return client.addUser(email, username, name, password); } }); @@ -223,9 +223,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public User updateUser(final String userId, final String email, final String username, final String name, final String password) { return execute( - new GitLabOperation() { + new GiteeOperation() { @Override - User execute(GitLabClient client) { + User execute(GiteeClient client) { return client.updateUser(userId, email, username, name, password); } }); @@ -234,9 +234,9 @@ final class AutodetectingGitLabClient implements GitLabClient { @Override public List