diff --git a/cumulus/steps/development/code_build_action.py b/cumulus/steps/development/code_build_action.py index 8848d87..f51cf52 100644 --- a/cumulus/steps/development/code_build_action.py +++ b/cumulus/steps/development/code_build_action.py @@ -29,14 +29,17 @@ def __init__(self, input_artifact_name, stage_name_to_add, environment=None, - vpc_config=None): + vpc_config=None, + buildspec='buildspec.yml'): """ + :type buildspec: basestring path to buildspec.yml or text containing the buildspec. :type input_artifact_name: basestring The artifact name in the pipeline. Must contain a buildspec.yml :type action_name: basestring Displayed on the console :type environment: troposphere.codebuild.Environment Optional if you need ENV vars or a different build. :type vpc_config.Vpc_Config: Only required if the codebuild step requires access to the VPC """ step.Step.__init__(self) + self.buildspec = buildspec self.environment = environment self.input_artifact_name = input_artifact_name self.action_name = action_name @@ -124,7 +127,7 @@ def create_project(self, chain_context, codebuild_role, codebuild_environment, n # Configure vpc if available if self.vpc_config: sg = ec2.SecurityGroup( - "CodebBuild%sSG" % chain_context.instance_name, + "CodebBuild%s%sSG" % (self.stage_name_to_add ,self.action_name), GroupDescription="Gives codebuild access to VPC", VpcId=self.vpc_config.vpc_id, SecurityGroupEgress=[ @@ -144,6 +147,7 @@ def create_project(self, chain_context, codebuild_role, codebuild_environment, n )} project_name = "project%s" % name + project = codebuild.Project( project_name, DependsOn=codebuild_role, @@ -154,6 +158,7 @@ def create_project(self, chain_context, codebuild_role, codebuild_environment, n Source=codebuild.Source( "Deploy", Type='CODEPIPELINE', + BuildSpec=self.buildspec, ), **vpc_config ) diff --git a/cumulus/steps/development/pipeline_source_action.py b/cumulus/steps/development/pipeline_source_action.py index ac06d8c..94e70b9 100644 --- a/cumulus/steps/development/pipeline_source_action.py +++ b/cumulus/steps/development/pipeline_source_action.py @@ -27,7 +27,7 @@ def __init__(self, """ :type s3_object_key: basestring Path of the artifact in the bucket. :type s3_bucket_name: basestring or troposphere.Ref Object of the bucket name. - :type input_artifact_name: basestring The artifact name in the pipeline. Must contain a buildspec.yml + :type input_artifact_name: basestring The artifact name in the pipeline. (contains buildspec.yml. You can override that name in a codebuild action) :type action_name: basestring Displayed on the console :type environment: troposphere.codebuild.Environment Optional if you need ENV vars or a different build. :type vpc_config.Vpc_Config: Only required if the codebuild step requires access to the VPC diff --git a/push_tags_and_master.sh b/push_tags_and_master.sh new file mode 100755 index 0000000..a3368ca --- /dev/null +++ b/push_tags_and_master.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +git push origin --tags +git push origin master + diff --git a/tests/unit/steps/test_pipeline.py b/tests/unit/steps/test_pipeline.py index c327599..b902a7d 100644 --- a/tests/unit/steps/test_pipeline.py +++ b/tests/unit/steps/test_pipeline.py @@ -98,7 +98,7 @@ def test_code_build_should_add_vpc_config(self): 'dummy-subnet1' ] ), - action_name="test-action", + action_name="testAction", stage_name_to_add="thestage", input_artifact_name="test-input" )