Skip to content

Commit

Permalink
完善错误信息
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruce.wu committed Sep 14, 2024
1 parent 2a26acb commit 5fa6e40
Show file tree
Hide file tree
Showing 11 changed files with 453 additions and 53 deletions.
47 changes: 9 additions & 38 deletions src/main/java/io/jenkins/plugins/blueking/BkCcHostsBuilder.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.jenkins.plugins.blueking;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractProject;
import hudson.model.EnvironmentContributingAction;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.TaskListener;
Expand Down Expand Up @@ -75,13 +75,13 @@ public class BkCcHostsBuilder extends Builder implements SimpleBuildStep {

@DataBoundConstructor
public BkCcHostsBuilder(
String baseUrl,
String bkAppCode,
String bkAppSecret,
String bkUsername,
String bkBiz,
String bkSet,
String bkModules) {
@NonNull String baseUrl,
@NonNull String bkAppCode,
@NonNull String bkAppSecret,
@NonNull String bkUsername,
@NonNull String bkBiz,
@NonNull String bkSet,
@NonNull String bkModules) {
this.baseUrl = baseUrl;
this.bkAppCode = bkAppCode;
this.bkAppSecret = bkAppSecret;
Expand Down Expand Up @@ -114,7 +114,7 @@ public void perform(Run<?, ?> run, FilePath workspace, EnvVars env, Launcher lau
String bkModulesEx = env.expand(bkModules);
logger.log(
"Start fetch host. baseUrl:%s, biz:%s, set:%s, modules:%s", baseUrlEx, bkBizEx, bkSetEx, bkModulesEx);
BluekingCCClient client = new BluekingCCClient(logger, baseUrlEx, bkAppCodeEx, bkAppSecretEx, bkUsernameEx);
BluekingCCClient client = new BluekingCCClient(baseUrlEx, bkAppCodeEx, bkAppSecretEx, bkUsernameEx);
BkBizSetModule biz = findBiz(client, bkBizEx);
if (Objects.isNull(biz)) {
logger.log("CMDB Business not found, please check your parameter");
Expand Down Expand Up @@ -270,33 +270,4 @@ public String getDisplayName() {
return Messages.BkCcHostsBuilder_DescriptorImpl_DisplayName();
}
}

public static class EnvInjectAction implements EnvironmentContributingAction {

private final EnvVars envVars;

public EnvInjectAction(EnvVars envVars) {
this.envVars = envVars;
}

@Override
public String getIconFileName() {
return null;
}

@Override
public String getDisplayName() {
return null;
}

@Override
public String getUrlName() {
return null;
}

@Override
public void buildEnvironment(Run<?, ?> run, EnvVars env) {
env.overrideAll(envVars);
}
}
}
Loading

0 comments on commit 5fa6e40

Please sign in to comment.