-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix a logical flaw when deleting a build in the jenkins_build module #5514
Fix a logical flaw when deleting a build in the jenkins_build module #5514
Conversation
Co-authored-by: Felix Fontein <[email protected]>
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
This comment was marked as outdated.
This comment was marked as outdated.
Backport to stable-5: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 7610501 on top of patchback/backports/stable-5/7610501c66a704214091aa0ba89065a53719f9cd/pr-5514 Backporting merged PR #5514 into main
🤖 @patchback |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #5531 🤖 @patchback |
@unnecessary-username thanks a lot for your contribution! |
…5514) * Fix the logical flaw when deleting a build in the jenkins_build module. * Fix the logical flaw when deleting a Jenkins build in the jenkins_build module. * Adding changelogs. * Update tests/unit/plugins/modules/test_jenkins_build.py Co-authored-by: Felix Fontein <[email protected]> * Attempt to mock the exception classes. * Remedy the CI issues when mocking the exception classes. * Assuming a way to mock the get_build_status function. * Near to the feasible approach. * Calls the correct class when unit testing. * Fix sending wrong arguments when unit testing. * Directly assign the argument value in the unit testing. * Fix errors calling different classes. Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 7610501)
…5514) (#5531) * Fix the logical flaw when deleting a build in the jenkins_build module. * Fix the logical flaw when deleting a Jenkins build in the jenkins_build module. * Adding changelogs. * Update tests/unit/plugins/modules/test_jenkins_build.py Co-authored-by: Felix Fontein <[email protected]> * Attempt to mock the exception classes. * Remedy the CI issues when mocking the exception classes. * Assuming a way to mock the get_build_status function. * Near to the feasible approach. * Calls the correct class when unit testing. * Fix sending wrong arguments when unit testing. * Directly assign the argument value in the unit testing. * Fix errors calling different classes. Co-authored-by: Felix Fontein <[email protected]> (cherry picked from commit 7610501) Co-authored-by: Tong He <[email protected]>
SUMMARY
At present, after deleting a Jenkins build, the code tries to get the build status of the Jenkins build then judge the success/failure of the deletion. When the Jenkins build is successfully deleted, supposedly Jenkins will throw a jenkins.JenkinsException when fetching the build status, but currently the get_build_status() function will catch the exception then directly return a failure json which is a logical flaw.
Considering that deleting an already non-existent build can throw exceptions in the absent_build() function, I plan to adjust the judging logic in the get_build_status() and the get_result() function to fix this logical flaw in identifying the result of deleting an existing Jenkins build.
ISSUE TYPE
COMPONENT NAME
jenkins_build
ADDITIONAL INFORMATION