X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fbash%2Ffunction%2Feb_version.sh;fp=resources%2Flibraries%2Fbash%2Ffunction%2Feb_version.sh;h=0393030065845a811f7b792c5b509283c4c1e8df;hp=7e1fdc5b6c2ea5f56d8d08e5e1877c1b768038b7;hb=305dd449050e02165f8af8f1a3bdc1796c862822;hpb=66a7420c2fb86543e16640cbeee04b4652dd9b27 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.