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

JENKINS-25600 fix user abort #13

Merged
merged 2 commits into from
Dec 29, 2014
Merged

Conversation

JeremyMarshall
Copy link
Collaborator

I added a try block around the log processing to kill the process if it is interrupted.

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

} catch (InterruptedException intEx) {
LOG.log(Level.FINEST, "Aborted by user");
child.kill();
listener.getLogger().println("Aborted by User. Terminated");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know all this code, so excuse my question. Will we have to forward the exception so the build is marked as aborted by Jenkins?

@JeremyMarshall
Copy link
Collaborator Author

No its fine as the killed process will return an error code -

from the log (job just sleeps for 60 seconds)

Started by user anonymous
[EnvInject] - Loading node environment variables.
Building in workspace /Users/jeremymarshall/.jenkins/jobs/dy/workspace
[workspace] $ /Users/jeremymarshall/src/tools/sleep.sh
+ sleep 60
Aborted by User. Terminated
/Users/jeremymarshall/src/tools/sleep.sh: line 3: 14931 Terminated: 15          sleep 60
Build step 'Invoke XShell command' marked build as failure
Finished: FAILURE

This way keeps the stack trace out of the log as the exception is handled anyway

@whimboo
Copy link

whimboo commented Nov 17, 2014

When a build is getting aborted, it shouldn't be marked as FAILURE but:

00:00:18.161 Finished: ABORTED

@JeremyMarshall
Copy link
Collaborator Author

Added extra commit to PR

As a side issue, if your run a matrix job and abort one of the jobs it sets
the whole build to aborted. Is that correct?


Started by user anonymous <http://localhost:8080/user/null>
[EnvInject] - Loading node environment variables.
Building remotely on jenkins <http://localhost:8080/computer/jenkins>
(swarm linux) in workspace /home/jeremy/src/tools/workspace/xs
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url
https://github.com/JeremyMarshall/tools # timeout=10
Fetching upstream changes from https://github.com/JeremyMarshall/tools
 > git --version # timeout=10
 > git fetch --tags --progress https://github.com/JeremyMarshall/tools
+refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision c4a4fe8c97247788ad48d968b11a227147bebc8b
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f c4a4fe8c97247788ad48d968b11a227147bebc8b
 > git rev-list c4a4fe8c97247788ad48d968b11a227147bebc8b # timeout=10
Triggering xs ? a <http://localhost:8080/job/xs/axis1=a/>
Triggering xs ? b <http://localhost:8080/job/xs/axis1=b/>
Triggering xs ? d <http://localhost:8080/job/xs/axis1=d/>
Triggering xs ? f <http://localhost:8080/job/xs/axis1=f/>
Triggering xs ? e <http://localhost:8080/job/xs/axis1=e/>
Triggering xs ? c <http://localhost:8080/job/xs/axis1=c/>xs ? a
<http://localhost:8080/job/xs/axis1=a/> completed with result
SUCCESSxs ? b <http://localhost:8080/job/xs/axis1=b/> completed with
result SUCCESSxs ? d <http://localhost:8080/job/xs/axis1=d/> completed
with result ABORTEDxs ? f <http://localhost:8080/job/xs/axis1=f/>
completed with result ABORTEDxs ? e
<http://localhost:8080/job/xs/axis1=e/> completed with result
SUCCESSxs ? c <http://localhost:8080/job/xs/axis1=c/> completed with
result SUCCESS
Finished: ABORTED

On Tue, Nov 18, 2014 at 9:18 AM, Henrik Skupin [email protected]
wrote:

When a build is getting aborted, it shouldn't be marked as FAILURE but:

00:00:18.161 Finished: ABORTED


Reply to this email directly or view it on GitHub
#13 (comment)
.

@whimboo
Copy link

whimboo commented Nov 18, 2014

I cannot tell how this should work. But maybe you can test it by using the Shell executor and not XShell. That one should tell us how XShell should behave correctly. I did that for the above wrong final result already.

@JeremyMarshall
Copy link
Collaborator Author

I checked and the Shell executor works in the same way so I think we're good to carry on.

@whimboo
Copy link

whimboo commented Nov 18, 2014

Fantastic. Thanks a lot Jeremy! @mambu will you have time to review this PR?

@JeremyMarshall
Copy link
Collaborator Author

I was looking at the wiki and I forgot to add in any notes for the regex/time limit changes i made originally. Do you want me to update it?

mambu added a commit that referenced this pull request Dec 29, 2014
@mambu mambu merged commit 9da2ce4 into jenkinsci:master Dec 29, 2014
@MarkEWaite MarkEWaite added bug Incorrect or flawed behavior and removed bugfix labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect or flawed behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants