Skip to content

Commit 7a6c18a

Browse files
committed
[Test] Make deployment script able to deploy an unreleased version of ParallelCluster API.
Signed-off-by: Giacomo Marciani <mgiacomo@amazon.com>
1 parent 255e1af commit 7a6c18a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

api/infrastructure/deploy-api.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
88
# limitations under the License.
99

10-
usage="$(basename "$0") [-h] --s3-bucket bucket-name --region aws-region [--stack-name name] [--enable-iam-admin true|false] [--create-api-user true|false])"
10+
usage="$(basename "$0") [-h] --s3-bucket bucket-name --region aws-region [--stack-name name] [--enable-iam-admin true|false] [--create-api-user true|false] [--lambda-layer abs_path]"
1111

1212
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1313

1414
S3_BUCKET=
1515
STACK_NAME="ParallelClusterApi"
1616
ENABLE_IAM_ADMIN="true"
1717
CREATE_API_USER="false"
18+
LAMBDA_LAYER=
1819
while [[ $# -gt 0 ]]
1920
do
2021
key="$1"
@@ -59,6 +60,11 @@ case $key in
5960
shift # past argument
6061
shift # past value
6162
;;
63+
--lambda-layer)
64+
export LAMBDA_LAYER=$2
65+
shift # past argument
66+
shift # past value
67+
;;
6268
*) # unknown option
6369
echo "$usage" >&2
6470
exit 1
@@ -71,6 +77,8 @@ if [ -z "${S3_BUCKET}" ] || [ -z "${AWS_DEFAULT_REGION}" ] ; then
7177
exit 1
7278
fi
7379

80+
PC_VERSION=$(yq ".Mappings.ParallelCluster.Constants.Version" "${SCRIPT_DIR}/parallelcluster-api.yaml")
81+
7482
S3_UPLOAD_URI="s3://${S3_BUCKET}/api/ParallelCluster.openapi.yaml"
7583
POLICIES_S3_URI="s3://${S3_BUCKET}/stacks/parallelcluster-policies.yaml"
7684
POLICIES_TEMPLATE_URI="http://${S3_BUCKET}.s3.${AWS_DEFAULT_REGION}.amazonaws.com/stacks/parallelcluster-policies.yaml"
@@ -81,6 +89,12 @@ aws s3 cp "${SCRIPT_DIR}/../spec/openapi/ParallelCluster.openapi.yaml" "${S3_UPL
8189
echo "Publishing policies CloudFormation stack to S3"
8290
aws s3 cp "${SCRIPT_DIR}/../../cloudformation/policies/parallelcluster-policies.yaml" "${POLICIES_S3_URI}"
8391

92+
if [ -n "${LAMBDA_LAYER}" ]; then
93+
LAMBDA_LAYER_S3_URI="s3://${S3_BUCKET}/parallelcluster/${PC_VERSION}/layers/aws-parallelcluster/lambda-layer.zip"
94+
echo "Publishing Lambda Layer for version ${PC_VERSION} to S3"
95+
aws s3 cp "${LAMBDA_LAYER}" "${LAMBDA_LAYER_S3_URI}"
96+
fi
97+
8498
echo "Deploying API template"
8599
aws cloudformation deploy \
86100
--stack-name "${STACK_NAME}" \
@@ -90,4 +104,5 @@ aws cloudformation deploy \
90104
--parameter-overrides ApiDefinitionS3Uri="${S3_UPLOAD_URI}" \
91105
PoliciesTemplateUri="${POLICIES_TEMPLATE_URI}" \
92106
EnableIamAdminAccess="${ENABLE_IAM_ADMIN}" CreateApiUserRole="${CREATE_API_USER}" \
107+
"$([[ -n "${LAMBDA_LAYER}" ]] && echo "CustomBucket=${S3_BUCKET}" || echo " ")" \
93108
--capabilities CAPABILITY_NAMED_IAM

0 commit comments

Comments
 (0)