Skip to content

Commit

Permalink
- Adding support for Ubuntu 18
Browse files Browse the repository at this point in the history
- Began adding BitBucket support to deployments
- Fixed RDS parameter group to allow empty parameters.
  • Loading branch information
gitwater committed Jul 15, 2021
1 parent e2d0820 commit 6239f97
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/paco/application/ec2lm_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@
"object": "amazon-ssm-agent",
"install": "snap install --classic"
},
"ubuntu_18": {
"path": "/debian_amd64",
"object": "amazon-ssm-agent",
"install": "snap install --classic"
},
"ubuntu": {
"path": "/debian_amd64",
"object": "amazon-ssm-agent.deb",
Expand Down
5 changes: 5 additions & 0 deletions src/paco/application/reseng_deploymentpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,11 @@ def init_stage_action_github_source(self, action_config):
if not action_config.is_enabled():
return

def init_stage_action_bitbucket_source(self, action_config):
"Initialize a GitHub.Source action"
if not action_config.is_enabled():
return

def init_stage_action_codecommit_source(self, action_config):
"Initialize an IAM Role for the CodeCommit action"
if not action_config.is_enabled():
Expand Down
3 changes: 3 additions & 0 deletions src/paco/cftemplates/asg.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(
self.init_template('AutoScalingGroup: ' + self.ec2_manager_cache_id)
template = self.template

if self.asg_config.is_enabled() == False:
return

# InstanceAMI Parameter is preserved in disabled templates so it can be smoothly disabled/enabled
if self.asg_config.instance_ami_ignore_changes:
ignore_changes = True
Expand Down
44 changes: 43 additions & 1 deletion src/paco/cftemplates/codepipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import troposphere.events
import troposphere.iam
import troposphere.sns
import troposphere.codestarconnections

ACTION_MAP = {
'CodeBuild.Build': {
Expand Down Expand Up @@ -834,7 +835,48 @@ def create_pipeline_from_sourcebuilddeploy(self, deploy_region):
Name='CodeCommitArtifact'
)
)

elif action.type == 'BitBucket.Source':
deploy_branch_name_param = self.create_cfn_parameter(
param_type='String',
name='BitBucketDeploymentBranchName',
description='The name of the branch where commits will trigger a build.',
value=action.deployment_branch_name,
)
full_repository_id = f'{action.bitbucket_owner}/{action.bitbucket_repository}'
bitbucket_connection_dict = {}
bitbucket_connection_arn_res = troposphere.codestarconnections.Connection(
title="BitbucketConnection",
template=self.template,
ConnectionName="BitbucketConnection",
ProviderType="Bitbucket"
)
bitbucket_source_action = troposphere.codepipeline.Actions(
Name='BitBucket',
ActionTypeId = troposphere.codepipeline.ActionTypeId(
Category = 'Source',
Owner = 'AWS',
Version = '1',
Provider = 'BitBucket'
),
Configuration = {
'ConnectionArn': troposphere.Ref(bitbucket_connection_arn_res),
'FullRepositoryId': full_repository_id,
'BranchName': troposphere.Ref(deploy_branch_name_param)
},
OutputArtifacts = [
troposphere.codepipeline.OutputArtifacts(
Name = 'BitBucketArtifact'
)
],
RunOrder = action.run_order,
#RoleArn = troposphere.Ref(self.codecommit_role_arn_param)
)
source_stage_actions.append(bitbucket_source_action)
self.build_input_artifacts.append(
troposphere.codepipeline.InputArtifacts(
Name='BitBucketArtifact'
)
)
source_stage = troposphere.codepipeline.Stages(
Name="Source",
Actions = source_stage_actions
Expand Down
14 changes: 8 additions & 6 deletions src/paco/cftemplates/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ def __init__(self, stack, paco_ctx):
# Resources
cfn_export_dict = {
'Family': resource.family,
'Parameters': {}
}
if resource.description != None:
cfn_export_dict['Description'] = resource.description
else:
cfn_export_dict['Description'] = troposphere.Ref('AWS::StackName')

for key, value in resource.parameters.items():
cfn_export_dict['Parameters'][key] = value
if resource.parameters and len(resource.parameters.keys()) > 0:
cfn_export_dict['Parameters'] = {}
for key, value in resource.parameters.items():
cfn_export_dict['Parameters'][key] = value

dbparametergroup_resource = troposphere.rds.DBParameterGroup.from_dict(
'DBParameterGroup',
Expand All @@ -56,15 +57,16 @@ def __init__(self, stack, paco_ctx):
# Resources
cfn_export_dict = {
'Family': resource.family,
'Parameters': {}
}
if resource.description != None:
cfn_export_dict['Description'] = resource.description
else:
cfn_export_dict['Description'] = troposphere.Ref('AWS::StackName')

for key, value in resource.parameters.items():
cfn_export_dict['Parameters'][key] = value
if resource.parameters and len(resource.parameters.keys()) > 0:
cfn_export_dict['Parameters'] = {}
for key, value in resource.parameters.items():
cfn_export_dict['Parameters'][key] = value

dbparametergroup_resource = troposphere.rds.DBClusterParameterGroup.from_dict(
'DBClusterParameterGroup',
Expand Down

0 comments on commit 6239f97

Please sign in to comment.