Skip to content

Commit

Permalink
Regression fix (#66)
Browse files Browse the repository at this point in the history
Fix for Bug 2277 Serialization exception with Jenkins node.
  • Loading branch information
umeshwaghode authored Jun 22, 2021
1 parent 68ea4cf commit a7ffab6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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=

Expand Down
19 changes: 10 additions & 9 deletions src/main/java/com/checkmarx/jenkins/CxScanBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/com/checkmarx/jenkins/CxScanCallable.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,22 @@ public class CxScanCallable implements FilePath.FileCallable<RemoteScanInfo>, 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) {
Expand Down

0 comments on commit a7ffab6

Please sign in to comment.