From 305dd449050e02165f8af8f1a3bdc1796c862822 Mon Sep 17 00:00:00 2001 From: pmikus Date: Fri, 24 Mar 2023 09:00:53 +0000 Subject: [PATCH] fix(bootstrap): EB deploy Signed-off-by: pmikus Change-Id: I44fd0fd94ba91758cfa37b11cba44955a0b24f72 --- .../bash/entry/bootstrap_aws_eb_version_verify.sh | 2 +- resources/libraries/bash/function/eb_version.sh | 25 +++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh b/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh index c3b82574af..362a2f78af 100755 --- a/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh +++ b/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh @@ -29,4 +29,4 @@ source "${BASH_FUNCTION_DIR}/eb_version.sh" || die "Source failed." source "${BASH_FUNCTION_DIR}/hugo.sh" || die "Source failed." source "${BASH_FUNCTION_DIR}/terraform.sh" || die "Source failed." common_dirs || die -eb_version_verify || die +eb_version_build_verify || die diff --git a/resources/libraries/bash/function/eb_version.sh b/resources/libraries/bash/function/eb_version.sh index 7e1fdc5b6c..0393030065 100644 --- a/resources/libraries/bash/function/eb_version.sh +++ b/resources/libraries/bash/function/eb_version.sh @@ -21,7 +21,7 @@ function die_on_error () { # Source this fragment if you want to abort on any failure. # # Variables read: - # - CODE_EXIT_STATUS - Exit status of report generation. + # - ${CODE_EXIT_STATUS} - Exit status of report generation. # Functions called: # - die - Print to stderr and exit. @@ -41,8 +41,8 @@ function eb_version_deploy () { # - ${CSIT_DIR} - CSIT main directory. # - ${TERRAFORM_OUTPUT_VAL} - Terraform output value. # Variables set: - # - CODE_EXIT_STATUS - Exit status of report generation. - # - TERRAFORM_OUTPUT_VAR - Register Terraform output variable name. + # - ${CODE_EXIT_STATUS} - Exit status of report generation. + # - ${TERRAFORM_OUTPUT_VAR} - Register Terraform output variable name. # Functions called: # - eb_version_verify - Build and verify EB version. # - terraform_apply - Apply EB version by Terraform. @@ -51,7 +51,7 @@ function eb_version_deploy () { set -exuo pipefail - eb_version_verify || die "Failed to call Elastic Beanstalk verify!" + eb_version_build_verify || die "Failed to call Elastic Beanstalk verify!" terraform_apply || die "Failed to call Terraform apply!" TERRAFORM_OUTPUT_VAR="application_version" @@ -63,14 +63,14 @@ function eb_version_deploy () { } -function eb_version_verify () { +function eb_version_build_verify () { # Build and verify Elastic Beanstalk CDash integrity. # # Variable read: # - ${CSIT_DIR} - CSIT main directory. # Variables set: - # - TERRAFORM_MODULE_DIR - Terraform module sub-directory. + # - ${TERRAFORM_MODULE_DIR} - Terraform module sub-directory. # Functions called: # - hugo_init_modules - Initialize Hugo modules. # - hugo_build_site - Build static site with Hugo. @@ -84,6 +84,9 @@ function eb_version_verify () { die "Please install zip!" fi + hugo_init_modules || die "Failed to call Hugo initialize!" + hugo_build_site || die "Failed to call Hugo build!" + pushd "${CSIT_DIR}"/csit.infra.dash || die "Pushd failed!" pushd app || die "Pushd failed!" find . -type d -name "__pycache__" -exec rm -rf "{}" \; @@ -94,11 +97,9 @@ function eb_version_verify () { TERRAFORM_MODULE_DIR="terraform-aws-fdio-csit-dash-app-base" - export TF_VAR_application_version="${BUILD_ID-50}" - hugo_init_modules || die "Failed to call Hugo initialize!" - hugo_build_site || die "Failed to call Hugo build!" - terraform_init || die "Failed to call terraform init!" - terraform_validate || die "Failed to call terraform validate!" + export TF_VAR_application_version="${BUILD_ID}" + terraform_init || die "Failed to call Terraform init!" + terraform_validate || die "Failed to call Terraform validate!" } @@ -110,7 +111,7 @@ function generate_report () { # - ${TOOLS_DIR} - Path to existing resources subdirectory "tools". # - ${GERRIT_BRANCH} - Gerrit branch used for release tagging. # Variables set: - # - CODE_EXIT_STATUS - Exit status of report generation. + # - ${CODE_EXIT_STATUS} - Exit status of report generation. # Functions called: # - die - Print to stderr and exit. -- 2.16.6