File tree Expand file tree Collapse file tree 2 files changed +36
-28
lines changed Expand file tree Collapse file tree 2 files changed +36
-28
lines changed Original file line number Diff line number Diff line change 8
8
- ' quickstarts/**'
9
9
10
10
jobs :
11
- e2e-check :
11
+ e2e-check
12
+ if : github.event.review.state == 'approved' || github.event.review.body == 'approved'
12
13
runs-on : terraform-alicloud-landing
13
14
environment :
14
15
name : acctests
27
28
- name : test pr
28
29
run : |
29
30
bash scripts/terraform-install.sh
30
- echo "cat ~/.aliyun/config.json"
31
- cat ~/.aliyun/config.json
32
- echo "aaa: $ALICLOUD_ACCESS"
33
- echo $ALICLOUD_ACCESS
34
- export ALICLOUD_PROFILE=${{ secrets.PROFILENAME }}
35
- folders="${{ steps.changed-files.outputs.all_changed_files }}"
36
- for f in ${folders//,/ }
37
- do
38
- f=$(echo $f | xargs echo -n)
39
- echo "===> Terraform testing in" $f
40
- terraform -chdir=$f init -upgrade
41
- cp scripts/plan.tftest.hcl $f/
42
- terraform -chdir=$f test test -verbose
43
- if [[ $? -ne 0 ]]; then
44
- echo -e "\033[31m[ERROR]\033[0m: running terraform test for plan failed."
45
- #exit 1
46
- else
47
- rm -rf scripts/plan.tftest.hcl
48
- cp scripts/apply.tftest.hcl $f/
49
- terraform -chdir=$f test test
50
- if [[ $? -ne 0 ]]; then
51
- echo -e "\033[31m[ERROR]\033[0m: running terraform test for apply failed."
52
- #exit 1
53
- fi
54
- rm -rf scripts/apply.tftest.hcl
55
- fi
56
- done
31
+ CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
32
+ bash scripts/terraform-validate.sh ${CHANGED_FOLDERS}
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ error=false
3
+
4
+ success=true
5
+ folders=$1
6
+ for f in ${folders// ,/ }
7
+ do
8
+ f=$( echo $f | xargs echo -n)
9
+ echo " ===> Terraform testing in" $f
10
+ terraform -chdir=$f init -upgrade
11
+ source ~ /.terraform_profile
12
+ cp scripts/plan.tftest.hcl $f /
13
+ terraform -chdir=$f test test -verbose
14
+ if [[ $? -ne 0 ]]; then
15
+ success=false
16
+ echo -e " \033[31m[ERROR]\033[0m: running terraform test for plan failed."
17
+ else
18
+ rm -rf scripts/plan.tftest.hcl
19
+ cp scripts/apply.tftest.hcl $f /
20
+ terraform -chdir=$f test test
21
+ if [[ $? -ne 0 ]]; then
22
+ success=false
23
+ echo -e " \033[31m[ERROR]\033[0m: running terraform test for apply failed."
24
+ fi
25
+ rm -rf scripts/apply.tftest.hcl
26
+ fi
27
+ done
28
+
29
+ if [[ $success ]]; then
30
+ exit 1
31
+ fi
32
+ exit 0
You can’t perform that action at this time.
0 commit comments