You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/30 06:02:36 UTC

[GitHub] [airflow] baolsen opened a new pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

baolsen opened a new pull request #12712:
URL: https://github.com/apache/airflow/pull/12712


   When doing AssumeRoleWithSAML there is an HTTP request made to an IDP endpoint to obtain the SAML Assertion. This PR allows the IDP request to have a configurable Retry, which makes this authentication mechanism a bit more robust.
   
   I'm not sure how to write tests for this.... suggestions welcome.
   
   Tested with my own Airflow environment which uses this auth method, and it is working as intended.
   It's working with and without the new configuration.
   
   closes: 12639


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-866051990


   I reopened this PR. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-738887469


   [The Workflow run](https://github.com/apache/airflow/actions/runs/401040152) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-739856378


   Hey @mik-laj , I think this one is ready for review.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-866061388


   Yes. It is good idea. You can do it. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-866059450


   Thank you @mik-laj. 
   I see it is merging to apache:master, I can't edit it to target apache:main (can only change PR description at this point). 
   Do you think I should rather close this and open a new one with the correct target?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#discussion_r553846178



##########
File path: tests/providers/amazon/aws/hooks/test_base_aws.py
##########
@@ -252,6 +322,78 @@ def import_mock(name, *args):
             [mock.call.get_default_id_token_credentials(target_audience='aws-federation.airflow.apache.org')]
         )
 
+    @unittest.skipIf(mock_sts is None, 'mock_sts package not present')
+    @mock.patch.object(AwsBaseHook, 'get_connection')
+    @mock_sts
+    def test_assume_role_with_saml(self, mock_get_connection):

Review comment:
       The title of this PR uses the word "Retry", but I don't see this word appearing in the tests. Does this code test the same functionality?

##########
File path: tests/providers/amazon/aws/hooks/test_base_aws.py
##########
@@ -252,6 +322,78 @@ def import_mock(name, *args):
             [mock.call.get_default_id_token_credentials(target_audience='aws-federation.airflow.apache.org')]
         )
 
+    @unittest.skipIf(mock_sts is None, 'mock_sts package not present')
+    @mock.patch.object(AwsBaseHook, 'get_connection')
+    @mock_sts
+    def test_assume_role_with_saml(self, mock_get_connection):

Review comment:
       The title of this PR uses the word "Retry", but I don't see this word appearing in this code. Does this code test the same functionality?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-736448257


   Didn't think of that, thanks for the suggestion @mik-laj . Will add something when I can :)
   We are going to take the code through our environments meanwhile, will post results here once done.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-740100593


   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-735662989


   > I'm not sure how to write tests for this.... suggestions welcome.
   
   You can use mock.mock to check if all methods are properly called.
   See example:  https://github.com/apache/airflow/blob/master/tests/providers/amazon/aws/hooks/test_base_aws.py#L179-L253


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-866538863


   Will do, thank you


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-866050818


   Hey @mik-laj , trust all is well that side.
   Could we re-open this PR please? I'll need to do some rebasing etc of course.
   I finally have some capacity to work on Airflow again :) and would like to get some of my issues sorted. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-756656566


   Hey @mik-laj this one is good to merge


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] baolsen commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
baolsen commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-756656566


   Hey @mik-laj this one is good to merge


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on a change in pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#discussion_r553846178



##########
File path: tests/providers/amazon/aws/hooks/test_base_aws.py
##########
@@ -252,6 +322,78 @@ def import_mock(name, *args):
             [mock.call.get_default_id_token_credentials(target_audience='aws-federation.airflow.apache.org')]
         )
 
+    @unittest.skipIf(mock_sts is None, 'mock_sts package not present')
+    @mock.patch.object(AwsBaseHook, 'get_connection')
+    @mock_sts
+    def test_assume_role_with_saml(self, mock_get_connection):

Review comment:
       The title of this PR uses the word "Retry", but I don't see this word appearing in the tests. Does this code test the same functionality?

##########
File path: tests/providers/amazon/aws/hooks/test_base_aws.py
##########
@@ -252,6 +322,78 @@ def import_mock(name, *args):
             [mock.call.get_default_id_token_credentials(target_audience='aws-federation.airflow.apache.org')]
         )
 
+    @unittest.skipIf(mock_sts is None, 'mock_sts package not present')
+    @mock.patch.object(AwsBaseHook, 'get_connection')
+    @mock_sts
+    def test_assume_role_with_saml(self, mock_get_connection):

Review comment:
       The title of this PR uses the word "Retry", but I don't see this word appearing in this code. Does this code test the same functionality?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] closed pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #12712:
URL: https://github.com/apache/airflow/pull/12712


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj edited a comment on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
mik-laj edited a comment on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-735662989


   > I'm not sure how to write tests for this.... suggestions welcome.
   
   You can use mock.mock to check if all methods are properly called.
   See example:  https://github.com/apache/airflow/blob/a697c588c43450a9b69e607b052c17a27bd5ac0e/tests/providers/amazon/aws/hooks/test_base_aws.py#L179-L253


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12712: AWS Hook - allow IDP HTTP retry (#12639)

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12712:
URL: https://github.com/apache/airflow/pull/12712#issuecomment-787209766


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org