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

Fix the homebrew module failing because of warnings #8406

Merged

Conversation

kustodian
Copy link
Contributor

@kustodian kustodian commented May 22, 2024

Instead of checking if there is an error message, which can also be a warning, we now check the return code.

This commit fixes #8229 #7044

SUMMARY

Fixes #8229
Fixes #7044

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

homebrew

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review labels May 22, 2024
@kustodian kustodian force-pushed the fix-homebrew-cask-warning branch from 5e0a60c to bc4c8e6 Compare May 22, 2024 20:30
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch labels May 22, 2024
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.

Thanks for your contribution! Please add a changelog fragment. Thanks!

@ansibullbot ansibullbot added has_issue needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels May 22, 2024
@kustodian
Copy link
Contributor Author

kustodian commented May 22, 2024

Please note that the tests fail in https://github.com/ansible-collections/community.general/blob/main/tests/integration/targets/homebrew/tasks/docker.yml#L27

It's probably best to simply remove the whole block https://github.com/ansible-collections/community.general/blob/main/tests/integration/targets/homebrew/tasks/docker.yml#L15-L27.

CC @kitizz

You're right. That test now doesn't make any sense. And probably the whole force_formula parameter is more or less not needed now because by default brew will install formulae.

I also added the changelog fragment. Forgot to commit it the first time...

@kustodian kustodian force-pushed the fix-homebrew-cask-warning branch 3 times, most recently from 85d5d6a to d77ad2e Compare May 22, 2024 21:02
@felixfontein
Copy link
Collaborator

And probably the whole force_formula parameter is more or less not needed now because by default brew will install formulae.

I think it's still good to have it, so you can ensure that it won't fall back to casks if a formula of that name does not exist. Also it's probably a good idea to change the default for that option at some point, so that this module will only install formulas, and homebrew_cask only casks.

@kustodian kustodian force-pushed the fix-homebrew-cask-warning branch from d77ad2e to 2196dbf Compare May 22, 2024 21:07
Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes ansible-collections#8229 ansible-collections#7044
@kustodian kustodian force-pushed the fix-homebrew-cask-warning branch from 2196dbf to 0abb8c6 Compare May 22, 2024 21:11
@kustodian
Copy link
Contributor Author

And probably the whole force_formula parameter is more or less not needed now because by default brew will install formulae.

I think it's still good to have it, so you can ensure that it won't fall back to casks if a formula of that name does not exist. Also it's probably a good idea to change the default for that option at some point, so that this module will only install formulas, and homebrew_cask only casks.

So the general direction is to use this module for installing formulae and the homebrew_cask for installing casks? I kind of liked it that I can use the same module to install everything. If you pass homebrew/cask/<pkg_name> it installs cask, otherwise it's a formula.

@ansibullbot ansibullbot added integration tests/integration tests tests and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR small_patch Hopefully easy to review labels May 22, 2024
@felixfontein
Copy link
Collaborator

To be honest, I'm not sure. It sounded to me like more folks argumented for that than for using the same module for everything. But I'm not actively monitoring this module and the discussions about it (I don't even use it), so 🤷

@felixfontein
Copy link
Collaborator

In any case, I plan to merge this latest on Monday so it makes it into 9.0.1 for Ansible's 10.0.0rc1.

@kustodian
Copy link
Contributor Author

kustodian commented May 25, 2024 via email

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label May 26, 2024
@felixfontein felixfontein merged commit 43cb5a0 into ansible-collections:main May 26, 2024
132 checks passed
Copy link

patchback bot commented May 26, 2024

Backport to stable-8: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 43cb5a0 on top of patchback/backports/stable-8/43cb5a0d54856f1f09026e476a5b8ee03b44cf0b/pr-8406

Backporting merged PR #8406 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible-collections/community.general.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-8/43cb5a0d54856f1f09026e476a5b8ee03b44cf0b/pr-8406 upstream/stable-8
  4. Now, cherry-pick PR Fix the homebrew module failing because of warnings #8406 contents into that branch:
    $ git cherry-pick -x 43cb5a0d54856f1f09026e476a5b8ee03b44cf0b
    If it'll yell at you with something like fatal: Commit 43cb5a0d54856f1f09026e476a5b8ee03b44cf0b is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 43cb5a0d54856f1f09026e476a5b8ee03b44cf0b
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix the homebrew module failing because of warnings #8406 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-8/43cb5a0d54856f1f09026e476a5b8ee03b44cf0b/pr-8406
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

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

Copy link

patchback bot commented May 26, 2024

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/43cb5a0d54856f1f09026e476a5b8ee03b44cf0b/pr-8406

Backported as #8425

🤖 @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 May 26, 2024
Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes #8229 #7044

Co-authored-by: Strahinja Kustudic <[email protected]>
(cherry picked from commit 43cb5a0)
@felixfontein
Copy link
Collaborator

@kustodian thanks for fixing this!

felixfontein pushed a commit that referenced this pull request May 26, 2024
…g because of warnings (#8425)

Fix the homebrew module failing because of warnings (#8406)

Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes #8229 #7044

Co-authored-by: Strahinja Kustudic <[email protected]>
(cherry picked from commit 43cb5a0)

Co-authored-by: Strahinja Kustudic <[email protected]>
@Israphel
Copy link

will 9.x include the fix?

@felixfontein
Copy link
Collaborator

9.0.1 (to be released later today) will include it.

@Israphel
Copy link

9.0.1 (to be released later today) will include it.

9.6.1 ?

felixfontein pushed a commit to felixfontein/community.general that referenced this pull request May 27, 2024
…ons#8406)

Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes ansible-collections#8229 ansible-collections#7044

Co-authored-by: Strahinja Kustudic <[email protected]>
(cherry picked from commit 43cb5a0)
@felixfontein
Copy link
Collaborator

community.general 9.0.1 just got released.

You seem to refer to Ansible version numbers. Ansible 9.x.y includes community.general 8.x.y; the next Ansible 9 release is 9.7.0, which would include the next community.general 8.6.y bugfix release (very likely 8.6.2). Right now this bugfix hasn't been backported to the stable-8 branch (the automatic backporting didn't work: #8406 (comment)). I'll try to manually backport it so it will get included, the conflict likely comes from tests.

@Israphel
Copy link

community.general 9.0.1 just got released.

You seem to refer to Ansible version numbers. Ansible 9.x.y includes community.general 8.x.y; the next Ansible 9 release is 9.7.0, which would include the next community.general 8.6.y bugfix release (very likely 8.6.2). Right now this bugfix hasn't been backported to the stable-8 branch (the automatic backporting didn't work: #8406 (comment)). I'll try to manually backport it so it will get included, the conflict likely comes from tests.

I see, yes I was talking about ansible itself. So 9.7.0 is the candidate to include the fix, got it.

felixfontein added a commit that referenced this pull request Jun 1, 2024
#8429)

Fix the homebrew module failing because of warnings (#8406)

Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes #8229 #7044

Co-authored-by: Strahinja Kustudic <[email protected]>
(cherry picked from commit 43cb5a0)

Co-authored-by: Strahinja Kustudic <[email protected]>
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
…ons#8406)

Instead of checking if there is an error message, which can also be a
warning, we now check the return code.

This commit fixes ansible-collections#8229 ansible-collections#7044

Co-authored-by: Strahinja Kustudic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch backport-9 Automatically create a backport for the stable-9 branch bug This issue/PR relates to a bug has_issue integration tests/integration module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

homebrew: reports failure when installing "emacs" formula homebrew module: task fails on warning message
4 participants