Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fsa_vars_fix #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/java/com/checkmarx/jenkins/CxScanBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -849,21 +849,21 @@ private void setJvmVars(EnvVars env) {
}
}
}
private Map<String, String> getAllFsaVars(EnvVars env) {
private Map<String, String> getAllFsaVars(EnvVars env, String workspacePath) {
Map<String, String> sumFsaVars = new HashMap<>();
// As job environment variable
for (Map.Entry<String, String> entry : env.entrySet()) {
if (entry.getKey().contains("CX_") ||
entry.getKey().contains("FSA_")) {
if (StringUtils.isNotEmpty(entry.getValue())) {
sumFsaVars.put(entry.getKey(), entry.getValue());
sumFsaVars.put(entry.getKey().trim(), entry.getValue().trim());
}
}
}
// As custom field - for pipeline jobs
String fsaVars = dependencyScanConfig != null ? dependencyScanConfig.fsaVariables : "";
if (StringUtils.isNotEmpty(fsaVars)) {
fsaVars = fsaVars.contains("${WORKSPACE}") ? fsaVars.replace("${WORKSPACE}", env.get("WORKSPACE")) : fsaVars;
fsaVars = fsaVars.contains("${WORKSPACE}") ? fsaVars.replace("${WORKSPACE}", workspacePath) : fsaVars;
try {
String[] vars = fsaVars.replaceAll("[\\n\\r]", "").trim().split(",");
for (String var : vars) {
Expand Down Expand Up @@ -910,7 +910,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
final DescriptorImpl descriptor = getDescriptor();
EnvVars env = run.getEnvironment(listener);
setJvmVars(env);
Map<String, String> fsaVars = getAllFsaVars(env);
Map<String, String> fsaVars = getAllFsaVars(env, workspace.getRemote());
CxScanConfig config = resolveConfiguration(run, descriptor, env, log);

if (configAsCode) {
Expand Down