Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Terminate the instance when 404 occured. #489
Terminate the instance when 404 occured. #489
Changes from 3 commits
b14ecd1
5ba199e
ec6f4b3
627fda8
f6fc88c
ce2791c
d811f6c
181e799
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 443 in src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineComputerLauncher.java
ci.jenkins.io / Code Coverage
Not covered lines
Check warning on line 144 in src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineInstance.java
ci.jenkins.io / Code Coverage
Not covered lines
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.
Why is this needed? Is it just to avoid an unnecessary error message in the logs in case the instance does not exist in the cloud?
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.
This PR is based on another branch (see #470) but I don't think this condition is useful. Theoretically we could even verify the instance exists in the cloud but when running the
terminateInstanceAsync
the instance could have been removed. I will remove that part.Please @Theoderich if we're missing cases, please tell us.
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.
done into f6fc88c
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.
This is part of the fix for #471 and should not be removed.
The Problem:
When Jenkins tries to start a node and the quotas in the target cloud do not allow it, the instance is not started in the cloud but Jenkins thinks that a node was started. Now there is a Zombie node in Jenkins.
When trying to delete this Zombie node, Jenkins calls
cloud.getClient().terminateInstanceAsync
which throws an Exception since the Instance does not exist in the cloud. The Delete is aborted and the zombie node stays, forever undeletable.The Solution:
I added a check if the node actually exists in the cloud before calling
cloud.getClient().terminateInstanceAsync
. If the node does not exist as an instance in the cloud, there is no need to terminate it and the deletion can proceed.Why not just catch the exception thrown by
cloud.getClient().terminateInstanceAsync
?It is not clear from the exception why the terminate operation failed. If the instance exists in the cloud and the termination failed for some other reason, we do not want to delete the node in Jenkins.
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.
Ok, thanks for the detailed explanation.
I've reverted the changes.
Check warning on line 89 in src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineLinuxLauncher.java
ci.jenkins.io / Code Coverage
Not covered lines
Check warning on line 96 in src/main/java/com/google/jenkins/plugins/computeengine/ComputeEngineWindowsLauncher.java
ci.jenkins.io / Code Coverage
Not covered lines