chore(e2e): Add option for specifying windows format (#5948)
This commit is contained in:
1 parent
7c97bad96f
commit
8a61d8c2cd
1 file changed
+27
-1
@@ -7,7 +7,33 @@ DIR=$(pwd)
|
||||
SCRIPTS_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
|
||||
STATEDIR=$(ls -td $SCRIPTS_DIR/../.enos/*/ | head -1) # get latest directory
|
||||
|
||||
# Default to linux format
|
||||
FORMAT="linux"
|
||||
|
||||
# Parse flag
|
||||
while getopts "f:" opt; do
|
||||
case ${opt} in
|
||||
f)
|
||||
if [[ "$OPTARG" == "linux" || "$OPTARG" == "windows" ]]; then
|
||||
FORMAT="$OPTARG"
|
||||
else
|
||||
echo "Invalid format. Use 'linux' or 'windows'."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [-f linux|windows]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd $STATEDIR
|
||||
terraform show -json terraform.tfstate | jq -r '.values.root_module.child_modules[].resources[] | select(.address=="module.run_e2e_test.enos_local_exec.run_e2e_test") | .values.environment | to_entries[] | select(.value != "") | "export \(.key)=\(.value|@sh)"'
|
||||
|
||||
if [[ "$FORMAT" == "windows" ]]; then
|
||||
terraform show -json terraform.tfstate | jq -r '.values.root_module.child_modules[].resources[] | select(.address=="module.run_e2e_test.enos_local_exec.run_e2e_test") | .values.environment | to_entries[] | select(.value != "") | "$env:\(.key)=\(.value|@sh);"'
|
||||
else
|
||||
terraform show -json terraform.tfstate | jq -r '.values.root_module.child_modules[].resources[] | select(.address=="module.run_e2e_test.enos_local_exec.run_e2e_test") | .values.environment | to_entries[] | select(.value != "") | "export \(.key)=\(.value|@sh);"'
|
||||
fi
|
||||
|
||||
cd $DIR
|
||||
Reference in new issue
Block a user