diff --git a/build.gradle b/build.gradle index ab5e77e8..a1ee7d45 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ dependencies { compileOnly 'com.intellij:annotations:12.0', 'org.slf4j:slf4j-api:1.6.1' - compile 'com.checkmarx:cx-client-common:2021.2.159', + compile 'com.checkmarx:cx-client-common:2021.2.161', 'com.checkmarx:cx-config-provider:1.0.14', 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.5', 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.5' diff --git a/gradle.properties b/gradle.properties index 21529d91..8c331447 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ description = Provides automatic scan of code by Checkmarx server and shows results summary and trend in Jenkins interface. group = com.checkmarx.jenkins -version = 2021.2.94 +version = 2021.2.95 repositoryVersion= diff --git a/src/main/java/com/checkmarx/jenkins/CxScanBuilder.java b/src/main/java/com/checkmarx/jenkins/CxScanBuilder.java index f410d474..57a8a461 100644 --- a/src/main/java/com/checkmarx/jenkins/CxScanBuilder.java +++ b/src/main/java/com/checkmarx/jenkins/CxScanBuilder.java @@ -849,9 +849,9 @@ public void perform(@Nonnull Run run, @Nonnull FilePath workspace, @Nonnul if (instance != null && instance.proxy != null && (useOwnServerCredentials ? this.isProxy : getDescriptor().getIsProxy()) && !(isCxURLinNoProxyHost(useOwnServerCredentials ? this.serverUrl : getDescriptor().getServerUrl(), instance.proxy.getNoProxyHostPatterns()))) { - action = new CxScanCallable(config, listener, instance.proxy, log); + action = new CxScanCallable(config, listener, instance.proxy); } else { - action = new CxScanCallable(config, listener, log); + action = new CxScanCallable(config, listener); } //create scans and retrieve results (in jenkins agent) @@ -1250,12 +1250,10 @@ private CxScanConfig resolveConfiguration(Run run, DescriptorImpl descript } } - //Jenkins UI does not send teamName but team Id - teamPath = getTeamNameFromId(cxCredentials,descriptor, groupId); - //project ret.setProjectName(env.expand(projectName.trim())); ret.setTeamPath(teamPath); + //Jenkins UI does not send teamName but team Id ret.setTeamId(groupId); //scan control @@ -1458,8 +1456,10 @@ private AstScaConfig getScaConfig(Run run, EnvVars env,DependencyScanConfi result.setEnvVariables(CxSCAFileSystemUtils.convertStringToKeyValueMap(env.expand(dsConfig.scaEnvVariables))); } String filePath = dsConfig.scaConfigFile; - String[] strArrayFile=filePath.split(","); - result.setConfigFilePaths(Arrays.asList(strArrayFile)); + if (!StringUtils.isEmpty(filePath)) { + String[] strArrayFile = filePath.split(","); + result.setConfigFilePaths(Arrays.asList(strArrayFile)); + } String derivedProjectName = projectName; @@ -1508,8 +1508,9 @@ private void printConfiguration(CxScanConfig config, CxLoggerAdapter log) { log.info("plugin version: {}", CxConfig.version()); log.info("server url: " + config.getUrl()); log.info("username: " + config.getUsername()); - log.info("is using Jenkins server proxy: " + (useOwnServerCredentials ? getIsProxy() : config.getProxyConfig() != null)); - if (useOwnServerCredentials ? getIsProxy() : config.getProxyConfig() != null) { + boolean proxyEnabled = ((useOwnServerCredentials ? getIsProxy() : config.getProxyConfig()) != null); + log.info("is using Jenkins server proxy: " + proxyEnabled ); + if (proxyEnabled) { if (Jenkins.getInstance().proxy != null) log.info("No Proxy Host: " + printNoProxyHost()); } diff --git a/src/main/java/com/checkmarx/jenkins/CxScanCallable.java b/src/main/java/com/checkmarx/jenkins/CxScanCallable.java index fef2e6f3..103b39e2 100644 --- a/src/main/java/com/checkmarx/jenkins/CxScanCallable.java +++ b/src/main/java/com/checkmarx/jenkins/CxScanCallable.java @@ -30,24 +30,22 @@ public class CxScanCallable implements FilePath.FileCallable, Se private final CxScanConfig config; private final TaskListener listener; private ProxyConfiguration jenkinsProxy = null; - CxLoggerAdapter log = null; - - public CxScanCallable(CxScanConfig config, TaskListener listener, CxLoggerAdapter log) { + + public CxScanCallable(CxScanConfig config, TaskListener listener) { this.config = config; - this.listener = listener; - this.log = log; + this.listener = listener; } - public CxScanCallable(CxScanConfig config, TaskListener listener, ProxyConfiguration jenkinsProxy, CxLoggerAdapter log) { + public CxScanCallable(CxScanConfig config, TaskListener listener, ProxyConfiguration jenkinsProxy) { this.config = config; this.listener = listener; - this.jenkinsProxy = jenkinsProxy; - this.log = log; + this.jenkinsProxy = jenkinsProxy; } @Override public RemoteScanInfo invoke(File file, VirtualChannel channel) throws IOException, InterruptedException { + CxLoggerAdapter log = new CxLoggerAdapter(listener.getLogger()); config.setSourceDir(file.getAbsolutePath()); config.setReportsDir(file); if (jenkinsProxy != null) {