From 2d7377f75be9803a1bb30e0e57d97312c20a3db3 Mon Sep 17 00:00:00 2001 From: malachi-constant Date: Mon, 6 Nov 2023 09:56:14 -0800 Subject: [PATCH 1/2] updating templates with params --- .github/workflows/gh-sync-cc.yaml | 1 + deployment/build-s3-dist.sh | 14 ++++++++------ ...intelligence-with-rosbag-on-aws-create.template | 9 ++++++++- ...intelligence-with-rosbag-on-aws-delete.template | 9 ++++++++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/workflows/gh-sync-cc.yaml b/.github/workflows/gh-sync-cc.yaml index 23730903..854d8dfa 100644 --- a/.github/workflows/gh-sync-cc.yaml +++ b/.github/workflows/gh-sync-cc.yaml @@ -60,6 +60,7 @@ jobs: cp CHANGELOG.md scene-intelligence-with-rosbag-on-aws/ cp .viperlightignore scene-intelligence-with-rosbag-on-aws/ cp .bandit scene-intelligence-with-rosbag-on-aws/ + cp -r .github scene-intelligence-with-rosbag-on-aws/ cp scene-intelligence-with-rosbag-on-aws-create.template deployment/ cp scene-intelligence-with-rosbag-on-aws-delete.template deployment/ diff --git a/deployment/build-s3-dist.sh b/deployment/build-s3-dist.sh index ae07beab..3b2eff9d 100644 --- a/deployment/build-s3-dist.sh +++ b/deployment/build-s3-dist.sh @@ -27,6 +27,8 @@ echo "Staring to build distribution" # export deployment_dir=`pwd` # export dist_dir="$deployment_dir" export dist_dir="deployment" +export create_template="deployment/scene-intelligence-with-rosbag-on-aws-create.template" +export delete_template="deployment/scene-intelligence-with-rosbag-on-aws-delete.template" template_dist_dir="$dist_dir/global-s3-assets" opensrc_dist_dir="$dist_dir/open-source" build_dist_dir="$dist_dir/regional-s3-assets" @@ -55,13 +57,13 @@ echo "In deployment folder" pwd echo "Replacing solution bucket in the template" -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-create.template" $template_dist_dir -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-delete.template" $template_dist_dir +cp -f $create_template $template_dist_dir +cp -f $delete_template $template_dist_dir echo "Placeholder: Pushing single click CFN stack into build_dist_dir to make it non-empty. Empty dirs are being ignored in Codepipeline and failing to execute the deployAssets stage" -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-create.template" $build_dist_dir -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-delete.template" $build_dist_dir +cp -f $create_template $build_dist_dir +cp -f $delete_template $build_dist_dir echo "Placeholder: Pushing single click CFN stack into opensrc_dist_dir to make it non-empty. Empty dirs are being ignored in Codepipeline and failing to execute the deployAssets stage" -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-create.template" $opensrc_dist_dir -cp -f "deployment/scene-intelligence-with-rosbag-on-aws-delete.template" $opensrc_dist_dir +cp -f $create_template $opensrc_dist_dir +cp -f $delete_template $opensrc_dist_dir diff --git a/deployment/scene-intelligence-with-rosbag-on-aws-create.template b/deployment/scene-intelligence-with-rosbag-on-aws-create.template index dea0217b..37dcb311 100644 --- a/deployment/scene-intelligence-with-rosbag-on-aws-create.template +++ b/deployment/scene-intelligence-with-rosbag-on-aws-create.template @@ -1,5 +1,10 @@ AWSTemplateFormatVersion: 2010-09-09 Description: (SO0279) Creates Scene Intelligence with Rosbag on AWS. Version v1.0.0 +Parameters: + SolutionVersion: + Type: String + Default: v1.0.0 + Description: Solution Version. Should reference version tag e.g v1.0.0 Resources: CodeBuildRole: Type: AWS::IAM::Role @@ -253,6 +258,8 @@ Resources: Value: !Sub '${AWS::Region}' - Name: ROLE_ARN Value: !Sub '${CodeBuildRole.Arn}' + - NAME: SOLUTION_VERSION + Value: !Ref SolutionVersion - Name: url_path Value: 'placeholder' - Name: url_query @@ -285,7 +292,7 @@ Resources: commands: - echo Build started on `date` - echo 'Cloning ADDF repo...' - - git clone -b scene-intelligence-with-rosbag-on-aws https://github.com/awslabs/autonomous-driving-data-framework.git + - git clone -b ${SOLUTION_VERSION} https://github.com/awslabs/autonomous-driving-data-framework.git - echo 'Cloning complete' - cd autonomous-driving-data-framework/ - echo 'Installing dependencies...' diff --git a/deployment/scene-intelligence-with-rosbag-on-aws-delete.template b/deployment/scene-intelligence-with-rosbag-on-aws-delete.template index 9c6e9f15..dcdf8404 100644 --- a/deployment/scene-intelligence-with-rosbag-on-aws-delete.template +++ b/deployment/scene-intelligence-with-rosbag-on-aws-delete.template @@ -1,5 +1,10 @@ AWSTemplateFormatVersion: 2010-09-09 Description: (SO0279-D) Deletes Scene Intelligence with Rosbag on AWS. Version v1.0.0 +Parameters: + SolutionVersion: + Type: String + Default: v1.0.0 + Description: Solution Version. Should reference version tag e.g v1.0.0 Resources: CodeBuildRole: Type: AWS::IAM::Role @@ -253,6 +258,8 @@ Resources: Value: !Sub '${AWS::Region}' - Name: ROLE_ARN Value: !Sub '${CodeBuildRole.Arn}' + - NAME: SOLUTION_VERSION + Value: !Ref SolutionVersion - Name: url_path Value: 'placeholder' - Name: url_query @@ -284,7 +291,7 @@ Resources: commands: - echo Build started on `date` - echo 'Cloning ADDF repo...' - - git clone -b scene-intelligence-with-rosbag-on-aws https://github.com/awslabs/autonomous-driving-data-framework.git + - git clone -b ${SOLUTION_VERSION} https://github.com/awslabs/autonomous-driving-data-framework.git - echo 'Cloning complete' - cd autonomous-driving-data-framework/ - echo 'Installing dependencies...' From f6456b2251e37784a0317e9de834418e70366e27 Mon Sep 17 00:00:00 2001 From: malachi-constant Date: Mon, 6 Nov 2023 09:58:23 -0800 Subject: [PATCH 2/2] updating workflow --- .github/workflows/gh-sync-cc.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gh-sync-cc.yaml b/.github/workflows/gh-sync-cc.yaml index 854d8dfa..ac9c7d1b 100644 --- a/.github/workflows/gh-sync-cc.yaml +++ b/.github/workflows/gh-sync-cc.yaml @@ -62,8 +62,7 @@ jobs: cp .bandit scene-intelligence-with-rosbag-on-aws/ cp -r .github scene-intelligence-with-rosbag-on-aws/ - cp scene-intelligence-with-rosbag-on-aws-create.template deployment/ - cp scene-intelligence-with-rosbag-on-aws-delete.template deployment/ + cp -R deployment scene-intelligence-with-rosbag-on-aws/ cd scene-intelligence-with-rosbag-on-aws/ git config --global user.email "${{github.actor}}@users.noreply.github.com"