Skip to content

Commit

Permalink
Merge pull request #42 from cloudera/feature/add_prechecks
Browse files Browse the repository at this point in the history
Feature/add prechecks
  • Loading branch information
Avanish268 authored Dec 30, 2024
2 parents 4638d0d + b4ae925 commit bf30c78
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ClouderaSetup/OnCloud/AWS/build/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.3.0] - 2024-12-30

### Added
- Added a new parameter of datalake_version
- Added a precheck for workshop name length

### Fixed
- Updated the enable_gpu parameter to accept only boolean values


## [2.2.0] - 2024-12-02

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"enabled": true
}
}
{% if enable_gpu %}
{% if enable_gpu | bool %}
, {
"name": "gpu_settings",
"instanceType": "{{ gpu_instance_type }}",
Expand Down
25 changes: 23 additions & 2 deletions ClouderaSetup/OnCloud/AWS/build/entrypoint/hol-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ validating_variables() {
echo "========================================================================================="
exit 1
fi

#workshop_name variable to validate
validate_workshop_name() {
if [[ ! "$workshop_name" =~ ^[a-z0-9-]+$ || ${#workshop_name} -gt 12 ]]; then
echo "Error: workshop_name must be 12 characters or less and consist only of lowercase letters, numbers, and hyphens (-)."
exit 1
fi
}
validate_datalake_version() {
if [[ -z "$datalake_version" || "$datalake_version" == "latest" || "$datalake_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
return 0 # Valid value
else
echo "Error: Valid values for datalake_version are 'latest' or a semantic version (e.g., 7.2.17)."
return 1 # Invalid value
fi
}
validate_workshop_name
validate_datalake_version
}

#--------------------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -257,14 +275,16 @@ validating_variables() {
CDP_GROUP_LIMIT)
cdp_group_limit=$value
;;
DATALAKE_VERSION)
datalake_version=$value
;;
# Can Add more cases if required.
esac
fi
done <"$USER_CONFIG_FILE"

# Call the function with the user-provided config file as an argument
check_config "$USER_CONFIG_FILE"

echo
echo " ------------------------------------------------------------------- "
echo " Validated the Configfile and Verified the Provided Input Parameters "
Expand Down Expand Up @@ -654,7 +674,8 @@ EOF
-var "aws_region=${aws_region}" \
-var "aws_key_pair=${aws_key_pair}" \
-var "deployment_template=${deployment_template}" \
-var "ingress_extra_cidrs_and_ports={cidrs = ["${cdp_cidr}"],ports = [443, 22]}"
-var "ingress_extra_cidrs_and_ports={cidrs = ["${cdp_cidr}"],ports = [443, 22]}" \
-var "datalake_version=${datalake_version}"
cdp_provision_status=$?
if [ $cdp_provision_status -eq 0 ]; then
export ENV_PUBLIC_SUBNETS=$(terraform output -json aws_public_subnet_ids)
Expand Down

0 comments on commit bf30c78

Please sign in to comment.