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

Upgrade kernel on charm upgrade #105

Merged
merged 42 commits into from
Sep 12, 2023
Merged

Upgrade kernel on charm upgrade #105

merged 42 commits into from
Sep 12, 2023

Conversation

yhaliaw
Copy link
Collaborator

@yhaliaw yhaliaw commented Aug 22, 2023

Applicable spec: NA

Overview

Combine the update_dependencies event and the reconcile event.

Update to dependencies and kernel occurs with the reconcile event.

Reboot of the charm is done with juju-reboot command.

Rationale

By combine the update dependencies/kernel with reconcile, the runner spawned should have the latest dependencies and kernel. This should increase the security as the latest version of the dependencies are used.

Juju Events Changes

The update_dependencies custom event is removed.
The reconcile_runners custom event will update the dependencies and kernel as well.

The reconcile_runner_actions will update the dependencies but not the kernel. This is due to juju-reboot is not supported for juju actions:

$ juju help-tool juju-reboot
Usage: juju-reboot [options]

Summary:
Reboot the host machine

Options:
--now  (= false)
    reboot immediately, killing the invoking process

Details:
juju-reboot causes the host machine to reboot, after stopping all containers
	hosted on the machine.

	An invocation without arguments will allow the current hook to complete, and
	will only cause a reboot if the hook completes successfully.

	If the --now flag is passed, the current hook will terminate immediately, and
	be restarted from scratch after reboot. This allows charm authors to write
	hooks that need to reboot more than once in the course of installing software.

	The --now flag cannot terminate a debug-hooks session; hooks using --now should
	be sure to terminate on unexpected errors, so as to guarantee expected behaviour
	in all situations.

	juju-reboot is not supported when running actions.

Checklist

@yhaliaw yhaliaw added the trivial label Sep 6, 2023
@yhaliaw yhaliaw marked this pull request as ready for review September 8, 2023 08:38
@yhaliaw yhaliaw requested a review from a team as a code owner September 8, 2023 08:38
jdkandersson
jdkandersson previously approved these changes Sep 11, 2023
jdkandersson
jdkandersson previously approved these changes Sep 11, 2023
yanksyoon
yanksyoon previously approved these changes Sep 12, 2023
Copy link
Collaborator

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

LGTM, thx!!

src/runner_manager.py Outdated Show resolved Hide resolved
@yhaliaw yhaliaw dismissed stale reviews from yanksyoon and jdkandersson via 3df927d September 12, 2023 03:37
src/runner_manager.py Outdated Show resolved Hide resolved
jdkandersson
jdkandersson previously approved these changes Sep 12, 2023
yanksyoon
yanksyoon previously approved these changes Sep 12, 2023
Copy link
Collaborator

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

LGTM!

@yhaliaw yhaliaw dismissed stale reviews from yanksyoon and jdkandersson via db48389 September 12, 2023 04:19
@github-actions
Copy link
Contributor

Test coverage for db48389

Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
src/charm.py              396     91     93     20    75%   76-78, 104-106, 134-136, 196-204, 216-220, 308-313, 334, 351-357, 366-384, 402-404, 412-415, 422, 425-426, 442, 447-452, 497->500, 513-514, 516-517, 551-558, 582-583, 595-597, 612-613, 638-639, 641-642, 644-645, 712->714, 774-775, 791, 809-811, 815
src/errors.py              23      0      0      0   100%
src/event_timer.py         42      8      4      0    74%   94-97, 117-120
src/firewall.py            43     25     10      0    38%   38-42, 64-67, 75-149
src/github_type.py         36      0      0      0   100%
src/lxd_type.py            37      0      2      0   100%
src/runner.py             259     29     78     22    84%   38->42, 96->98, 192-199, 205-211, 270-275, 280, 300, 349->352, 355-357, 364, 378, 388, 392, 394, 409, 455-460, 470, 559, 594, 620, 625-637, 651, 671
src/runner_manager.py     221     26     88      9    87%   154, 211-213, 226-227, 239-241, 247-252, 256-257, 267-268, 287, 342, 367-371, 390, 408, 551, 571
src/runner_type.py         52      0     12      0   100%
src/utilities.py           68      6     20      8    84%   74->76, 78->84, 89-91, 119, 132, 167, 220
-------------------------------------------------------------------
TOTAL                    1177    185    307     59    82%

Static code analysis report

Run started:2023-09-12 04:21:20.576964

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 2662
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 9

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

@yhaliaw yhaliaw merged commit 90c3da7 into main Sep 12, 2023
27 checks passed
@yhaliaw yhaliaw deleted the feat/upgrade_kernel branch September 12, 2023 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants