-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
[INFRA-1459] - Initial implementation for the buildJenkinsComponent() step #56
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env groovy | ||
|
||
/** | ||
* Build a component defined by Jenkins parent POM. | ||
* @param params Parameters to be passed | ||
*/ | ||
def call(Map params = [:]) { | ||
// These platforms correspond to labels in ci.jenkins.io, see: | ||
// https://github.com/jenkins-infra/documentation/blob/master/ci.adoc | ||
def platforms = params.containsKey('platforms') ? params.platforms : ['linux', 'windows'] | ||
def jdkVersions = params.containsKey('jdkVersions') ? params.jdkVersions : [8] | ||
int timeoutMin = params.containsKey('timeoutMin') ? Integer.parseInt(params.timeoutMin) : [8] | ||
|
||
Map branches = [:] | ||
for (int i = 0; i < platforms.size(); ++i) { | ||
String label = platforms[i] | ||
for (int j = 0; j < jdkVersions.size(); ++j) { | ||
String jdk = jdkVersions[j] | ||
String stageIdentifier = "${label}${jdkVersions.size() > 1 ? '-' + jdk : ''}" | ||
boolean first = i == 0 && j == 0 | ||
branches[label] = { | ||
buildSingle(stageIdentifier, label, jdk, first, timeoutMin) | ||
} | ||
} | ||
} | ||
|
||
/* Execute our platforms in parallel */ | ||
parallel(branches) | ||
} | ||
|
||
/** | ||
* Builds a single configuration of a component. | ||
* @param stageIdentifier Stage identifier for visualization | ||
* @param nodeLabel Node label | ||
* @param jdk JDK to be used, {@code 8} by default | ||
* @param archive If {@code true}, arhive results. | ||
* {@code false} by default | ||
* @param timeoutMin Timeout for the Maven run (in minutes) | ||
* @return nothing | ||
*/ | ||
def buildSingle(String stageIdentifier, String nodeLabel, String jdk = 8, boolean archive = false, int timeoutMin = 60) { | ||
node(label) { | ||
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. 🐛 Probably you mean |
||
timeout(timeoutMin) { | ||
timestamps { | ||
stage("Checkout (${stageIdentifier})") { | ||
infra.checkout(repo) | ||
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. 🐛 |
||
isMaven = fileExists('pom.xml') | ||
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. What is this variable? Seems unused? 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. Yes, copy-paste leftovers I'd guess |
||
} | ||
|
||
stage("Build (${stageIdentifier})") { | ||
infra.runMaven(["--batch-mode", "clean", "install", "-Dmaven.test.failure.ignore=true"], jdk) | ||
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. add |
||
} | ||
|
||
stage("Archive (${stageIdentifier})") { | ||
/* Archive the test results */ | ||
junit '**/target/surefire-reports/TEST-*.xml' | ||
|
||
if (archive) { | ||
archiveArtifacts artifacts: '**/target/**/*.jar' | ||
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. So I would delete this and replace with conditional Incrementals deployment, as done in 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. For things like Remoting it may be useful to publish the artifacts. But yes, maybe it should be opt-in (and configurable by YAML?) 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 agree on it being opt-in, however, I would ask that to be configurable via step param (and overridable in YAML) so that you can Replay and activate that if you need to debug instead of making a PR to modify the YAML file |
||
findbugs pattern: '**/target/findbugsXml.xml' | ||
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. Why is findbugs guarded by Is findbugs actually called? |
||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<p> | ||
Builds a Jenkins component following a standard build/test/archive pattern. See repository description for usage. | ||
</p> | ||
|
||
<!-- | ||
vim: ft=html | ||
--> |
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.
cannot comment on the filename, and need to review this more fully some day, but I think this should be named
buildComponent
.This would be more consistent with
buildPlugin
, and like for the plugins where we removed Jenkins because it's contextually obviously Jenkins related, I think this is the same here :).