-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Active Node Timeout for Build Pipelines #2130
Active Node Timeout for Build Pipelines #2130
Conversation
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.
Sorry for the long review, some of my comments are just repeated points to make it easier to change if they need changing 😬
All issues handled or replied to. Squashing and pushing. |
189af5d
to
64a24b8
Compare
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.
Some more suggestions (not a hill I'm going to die on)
def waitForANodeToBecomeActive(def label) { | ||
def NodeHelper = context.library(identifier: 'openjdk-jenkins-helper@master').NodeHelper | ||
|
||
if (NodeHelper.nodeIsOnline(label)) { |
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.
I'm wondering if we need to change nodeIsOnline a little here. What it's really doing is saying that there is 'a' node (perhaps out of several) that is available. It's a subtle distinction but I think an important one.
Even aNodeIsOnline(label) may be more descriptive.
I could also see us enhancing NodeHelper to add a numberOfOnlineNodes(label) or some such.
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.
numberOfOnlineNodes: I think this already exists in the Jenkins pipeline API. It's called "nodesByLabel".
nodesByLabel Jenkins pipeline API link.
"nodesByLabel: List of nodes by Label, by default excludes offline nodes."
We already use it here: https://github.com/AdoptOpenJDK/openjdk-tests/pull/1950/files
|
||
|
||
if (activeNodeTimeout > 0) { | ||
context.println("Will check again periodically until either one comes online, or " + buildConfig.ACTIVE_NODE_TIMEOUT + " minutes (ACTIVE_NODE_TIMEOUT) has passed.") |
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.
Maybe:
"Will check again periodically until a node labeled " + label + " comes online, or " + buildConfig.ACTIVE_NODE_TIMEOUT + " minutes (ACTIVE_NODE_TIMEOUT) has passed."
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.
Sure. Will change.
64a24b8
to
6f989f0
Compare
6f989f0
to
0508b3a
Compare
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.
Thanks for implementing those changes! 👍
Removed myself as a reviewer, as 3 reviews seems like plenty already ;) |
|
Hmm, looks like the ContextStub class we use for test compilation lacks a stub for the advanced sleep method. Looking to see if it's definitely there in the context class the actual pipeline uses. EDIT: Sure took me long enough to figure out the advanced sleep method isn't in Groovy, it's in the pipeline library we import. Docs here: https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#sleep-sleep Will add the method's signature to the ContextStub class that we use for testing. EDIT 2: Wouldn't work after multiple changes, so we're back to sleep(int) with a useful comment. |
da2a7b1
to
bba0a61
Compare
bba0a61
to
e898091
Compare
Currently, if there are no active nodes that match a build job's labels, we fail immediately. This change is intended to add a modifiable timeout value, so if we don't find an active node that matches the build job's labels, we wait for x minutes, periodically checking to see if a node matching the labels has come online. Signed-off-by: Adam Farley <adam.farley@uk.ibm.com>
e898091
to
c3a77dc
Compare
Currently, if there are no active nodes that match a build job's
labels, we fail immediately.
This change is intended to add a modifiable timeout value, so if we
don't find an active node that matches the build job's labels, we
wait for x minutes, periodically checking to see if a node matching
the labels has come online.
Signed-off-by: Adam Farley adam.farley@uk.ibm.com