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

Add event handler for custom notice; Add Juju actions #28

Merged
merged 53 commits into from
Feb 3, 2025

Conversation

mvlassis
Copy link
Collaborator

@mvlassis mvlassis commented Jan 16, 2025

Closes #21, #24, #32

This PR adds the event handler for the PebbleCustomNotice event that syncs the Profiles based on the PMR found in the following path: <repository>/<pmr-yaml-path>.

Additionally, the 3 Juju actions sync-now, list-stale-profiles, and delete-stale-profiles have been implemented. They can be called with juju run github-profiles-automator/0 sync-now etc.

Tests

  • 2 unit tests for _get_pmr_from_yaml() have been added. Note that we haven't added any integration tests, since the full functionality of create_or_update_profiles() of the profiles_management library has not been added.
  • 5 integration tests have been added. The test the deployment of the charm, configuring it to change to active, and testing the 3 Juju actions sync-now, list-stale-profiles, and delete-stale-profiles.

Copy link
Contributor

@kimwnasptd kimwnasptd left a comment

Choose a reason for hiding this comment

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

Did a first quick pass, overall looks good, but also want to deploy it and test with the example PMR.

src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
@mvlassis mvlassis force-pushed the kf-6730-charm-implement-sync branch 2 times, most recently from 27ebe9e to 19ff454 Compare January 21, 2025 11:54
@mvlassis
Copy link
Collaborator Author

Note that I am encountering the following issue as well: #38, which fortunately isn't a blockers as the integration tests still pass

Copy link
Contributor

@kimwnasptd kimwnasptd left a comment

Choose a reason for hiding this comment

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

Nice work @mvlassis!

One high level suggestion that I saw is that if we don't have trust in the charm, then it could error on config-changed and the status doesn't align. Let's look into if we could detect if the charm has trust via ops (although I doubt it).

If we can't, then maybe it'll make sense to have have an exception handling for ApiError with 403.

src/charm.py Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
charmcraft.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@DnPlas DnPlas left a comment

Choose a reason for hiding this comment

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

Thanks @mvlassis ! A couple comments.

src/charm.py Outdated Show resolved Hide resolved
src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
@mvlassis mvlassis force-pushed the kf-6730-charm-implement-sync branch from e459734 to f41d16c Compare January 27, 2025 11:09
Copy link
Contributor

@kimwnasptd kimwnasptd left a comment

Choose a reason for hiding this comment

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

Took one more look, @mvlassis @DnPlas really good catch to also update profiles with update-status and config-changed!

Am OK from my side to not go with a component for now. Only a nit on whether we could avoid having multiple similar functions. But if you feel this doesn't add too much value feel free to resolve.

LGTM otherwise!

src/charm.py Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
Copy link
Contributor

@DnPlas DnPlas left a comment

Choose a reason for hiding this comment

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

Thanks @mvlassis, a second round of reviews! Left some comments.

src/charm.py Outdated Show resolved Hide resolved
src/charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/integration/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
tests/unit/test_charm.py Outdated Show resolved Hide resolved
@mvlassis mvlassis force-pushed the kf-6730-charm-implement-sync branch from 172984d to 6fb3513 Compare January 30, 2025 11:02
@mvlassis mvlassis force-pushed the kf-6730-charm-implement-sync branch from 65f4bdb to c8798c6 Compare January 31, 2025 15:17
Copy link
Contributor

@DnPlas DnPlas left a comment

Choose a reason for hiding this comment

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

Thanks @mvlassis ! Just a thing about actions.

src/charm.py Outdated Show resolved Hide resolved
Copy link
Contributor

@DnPlas DnPlas left a comment

Choose a reason for hiding this comment

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

Thanks @mvlassis !

@kimwnasptd kimwnasptd merged commit a9136ee into main Feb 3, 2025
9 checks passed
@kimwnasptd kimwnasptd deleted the kf-6730-charm-implement-sync branch February 3, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Juju actions delete-stale-profiles, list-stale-profiles, and sync-now
3 participants