Skip to content

Commit 440e1c5

Browse files
committed
Try multiple way to get first line
1 parent 6638bca commit 440e1c5

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

.circleci/config.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ jobs:
3232
echo "Installing tflint..."
3333
install tflint /usr/local/tflint/bin
3434
echo "Configuring tflint..."
35-
which awk
36-
which cut
35+
3736
#awk --help
38-
which head
3937
#head --help
4038
#tail --help
39+
sed --help
4140
which terraform
4241
# head works but with non 0 exit ??
4342
#FAIL terraform version | sed -n '1p;1q'
@@ -52,15 +51,13 @@ jobs:
5251
5352
# FIX: line failing with code 141
5453
tf_ver=$(terraform version | awk 'FNR <= 1' | cut -dv -f2)
55-
echo "Cut: $tf_ver"
56-
tf_ver=$(terraform version | awk 'FNR <= 1' | awk -Fv '{ print $2 }')
57-
echo "Awk: $tf_ver"
5854
echo -e "\tConfig for terraform version: ${tf_ver}"
59-
#if [ -f '.tflint.hcl' ]; then
60-
# sed -i "/terraform_version =/s/\".*\"/\"${tf_ver}\"/" .tflint.hcl
61-
#else
62-
# echo -e "config {\nterraform_version = \"${tf_ver}\"\ndeep_check = true\n}" > .tflint.hcl
63-
#fi
55+
if [ -f '.tflint.hcl' ]; then
56+
sed -i "/terraform_version =/s/\".*\"/\"${tf_ver}\"/" .tflint.hcl
57+
else
58+
echo -e "config {\nterraform_version = \"${tf_ver}\"\ndeep_check = true\n}" > .tflint.hcl
59+
fi
60+
cat .tflint.hcl
6461
- run:
6562
# Not supporting modules from registry ?? v0.5.4
6663
# For now, must ignore in config file

0 commit comments

Comments
 (0)