diff --git a/assets/build_lambda_layer.sh b/assets/build_lambda_layer.sh index a1bb292f..c0273600 100755 --- a/assets/build_lambda_layer.sh +++ b/assets/build_lambda_layer.sh @@ -1,5 +1,5 @@ #!/bin/bash -# This script builids a lambda layer. Outpits relative path of layer zip. +# This script builds a lambda layer. Outputs relative path of layer zip. export CID_VERSION=$(python3 -c "from cid import _version;print(_version.__version__)") rm -rf build diff --git a/assets/publish_lambda_layer.sh b/assets/publish_lambda_layer.sh index 0d24897c..dd6d6e92 100755 --- a/assets/publish_lambda_layer.sh +++ b/assets/publish_lambda_layer.sh @@ -3,6 +3,9 @@ # First build layer layer=$(./assets/build_lambda_layer.sh) +# Source the version +export CID_VERSION=$(python3 -c "from cid import _version;print(_version.__version__)") + # Then publish on s3 export AWS_REGION=us-east-1 @@ -23,7 +26,7 @@ aws cloudformation list-stack-instances \ if [ $? -ne 0 ]; then echo "Error: $output" else - echo "Uploaded successfuly" + echo "Uploaded successfully" fi done @@ -35,6 +38,8 @@ rm -vf ./$layer if aws s3 ls "s3://aws-managed-cost-intelligence-dashboards" >/dev/null 2>&1; then echo "Updating cid-cfn.yml" aws s3 sync ./cfn-templates/ s3://aws-managed-cost-intelligence-dashboards/cfn/ + # Publish additional copy into respective version folder + aws s3 sync ./cfn-templates/ "s3://aws-managed-cost-intelligence-dashboards/cfn/${CID_VERSION}/" echo "Syncing dashboards" aws s3 sync ./dashboards s3://aws-managed-cost-intelligence-dashboards/hub/