Skip to content

Adds support for ansible-lint #1129

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

Merged
merged 5 commits into from
Oct 24, 2019
Merged

Adds support for ansible-lint #1129

merged 5 commits into from
Oct 24, 2019

Conversation

asm0dey
Copy link
Contributor

@asm0dey asm0dey commented Sep 29, 2019

Fix #479

@asm0dey asm0dey requested a review from php-coder as a code owner September 29, 2019 21:15
@mystamps-bot
Copy link

mystamps-bot commented Sep 29, 2019

2 Warnings
⚠️ danger check: pull request description doesn’t contain a link to original issue.
Consider adding a comment in the following format: Addressed to #XXX where XXX is an issue number
⚠️ danger check: pull request contains 5 commits while most of the cases it should have only one. If it’s not a special case you should squash the commits into single one.
But be careful because it can destroy all your changes!

Generated by 🚫 Danger

@asm0dey asm0dey changed the title Addresses #435 Adds support for ansible-lint Sep 29, 2019
Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

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

Thank you! I have a couple comments.

@php-coder
Copy link
Owner

Also regarding a commit:

  • a commit message must satisfy https://www.conventionalcommits.org requirements (in this case it might look like ci: verify Ansible roles with ansible-lint)
  • if it's possible it's better to use "Name Surename" as the author's name instead of a nick name

@php-coder
Copy link
Owner

I've fixed the description -- this issues is related to #479 and not to #435 Could you update commit message as well?

@asm0dey
Copy link
Contributor Author

asm0dey commented Sep 29, 2019

Proof of fail due to ansible-lint: https://travis-ci.org/php-coder/mystamps/jobs/591231907

@php-coder
Copy link
Owner

Why the build fails with ./src/main/scripts/ci/check-build-and-verify.sh: line 253: ansible-lint: command not found error at this moment?

@php-coder
Copy link
Owner

Proof of fail due to ansible-lint: https://travis-ci.org/php-coder/mystamps/jobs/591231907

Good to see that it might fail!

Could you suppress this warning to make CI green? It seems like we can add a special comment or something similar -- https://github.com/ansible/ansible-lint#false-positives-skipping-rules

We don't need to fix this issue now as we have a separate issue to deal with it: #998

@php-coder
Copy link
Owner

Could you suppress this warning to make CI green?

Still here and need to be addressed, otherwise we can't merge this as it will break the builds.

@asm0dey
Copy link
Contributor Author

asm0dey commented Oct 20, 2019

I hope I've fixed everything you told me about, please check. After fix into upstream I'm going to fix restic-backups support :)

@@ -98,6 +100,9 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
[ "$AFFECTS_ROBOT_FILES" != 'no' ] || RFLINT_STATUS=skip
[ "$AFFECTS_SHELL_FILES" != 'no' ] || SHELLCHECK_STATUS=skip
fi

test "$AFFECTS_PLAYBOOKS" != "no" || ANSIBLE_LINT_STATUS=skip
Copy link
Owner

Choose a reason for hiding this comment

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

In sake of code consistency:

  • use [ instead of test
  • use single quotes when a string doesn't contain variables


# we can't use service module here because our sudoers allows to execute only exact commands
- name: Stopping service
- name: Stopping service # noqa 301
Copy link
Owner

Choose a reason for hiding this comment

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

The original error was:

301 Commands should not change things if nothing needs doing
src/main/scripts/ci/ansible/deploy.yml:37
Task/Handler: Stopping service

I think that we should add a comment to clearly communicate why we suppress this check. Something like this:

301 check is ignored as we always need to stop the service before deploy.

Actually it's a good question -- do we really need to do this always? Perhaps, we could copy WAR file and use handler for restarting the service. I'm not sure whether it's a good approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm almost sure this refactoring should be performed along with bumping ansible version and using systemd module

@php-coder
Copy link
Owner

Thank you for finding time to update the PR 👍 See my comments.

@php-coder
Copy link
Owner

P.S. Are you sure that you want to use nickname instead of a full name as an author? I don't insist but need to double check that this is what you want. Typically, people use their names (see git shortlog -s -n for example).

@asm0dey
Copy link
Contributor Author

asm0dey commented Oct 20, 2019

@php-coder I definitely prefer to be named by my nickname :)

Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

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

Minor improvements only left. Overall looks good, thank you! 👍

BTW could you also amend the first commit (where you added ansible-lint) and append "Fix #479" line? To keep this relation in git history as well.

@php-coder
Copy link
Owner

@asm0dey I has been thought about merging it as-is now and fix small issue by myself but decided to be with you as pedantic as with others :)

Thank you for patience! I appreciate that!

Should work regardless of
ansible/ansible-lint#457 because `monitorid`
and `apikey` are fields of uptimerobot object, not plain variables
This fix is intended to allow playbook to manually start and stop
mystamps service.

Potentially this is not intended behaviour and should be migrated to
systemd task and handler.

But current behaviour is well-tested and as such should be presereved at
least for now.
After migration to systemd module (and newer ansible) this should be
fixed of course. But currently this is the only supported way to reload
systemd daemon
@php-coder php-coder merged commit 571af15 into php-coder:master Oct 24, 2019
@php-coder
Copy link
Owner

@asm0dey I'm happy to merge it finally! Thank you! 🥇

I've also added you to our hall of fame: https://github.com/php-coder/mystamps/wiki/team-members

@asm0dey
Copy link
Contributor Author

asm0dey commented Oct 24, 2019

@php-coder Yay! Now let's move to restic improvements :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build scripts: add checking by ansible-lint
3 participants