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: CI for Decrypt Oracle #558

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 27 additions & 28 deletions decrypt_oracle/.chalice/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
CODEBUILD_IMAGE = "aws/codebuild/standard:5.0"
BUILDSPEC = "decrypt_oracle/.chalice/buildspec.yaml"
GITHUB_REPO = "aws-encryption-sdk-python"
WAITER_CONFIG = dict(Delay=10)
WAITER_CONFIG = {"Delay": 10}
_LOGGER = logging.getLogger("Decrypt Oracle Build Pipeline Deployer")


Expand All @@ -35,7 +35,7 @@ class AllowEverywhere(AWS.Statement):

def __init__(self, *args, **kwargs):
"""Set up override values."""
my_kwargs = dict(Effect=AWS.Allow, Resource=["*"])
my_kwargs = {"Effect": AWS.Allow, "Resource": ["*"]}
my_kwargs.update(kwargs)
super().__init__(*args, **my_kwargs)

Expand Down Expand Up @@ -167,13 +167,13 @@ def _pipeline(
ActionTypeId=codepipeline.ActionTypeId(
Category="Source", Owner="ThirdParty", Version="1", Provider="GitHub"
),
Configuration=dict(
Owner=github_owner,
Repo=GITHUB_REPO,
OAuthToken=Ref(github_access_token),
Branch=github_branch,
PollForSourceChanges=True,
),
Configuration={
"Owner": github_owner,
"Repo": GITHUB_REPO,
"OAuthToken": Ref(github_access_token),
"Branch": github_branch,
"PollForSourceChanges": True,
},
)
],
)
Expand All @@ -191,7 +191,7 @@ def _pipeline(
ActionTypeId=codepipeline.ActionTypeId(
Category="Build", Owner="AWS", Version="1", Provider="CodeBuild"
),
Configuration=dict(ProjectName=Ref(codebuild_builder)),
Configuration={"ProjectName": Ref(codebuild_builder)},
)
],
)
Expand All @@ -200,25 +200,25 @@ def _pipeline(
RunOrder="1",
ActionTypeId=codepipeline.ActionTypeId(Category="Deploy", Owner="AWS", Version="1", Provider="CloudFormation"),
InputArtifacts=[codepipeline.InputArtifacts(Name=_compiled_cfn_template)],
Configuration=dict(
ActionMode="CHANGE_SET_REPLACE",
ChangeSetName=_changeset_name,
RoleArn=GetAtt(cfn_role, "Arn"),
Capabilities="CAPABILITY_IAM",
StackName=_stack_name,
TemplatePath="{}::decrypt_oracle/transformed.yaml".format(_compiled_cfn_template),
),
Configuration={
"ActionMode": "CHANGE_SET_REPLACE",
"ChangeSetName": _changeset_name,
"RoleArn": GetAtt(cfn_role, "Arn"),
"Capabilities": "CAPABILITY_IAM",
"StackName": _stack_name,
"TemplatePath": "{}::decrypt_oracle/transformed.yaml".format(_compiled_cfn_template),
},
)
deploy_changeset = codepipeline.Actions(
Name="Deploy",
RunOrder="2",
ActionTypeId=codepipeline.ActionTypeId(Category="Deploy", Owner="AWS", Version="1", Provider="CloudFormation"),
Configuration=dict(
ActionMode="CHANGE_SET_EXECUTE",
ChangeSetName=_changeset_name,
StackName=_stack_name,
OutputFileName="StackOutputs.json",
),
Configuration={
"ActionMode": "CHANGE_SET_EXECUTE",
"ChangeSetName": _changeset_name,
"StackName": _stack_name,
"OutputFileName": "StackOutputs.json",
},
OutputArtifacts=[codepipeline.OutputArtifacts(Name="AppDeploymentValues")],
)
deploy = codepipeline.Stages(Name="Deploy", Actions=[stage_changeset, deploy_changeset])
Expand Down Expand Up @@ -272,8 +272,7 @@ def _stack_exists(cloudformation) -> bool:
return False
raise

else:
return True
return True


def _update_existing_stack(cloudformation, template: Template, github_token: str) -> None:
Expand All @@ -284,7 +283,7 @@ def _update_existing_stack(cloudformation, template: Template, github_token: str
cloudformation.update_stack(
StackName=PIPELINE_STACK_NAME,
TemplateBody=template.to_json(),
Parameters=[dict(ParameterKey="GithubPersonalToken", ParameterValue=github_token)],
Parameters=[{"ParameterKey": "GithubPersonalToken", "ParameterValue": github_token}],
Capabilities=["CAPABILITY_IAM"],
)
_LOGGER.info("Waiting for stack update to complete...")
Expand All @@ -301,7 +300,7 @@ def _deploy_new_stack(cloudformation, template: Template, github_token: str) ->
cloudformation.create_stack(
StackName=PIPELINE_STACK_NAME,
TemplateBody=template.to_json(),
Parameters=[dict(ParameterKey="GithubPersonalToken", ParameterValue=github_token)],
Parameters=[{"ParameterKey": "GithubPersonalToken", "ParameterValue": github_token}],
Capabilities=["CAPABILITY_IAM"],
)
_LOGGER.info("Waiting for stack to deploy...")
Expand Down
1 change: 0 additions & 1 deletion decrypt_oracle/src/pylintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[MESSAGES CONTROL]
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
disable =
bad-continuation, # we let black handle this
ungrouped-imports, # we let isort handle this
consider-using-f-string # disable until 2022-05-05; 6 months after 3.5 deprecation

Expand Down