Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;
import java.util.Set;

import com.fortify.plugin.jenkins.steps.remote.*;
import hudson.model.Item;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
Expand All @@ -38,12 +39,6 @@
import org.kohsuke.stapler.verb.POST;

import com.fortify.plugin.jenkins.FortifyPlugin;
import com.fortify.plugin.jenkins.steps.remote.GradleProjectType;
import com.fortify.plugin.jenkins.steps.remote.MSBuildProjectType;
import com.fortify.plugin.jenkins.steps.remote.MavenProjectType;
import com.fortify.plugin.jenkins.steps.remote.PhpProjectType;
import com.fortify.plugin.jenkins.steps.remote.PythonProjectType;
import com.fortify.plugin.jenkins.steps.remote.RemoteAnalysisProjectType;
import com.google.common.collect.ImmutableSet;

import hudson.AbortException;
Expand Down Expand Up @@ -96,18 +91,22 @@
return "mvn";
} else if (getRemoteAnalysisProjectType() instanceof MSBuildProjectType) {
return "msbuild";
} else if (getRemoteAnalysisProjectType() instanceof DotNetProjectType) {
return "dotnet";
} else {
return "none";
}
}

public String getBuildFile() {
if (getRemoteAnalysisProjectType() instanceof GradleProjectType) {
return ((GradleProjectType)remoteAnalysisProjectType).getBuildFile();
} else if (getRemoteAnalysisProjectType() instanceof MavenProjectType) {
return ((MavenProjectType)remoteAnalysisProjectType).getBuildFile();
} else if (getRemoteAnalysisProjectType() instanceof MSBuildProjectType) {
return ((MSBuildProjectType)remoteAnalysisProjectType).getDotnetProject();
} else if (getRemoteAnalysisProjectType() instanceof DotNetProjectType) {
return ((DotNetProjectType)remoteAnalysisProjectType).getDotnetProject();

Check warning on line 109 in src/main/java/com/fortify/plugin/jenkins/steps/CloudScanStart.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 94-109 are not covered by tests
} else {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright 2019-2023 Open Text.
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.fortify.plugin.jenkins.steps.remote;

import com.fortify.plugin.jenkins.steps.Validators;
import hudson.Extension;
import hudson.util.FormValidation;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.apache.commons.lang.StringUtils;

public class DotNetProjectType extends RemoteAnalysisProjectType {

private String dotnetProject;
private boolean excludeDisabledProjects;

@DataBoundConstructor
public DotNetProjectType() {
}

public String getDotnetProject() {
return dotnetProject;
}

public boolean isExcludeDisabledProjects() {
return excludeDisabledProjects;
}

@DataBoundSetter
public void setDotnetProject(String dotnetProject) {
this.dotnetProject = StringUtils.isBlank(dotnetProject) ? null : dotnetProject;
}

@DataBoundSetter
public void setExcludeDisabledProjects(boolean excludeDisabledProjects) {
this.excludeDisabledProjects = excludeDisabledProjects;
}

Check warning on line 52 in src/main/java/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 33-52 are not covered by tests

@Extension
@Symbol("fortifyDotNet")
public static final class DescriptorImpl extends RemoteAnalysisProjectTypeDescriptor {
public DescriptorImpl() {
super(DotNetProjectType.class);
}

@Override
public String getDisplayName() {
return "dotnet";
}

}

public static final RemoteAnalysisProjectTypeDescriptor DESCRIPTOR = new DotNetProjectType.DescriptorImpl();

Check warning on line 68 in src/main/java/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 68 is not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public DescriptorImpl() {

@Override
public String getDisplayName() {
return ".NET MSBuild";
return ".NET MSBuild (Windows only)";
}

public FormValidation doCheckDotnetProject(@QueryParameter String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<f:block>
<local:blockWrapper>
<f:radioBlock title="Remote translation &amp; remote scan" value="remote" name="analysisRunType"
checked="${instance.isRemote()}" help="/plugin/fortify/help-RemoteSCATranslationAndScan.html">
checked="${instance.isRemote()}" help="/plugin/fortify/help-remoteSCATranslationAndScan.html">
<f:dropdownDescriptorSelector title="Application type" field="remoteAnalysisProjectType"
descriptors="${descriptor.remoteAnalysisProjectTypeDescriptors}"/>
<f:advanced>
Expand All @@ -59,12 +59,12 @@
</f:advanced>
<f:block>
<local:blockWrapper>
<f:optionalBlock field="remoteOptionalConfig" title="Optional configuration" help="/plugin/fortify/help-RemoteOptionalConfiguration.html">
<f:optionalBlock field="remoteOptionalConfig" title="Optional configuration" help="/plugin/fortify/help-remoteOptionalConfiguration.html">
<f:section class="section-header" title="Controller configuration">
<f:entry field="sensorPoolUUID" title="Sensor pool" help="/plugin/fortify/help-RemoteSensorPool.html">
<f:entry field="sensorPoolUUID" title="Sensor pool" help="/plugin/fortify/help-remoteSensorPool.html">
<f:select/>
</f:entry>
<f:entry title="Notification email" help="/plugin/fortify/help-RemoteNotificationEmail.html">
<f:entry title="Notification email" help="/plugin/fortify/help-remoteNotificationEmail.html">
<f:textbox field="notifyEmail"/>
</f:entry>
</f:section>
Expand All @@ -75,7 +75,7 @@
<f:entry title="Custom Rulepacks" help="/plugin/fortify/help-scanCustomRulepacks.html">
<f:textbox field="customRulepacks"/>
</f:entry>
<f:entry title="Fortify SCA scan filter file" help="/plugin/fortify/help-RemoteScanFilterFile.html">
<f:entry title="Fortify SCA scan filter file" help="/plugin/fortify/help-remoteScanFilterFile.html">
<f:textbox field="filterFile"/>
</f:entry>
</f:section>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?jelly escape-by-default='true'?>
<!--
Copyright 2021 - 2023 Open Text.

Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://opensource.org/licenses/MIT

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Solution or project file (optional)" field="dotnetProject" help="/plugin/fortify/help-dotnetProjects.html">
<f:textbox/>
</f:entry>
</j:jelly>
20 changes: 20 additions & 0 deletions src/main/webapp/help-dotnetProjects.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright 2019 - 2023 Open Text.

Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://opensource.org/licenses/MIT

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div>
<p>
<strong>(Optional)</strong> Project or solution file for Fortify SCA analysis. If a project or solution file isn't specified, the <strong><code style="padding: 2px 4px;">dotnet build</code></strong> command searches the current working directory for a file that has a file extension that ends in either <strong><code style="padding: 2px 4px;">proj</code></strong> or <strong><code style="padding: 2px 4px;">sln</code></strong> and uses that file.
</p>
</div>
Loading