Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Migrate should rerun when integrations are added (for example for optional integrations) #57

Conversation

javierdelapuente
Copy link
Collaborator

@javierdelapuente javierdelapuente commented Oct 9, 2024

Applicable spec:

Overview

Currently, migrations run the first the charm is active, when the charm is refreshed and when the charm is active again after missing integrations are readded.

However, in the case of optional integrations, we want the migration process to run again when an optional integration is added, so the migration script can do whatever is necessary with its integration (for example an optional database to optionally persist data).

As the script for migrations should be idempotent, no issues should arise for calling it extra times.

Rationale

Juju Events Changes

Module Changes

Library Changes

Checklist

Copy link

github-actions bot commented Oct 9, 2024

Test coverage for 1a66377

Name                                            Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------------
paas_app_charmer/__init__.py                       32     17      0      0    47%   13-14, 19-20, 26-27, 33-37, 43-44, 50-51, 57-58
paas_app_charmer/_gunicorn/__init__.py              0      0      0      0   100%
paas_app_charmer/_gunicorn/charm.py                15      0      0      0   100%
paas_app_charmer/_gunicorn/webserver.py            83      4     14      1    95%   175, 187-193
paas_app_charmer/_gunicorn/workload_config.py       8      0      0      0   100%
paas_app_charmer/_gunicorn/wsgi_app.py             16      0      0      0   100%
paas_app_charmer/app.py                           157      0     54      3    99%   110->exit, 167->173, 341->343
paas_app_charmer/charm.py                         242     26     54      3    90%   34-35, 42-43, 205, 215-216, 218-219, 248-252, 316-318, 379-380, 385, 390, 395, 405, 410, 415, 420, 425, 450
paas_app_charmer/charm_state.py                   107      2     12      2    97%   187, 277
paas_app_charmer/charm_utils.py                    23      0      0      0   100%
paas_app_charmer/database_migration.py             35      0      2      0   100%
paas_app_charmer/databases.py                      25      2      6      1    90%   89-90
paas_app_charmer/django/__init__.py                 2      0      0      0   100%
paas_app_charmer/django/charm.py                   44      4      8      2    88%   48, 108, 123-124
paas_app_charmer/exceptions.py                      5      0      0      0   100%
paas_app_charmer/fastapi/__init__.py                2      0      0      0   100%
paas_app_charmer/fastapi/charm.py                  31      0      0      0   100%
paas_app_charmer/flask/__init__.py                  2      0      0      0   100%
paas_app_charmer/flask/charm.py                    26      0      0      0   100%
paas_app_charmer/framework.py                      23      4     12      2    77%   34, 47-49
paas_app_charmer/go/__init__.py                     2      0      0      0   100%
paas_app_charmer/go/charm.py                       28      0      0      0   100%
paas_app_charmer/observability.py                  24      3      4      1    86%   42->46, 73-77
paas_app_charmer/rabbitmq.py                       78      2     22      5    93%   117->exit, 122->exit, 157->exit, 159-160, 181->175
paas_app_charmer/secret_storage.py                 50      2     14      4    91%   55->54, 56->58, 86, 105
paas_app_charmer/utils.py                          44      7     14      5    79%   34, 36, 56-57, 75, 79, 104
-------------------------------------------------------------------------------------------
TOTAL                                            1104     73    216     29    92%

Static code analysis report

Run started:2024-10-09 15:44:23.566024

Test results:
  No issues identified.

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

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):

@javierdelapuente javierdelapuente marked this pull request as ready for review October 9, 2024 15:51
@javierdelapuente javierdelapuente requested a review from a team as a code owner October 9, 2024 15:51
Copy link
Contributor

@jdkandersson jdkandersson 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, perhaps we can clean up the trivyignore file

@javierdelapuente
Copy link
Collaborator Author

javierdelapuente commented Oct 10, 2024

Looks good, perhaps we can clean up the trivyignore file

I will do it in another PR. Unfortunately we cannot clean up that file https://github.com/canonical/paas-app-charmer/actions/runs/11273531157/job/31353429840?pr=58

@javierdelapuente javierdelapuente merged commit 3109a84 into main Oct 11, 2024
95 checks passed
@javierdelapuente javierdelapuente deleted the ISD-2185-paas-charm.-migrate-should-rerun-when-integrations-are-added branch October 11, 2024 11:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants