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 trigger kwarg encryption migration #39246

Merged

Conversation

jedcunningham
Copy link
Member

Closes: #38836
Alternative to #38876

Do the encryption in the migration itself, and fix support for offline migrations as well.

The offline up migration won't actually encrypt the trigger kwargs as there isn't a safe way to accomplish that, so the decryption processes checks and short circuits if it isn't encrypted.

The offline down migration will now print out a warning that the offline migration will fail if there are any running triggers. I think this is the best we can do for that scenario (and folks willing to do offline migrations will hopefully be able to understand the situation).

This also solves the "encrypting the already encrypted kwargs" bug in 2.9.0.

airflow/models/trigger.py Show resolved Hide resolved
airflow/models/trigger.py Show resolved Hide resolved
tests/models/test_trigger.py Outdated Show resolved Hide resolved
tests/models/test_trigger.py Outdated Show resolved Hide resolved
@Lee-W Lee-W force-pushed the fix_trigger_encryption_migration branch from ae7f1f4 to 466fda0 Compare April 25, 2024 07:20
jedcunningham and others added 4 commits April 25, 2024 15:21
Do the encryption in the migration itself, and fix support for offline
migrations as well.

The offline up migration won't actually encrypt the trigger kwargs as there
isn't a safe way to accomplish that, so the decryption processes checks
and short circuits if it isn't encrypted.

The offline down migration will now print out a warning that the offline
migration will fail if there are any running triggers. I think this is
the best we can do for that scenario (and folks willing to do offline
migrations will hopefully be able to understand the situation).

This also solves the "encrypting the already encrypted kwargs" bug in
2.9.0.
@Lee-W Lee-W force-pushed the fix_trigger_encryption_migration branch from 466fda0 to f2fd7a8 Compare April 25, 2024 07:21
@jedcunningham
Copy link
Member Author

We've tested the matrix of postges/mysql/sqlite and online/offline migrations. Didn't find any issues 👍.

I think this should be good. I'd like to get 1 more approval on this before we merge it though.

@jedcunningham jedcunningham merged commit adeb7f7 into apache:main Apr 25, 2024
42 checks passed
@jedcunningham jedcunningham deleted the fix_trigger_encryption_migration branch April 25, 2024 19:20
jedcunningham added a commit that referenced this pull request Apr 26, 2024
Do the encryption in the migration itself, and fix support for offline
migrations as well.

The offline up migration won't actually encrypt the trigger kwargs as there
isn't a safe way to accomplish that, so the decryption processes checks
and short circuits if it isn't encrypted.

The offline down migration will now print out a warning that the offline
migration will fail if there are any running triggers. I think this is
the best we can do for that scenario (and folks willing to do offline
migrations will hopefully be able to understand the situation).

This also solves the "encrypting the already encrypted kwargs" bug in
2.9.0.

(cherry picked from commit adeb7f7)
RodrigoGanancia pushed a commit to RodrigoGanancia/airflow that referenced this pull request May 10, 2024
Do the encryption in the migration itself, and fix support for offline
migrations as well.

The offline up migration won't actually encrypt the trigger kwargs as there
isn't a safe way to accomplish that, so the decryption processes checks
and short circuits if it isn't encrypted.

The offline down migration will now print out a warning that the offline
migration will fail if there are any running triggers. I think this is
the best we can do for that scenario (and folks willing to do offline
migrations will hopefully be able to understand the situation).

This also solves the "encrypting the already encrypted kwargs" bug in
2.9.0.
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.

DB migrate throws na error on encrypt_trigger_kwargs
4 participants