Skip to content

Commit

Permalink
Fix artifactory default aws (#239)
Browse files Browse the repository at this point in the history
* Fix aws default profile call in artifactory auth.

* Remove file committed by mistake.
  • Loading branch information
jagmoreira authored Jun 21, 2023
1 parent ca531cd commit c429970
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ Documenting All Changes to the Skelebot Project

---

## v1.36.1
#### Changed
- **Artifactory** | Using the default aws profile should pass `None` to boto3 Session.

---

## v1.36.0
#### Merged: 2023-06-20
#### Released: 2023-06-20
#### Changed
- **Artifactory** | Added support for token and api key methods of Artifactory authentication. Also added support to read authentication credentials from AWS Secrets Manager.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.36.0
1.36.1
2 changes: 1 addition & 1 deletion skelebot/components/repository/artifactoryRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Auth(SkeleYaml):
awsProfile = None
awsRegion = None

def __init__(self, authType="user_pass", aws=False, awsSecret="Artifactory", awsProfile="default",
def __init__(self, authType="user_pass", aws=False, awsSecret="Artifactory", awsProfile=None,
awsRegion="us-east-1"):
"""Instantiate the Auth Class Object based on the provided parameters"""
self.authType = authType
Expand Down
16 changes: 16 additions & 0 deletions test/test_components_repository_artifactoryRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ def test_load_aws_credentials(self, mock_boto3_session):
mock_session.client.assert_called_with(service_name="secretsmanager", region_name="baz")
mock_boto3_session.assert_called_with(profile_name="bar")

@mock.patch('boto3.Session')
def test_load_aws_default_credentials(self, mock_boto3_session):
mock_client = mock.Mock()
mock_session = mock.Mock()
mock_boto3_session.return_value = mock_session
mock_session.client.return_value = mock_client
mock_client.get_secret_value.return_value = {"SecretString": '{"a": 1}'}

auth = sb.components.repository.artifactoryRepo.Auth(aws=True)
actual_creds = auth.loadAwsCredentials()

assert actual_creds == {"a": 1}
mock_client.get_secret_value.assert_called_with(SecretId="Artifactory")
mock_session.client.assert_called_with(service_name="secretsmanager", region_name="us-east-1")
mock_boto3_session.assert_called_with(profile_name=None)

@mock.patch('boto3.Session')
def test_get_credentials_aws_user_pass(self, mock_boto3_session):
mock_client = mock.Mock()
Expand Down

0 comments on commit c429970

Please sign in to comment.