-
Notifications
You must be signed in to change notification settings - Fork 148
feature : support warnings-ng plugin [JENKINS-57427] #221
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
base: master
Are you sure you want to change the base?
Changes from all commits
3698cc7
6bef08a
6388bfc
7da5870
031a4d0
ccf5c15
657f412
73222b5
23f8c94
daf4546
741c831
052c70f
aa33b1c
16b3f97
18695f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,41 @@ public enum LifecycleThreshold { | |
DEPLOY | ||
} | ||
|
||
public enum TrendChartType { | ||
bguerin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
AGGREGATION_TOOLS, | ||
TOOLS_AGGREGATION, | ||
TOOLS_ONLY, | ||
AGGREGATION_ONLY, | ||
NONE | ||
} | ||
|
||
public enum QualityGateType { | ||
bguerin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TOTAL, | ||
TOTAL_ERROR, | ||
TOTAL_HIGH, | ||
TOTAL_NORMAL, | ||
TOTAL_LOW, | ||
TOTAL_MODIFIED, | ||
NEW, | ||
NEW_ERROR, | ||
NEW_HIGH, | ||
NEW_NORMAL, | ||
NEW_LOW, | ||
NEW_MODIFIED, | ||
DELTA, | ||
DELTA_ERROR, | ||
DELTA_HIGH, | ||
DELTA_NORMAL, | ||
DELTA_LOW | ||
} | ||
|
||
public enum QualityGateCriticality { | ||
bguerin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
NOTE, | ||
UNSTABLE, | ||
ERROR, | ||
FAILURE | ||
} | ||
|
||
public static class Publisher extends PageAreaImpl { | ||
private final Control disabled = control("disabled"); | ||
|
||
|
@@ -196,6 +231,19 @@ public static class Publisher extends PageAreaImpl { | |
private final Control skipDownstreamTriggers = control("skipDownstreamTriggers"); | ||
private final Control ignoreUpstreamTriggers = control("ignoreUpstreamTriggers"); | ||
|
||
private Control sourceCodeEncoding = control("sourceCodeEncoding"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would have this page should be generic for all publishers and specific publisher functionality / options should be in a sepearate page area for that Publisher. (e.g. see Credentials -> https://github.com/jenkinsci/acceptance-test-harness/blob/master/src/main/java/org/jenkinsci/test/acceptance/plugins/credentials/StringCredentials.java) |
||
private Control isEnabledForFailure = control("enabledForFailure"); | ||
private Control isBlameDisabled = control("skipBlames"); | ||
private Control trendChartType = control("trendChartType"); | ||
private Control qualityGateThreshold = control("qualityGateThreshold"); | ||
private Control qualityGateType = control("qualityGateType"); | ||
private Control qualityGateCriticality = control("qualityGateCriticality"); | ||
private Control javaIgnorePatterns = control("javaIgnorePatterns"); | ||
private Control highPriorityTaskIdentifiers = control("highPriorityTaskIdentifiers"); | ||
private Control normalPriorityTaskIdentifiers = control("normalPriorityTaskIdentifiers"); | ||
private Control tasksIncludePattern = control("tasksIncludePattern"); | ||
private Control tasksExcludePattern = control("tasksExcludePattern"); | ||
|
||
Publisher(final PageArea issuesRecorder, final String path) { | ||
super(issuesRecorder, path); | ||
} | ||
|
@@ -279,5 +327,65 @@ public Publisher setIgnoreUpstreamTriggers(boolean ignoreUpstreamTriggers) { | |
this.ignoreUpstreamTriggers.check(ignoreUpstreamTriggers); | ||
return this; | ||
} | ||
|
||
public Publisher setSourceCodeEncoding(String sourceCodeEncoding) { | ||
this.sourceCodeEncoding.set(sourceCodeEncoding); | ||
return this; | ||
} | ||
|
||
public Publisher setIsEnabledForFailure(boolean isEnabledForFailure) { | ||
this.isEnabledForFailure.check(isEnabledForFailure); | ||
return this; | ||
} | ||
|
||
public Publisher setIsBlameDisabled(boolean isBlameDisabled) { | ||
this.isBlameDisabled.check(isBlameDisabled); | ||
return this; | ||
} | ||
|
||
public Publisher setTrendChartType(TrendChartType trendChartType) { | ||
this.trendChartType.select(trendChartType.toString()); | ||
return this; | ||
} | ||
|
||
public Publisher setQualityGateThreshold(int qualityGateThreshold) { | ||
this.qualityGateThreshold.set(qualityGateThreshold); | ||
return this; | ||
} | ||
|
||
public Publisher setQualityGateType(QualityGateType qualityGateType) { | ||
this.qualityGateType.select(qualityGateType.toString()); | ||
return this; | ||
} | ||
|
||
public Publisher setQualityGateCriticality(QualityGateCriticality qualityGateCriticality) { | ||
this.qualityGateCriticality.select(qualityGateCriticality.toString()); | ||
return this; | ||
} | ||
|
||
public Publisher setJavaIgnorePatterns(String javaIgnorePatterns) { | ||
this.javaIgnorePatterns.set(javaIgnorePatterns); | ||
return this; | ||
} | ||
|
||
public Publisher setHighPriorityTaskIdentifiers(String highPriorityTaskIdentifiers) { | ||
this.highPriorityTaskIdentifiers.set(highPriorityTaskIdentifiers); | ||
return this; | ||
} | ||
|
||
public Publisher setNormalPriorityTaskIdentifiers(String normalPriorityTaskIdentifiers) { | ||
this.normalPriorityTaskIdentifiers.set(normalPriorityTaskIdentifiers); | ||
return this; | ||
} | ||
|
||
public Publisher setTasksIncludePattern(String tasksIncludePattern) { | ||
this.tasksIncludePattern.set(tasksIncludePattern); | ||
return this; | ||
} | ||
|
||
public Publisher setTasksExcludePattern(String tasksExcludePattern) { | ||
this.tasksExcludePattern.set(tasksExcludePattern); | ||
return this; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,10 @@ | |
|
||
import org.jenkinsci.plugins.maven.WithMaven.LifecycleThreshold; | ||
import org.jenkinsci.plugins.maven.WithMaven.PublisherStrategy; | ||
import org.jenkinsci.plugins.maven.WithMaven.QualityGateCriticality; | ||
import org.jenkinsci.plugins.maven.WithMaven.QualityGateType; | ||
import org.jenkinsci.plugins.maven.WithMaven.SourceCodeRetention; | ||
import org.jenkinsci.plugins.maven.WithMaven.TrendChartType; | ||
import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest; | ||
import org.jenkinsci.test.acceptance.junit.WithPlugins; | ||
import org.jenkinsci.test.acceptance.plugins.config_file_provider.ConfigFileProvider; | ||
|
@@ -50,7 +53,8 @@ | |
.setMavenSettingsFilePath("") | ||
.setGlobalMavenSettingsConfig("") | ||
.setGlobalMavenSettingsFilePath("") | ||
.setMavenOpts("") | ||
.setMavenOpts( | ||
"-Dmaven.test.failure.ignore -Dspotbugs.failOnError=false -Dcheckstyle.failOnViolation=false -Dcheckstyle.failsOnError=false -Dpmd.failOnViolation=false") | ||
.setTraceability(true) | ||
.setMavenLocalRepo("") | ||
.setPublisherStrategy(PublisherStrategy.IMPLICIT); | ||
|
@@ -645,6 +649,70 @@ | |
}"""); | ||
} | ||
|
||
@Test | ||
public void defaultWarningsPublisherTest() throws InterruptedException { | ||
WithMavenSnippetGenerator snippetGenerator = createSnippetGenerator(); | ||
|
||
snippetGenerator.selectWithMaven().addPublisher("Warnings Publisher"); | ||
bguerin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
assertThat(snippetGenerator.generateScript()) | ||
.isEqualTo(""" | ||
withMaven(options: [warningsPublisher()], traceability: true) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this would appear incorrect. |
||
// some block | ||
}"""); | ||
} | ||
|
||
@Test | ||
public void defaultWarningsPublisherExplicitTest() { | ||
WithMavenSnippetGenerator snippetGenerator = createSnippetGenerator(); | ||
|
||
snippetGenerator.selectWithMaven().addPublisher("Warnings Publisher", p -> p.setDisabled(false) | ||
bguerin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.setSourceCodeEncoding("UTF-8") | ||
.setIsEnabledForFailure(true) | ||
.setIsBlameDisabled(true) | ||
.setTrendChartType(TrendChartType.TOOLS_ONLY) | ||
.setQualityGateThreshold(1) | ||
.setQualityGateType(QualityGateType.NEW) | ||
.setQualityGateCriticality(QualityGateCriticality.UNSTABLE) | ||
.setJavaIgnorePatterns("") | ||
.setHighPriorityTaskIdentifiers("FIXME") | ||
.setNormalPriorityTaskIdentifiers("TODO") | ||
.setTasksIncludePattern("**/*.java") | ||
.setTasksExcludePattern("**/target/**")); | ||
|
||
assertThat(snippetGenerator.generateScript()) | ||
.isEqualTo(""" | ||
withMaven(options: [warningsPublisher()], traceability: true) { | ||
// some block | ||
}"""); | ||
} | ||
|
||
@Test | ||
public void explicitWarningsPublisherTest() { | ||
WithMavenSnippetGenerator snippetGenerator = createSnippetGenerator(); | ||
|
||
snippetGenerator.selectWithMaven().addPublisher("Warnings Publisher", p -> p.setDisabled(true) | ||
.setSourceCodeEncoding("ISO-8859-1") | ||
.setIsEnabledForFailure(false) | ||
.setIsBlameDisabled(false) | ||
.setTrendChartType(TrendChartType.NONE) | ||
.setQualityGateThreshold(2) | ||
.setQualityGateType(QualityGateType.DELTA) | ||
.setQualityGateCriticality(QualityGateCriticality.FAILURE) | ||
.setJavaIgnorePatterns("**/*Test.java") | ||
.setHighPriorityTaskIdentifiers("FIX") | ||
.setNormalPriorityTaskIdentifiers("TO-DO") | ||
.setTasksIncludePattern("*.java") | ||
.setTasksExcludePattern("target")); | ||
|
||
assertThat(snippetGenerator.generateScript()) | ||
.isEqualTo( | ||
""" | ||
withMaven(options: [warningsPublisher(disabled: true, enabledForFailure: false, highPriorityTaskIdentifiers: 'FIX', javaIgnorePatterns: '**/*Test.java', normalPriorityTaskIdentifiers: 'TO-DO', qualityGateCriticality: 'FAILURE', qualityGateThreshold: 2, qualityGateType: 'DELTA', skipBlames: false, sourceCodeEncoding: 'ISO-8859-1', tasksExcludePattern: 'target', tasksIncludePattern: '*.java', trendChartType: 'NONE')], traceability: true) { | ||
// some block | ||
}"""); | ||
} | ||
|
||
private WithMavenSnippetGenerator createSnippetGenerator() { | ||
WithMavenSnippetGenerator snippetGenerator = new WithMavenSnippetGenerator(jenkins); | ||
snippetGenerator.open(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not need any argLine at all.
If you need to change a timeout globaly pass
jenkins.test.timeout
as aSystemProperty
to surefire.(arglines are set by the parent pom and can change / add over time if changes are needed.)
Surefire shouldn't need 1GB of RAM for example - The UI tests are not even using
JenkinsRule
type tests but the OSS ATH framework - so timeout here should also be immaterial!?