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

Improvements to the jenkins_build module and new jenkins_build_info module #7204

Merged
merged 16 commits into from
Sep 10, 2023
Merged

Improvements to the jenkins_build module and new jenkins_build_info module #7204

merged 16 commits into from
Sep 10, 2023

Conversation

juanmcasanova
Copy link
Contributor

SUMMARY

Note: This PR actually includes three separate changes, if you prefer to have them in separate PRs just ask!

Due to some special requirements on our part, we needed (and added) the following:

  • New option "detach" for the "jenkins_build" module, which allows the module to exit successfully as long as the build is created (default functionality is still waiting for the build to end before exiting).
  • New option "time_between_checks" for the "jenkins_build" module, which allows to configure the wait time between requests to the Jenkins server (this value has to be higher that the quiet time for the Jenkins job, so if it was higher than 10 it will always fail).
  • New module "jenkins_build_info" to get information about a specific Jenkins build (or the last one of a job).

Tested with Jenkins 2.235.5 and 2.401.3.

ISSUE TYPE
  • Feature Pull Request
  • New Module/Plugin Pull Request
COMPONENT NAME

jenkins_build and jenkins_build_info

ADDITIONAL INFORMATION

For a bit of context, we are dealing with an external Jenkins server that randomly fails. This means that due to how the jenkins_build module works we were getting random errors on our Ansible playbook (although the Jenkins build would actually continue).

With these changes we are able to craft a playbook that, even if the server returns an error sometimes, is able to retry and actually check if the build kept going.

@juanmcasanova juanmcasanova marked this pull request as draft September 5, 2023 07:35
@juanmcasanova juanmcasanova marked this pull request as ready for review September 5, 2023 07:47
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit labels Sep 5, 2023
@juanmcasanova juanmcasanova marked this pull request as draft September 5, 2023 07:54
@ansibullbot
Copy link
Collaborator

The test botmeta failed with 3 errors:

.github/BOTMETA.yml:0:0: Author juanmcasanova not mentioned as active or inactive maintainer for plugins/modules/jenkins_build.py (mentioned are: brettmilford, unnecessary-username)
.github/BOTMETA.yml:0:0: Author juanmcasanova not mentioned as active or inactive maintainer for plugins/modules/jenkins_build_info.py (mentioned are: )
.github/BOTMETA.yml:0:0: No (active or inactive) maintainer mentioned for plugins/modules/jenkins_build_info.py

click here for bot help

@ansibullbot ansibullbot added the WIP Work in progress label Sep 5, 2023
@juanmcasanova juanmcasanova marked this pull request as ready for review September 5, 2023 08:16
Doesn't really make sense to test that with a mock
@juanmcasanova
Copy link
Contributor Author

juanmcasanova commented Sep 5, 2023

I don't really know why botmeta thinks I'm not a maintainer in any of the files, I added myself in both. Am I doing something wrong?

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed WIP Work in progress labels Sep 5, 2023
@felixfontein
Copy link
Collaborator

You added yourself to the authors list, but not to the maintainers list: the maintainer list for jenkins_build is here: https://github.com/ansible-collections/community.general/blob/main/.github/BOTMETA.yml#L672. You need to add new entries for the new modules there as well (also see https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md#creating-new-modules-or-plugins).

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 Automatically create a backport for the stable-7 branch labels Sep 5, 2023
@ansibullbot ansibullbot removed the ci_verified Push fixes to PR branch to re-run CI label Sep 6, 2023
@juanmcasanova
Copy link
Contributor Author

juanmcasanova commented Sep 6, 2023

Done, sorry I missed that @felixfontein.

Let me know if you need something else from me to merge this!

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Sep 6, 2023
plugins/modules/jenkins_build.py Show resolved Hide resolved
plugins/modules/jenkins_build.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_build.py Show resolved Hide resolved
plugins/modules/jenkins_build.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_build_info.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_build_info.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_build_info.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_build_info.py Outdated Show resolved Hide resolved
plugins/modules/jenkins_job_info.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

Looks good to me. If nobody objects, I'll merge this at the beginning of next week.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Sep 10, 2023
@felixfontein felixfontein merged commit afeeb89 into ansible-collections:main Sep 10, 2023
145 checks passed
@patchback
Copy link

patchback bot commented Sep 10, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/afeeb89af6ad977ea16606f37b915e5b35ef0a7a/pr-7204

Backported as #7234

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Sep 10, 2023
…odule (#7204)

* Add detach option so the task doesn't wait until the Jenkins job is finished

* Add new time_between_checks to be able to configure the sleep time between requests

* New jenkins_build_info to get information about a specific build

* Add version_added to the new module

* Add changelog fragment for jenkins_build changes

* Fix tests that required the python-jenkins module

* Remove tests that failed

Doesn't really make sense to test that with a mock

* Fix pep8 error

* Update maintainers for the jenkins_build and jenkins_build_info modules

* Improve format and add link to PR

* Move version_added documentation to the right file

* Fix incorrect examples

* Improve text format

* Fix incorrect code style

* Fix incorrect YAML for documentation

* Add version_added documentation to the new options

(cherry picked from commit afeeb89)
@felixfontein
Copy link
Collaborator

@juanmcasanova thanks for your contribution!

felixfontein pushed a commit that referenced this pull request Sep 11, 2023
…ild module and new jenkins_build_info module (#7234)

Improvements to the jenkins_build module and new jenkins_build_info module (#7204)

* Add detach option so the task doesn't wait until the Jenkins job is finished

* Add new time_between_checks to be able to configure the sleep time between requests

* New jenkins_build_info to get information about a specific build

* Add version_added to the new module

* Add changelog fragment for jenkins_build changes

* Fix tests that required the python-jenkins module

* Remove tests that failed

Doesn't really make sense to test that with a mock

* Fix pep8 error

* Update maintainers for the jenkins_build and jenkins_build_info modules

* Improve format and add link to PR

* Move version_added documentation to the right file

* Fix incorrect examples

* Improve text format

* Fix incorrect code style

* Fix incorrect YAML for documentation

* Add version_added documentation to the new options

(cherry picked from commit afeeb89)

Co-authored-by: Juan Manuel Casanova González <juan.casanova.922@gmail.com>
etrombly pushed a commit to etrombly/community.general that referenced this pull request Oct 25, 2023
…odule (ansible-collections#7204)

* Add detach option so the task doesn't wait until the Jenkins job is finished

* Add new time_between_checks to be able to configure the sleep time between requests

* New jenkins_build_info to get information about a specific build

* Add version_added to the new module

* Add changelog fragment for jenkins_build changes

* Fix tests that required the python-jenkins module

* Remove tests that failed

Doesn't really make sense to test that with a mock

* Fix pep8 error

* Update maintainers for the jenkins_build and jenkins_build_info modules

* Improve format and add link to PR

* Move version_added documentation to the right file

* Fix incorrect examples

* Improve text format

* Fix incorrect code style

* Fix incorrect YAML for documentation

* Add version_added documentation to the new options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7 Automatically create a backport for the stable-7 branch feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants