This repository has been archived by the owner on Oct 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
/
wercker.yml
102 lines (98 loc) · 3.95 KB
/
wercker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
no-response-timeout: 15
command-timeout: 60
init:
box:
id: alpine:3.7
cmd: /bin/sh
steps:
- script:
name: init
code: echo "Init"
build:
box:
id: alpine:3.7
cmd: /bin/sh
steps:
- script:
name: install curl and unzip
code: apk upgrade && apk update && apk add curl && apk add unzip
- script:
name: download Terraform binary
code: |
curl -LO --retry 3 https://releases.hashicorp.com/terraform/0.11.1/terraform_0.11.1_linux_amd64.zip
unzip terraform_0.11.1_linux_amd64.zip
chmod +x ./terraform
mv terraform /usr/bin/
- script:
name: download and configure Terraform OCI Provider
code: |
curl -LO --retry 3 https://github.com/oracle/terraform-provider-oci/releases/download/v2.0.6/linux.tar.gz
tar -xzvf linux.tar.gz -C /
echo 'providers { oci = "/linux_amd64/terraform-provider-oci_v2.0.6" }' > ~/.terraformrc
- script:
name: run terraform validate for static validation
code: |
export TF_VAR_private_key_path=/tmp/bmcs_api_key.pem
echo -e "$TF_VAR_private_key" > $TF_VAR_private_key_path
terraform init
terraform validate
deploy:
box:
id: python:2.7
steps:
- install-packages:
packages: unzip
- pip-install:
requirements_file: "tests/requirements.txt"
- script:
name: download Terraform binary
code: |
curl -LO --retry 3 https://releases.hashicorp.com/terraform/0.11.1/terraform_0.11.1_linux_amd64.zip
unzip terraform_0.11.1_linux_amd64.zip
chmod +x ./terraform
mv terraform /usr/bin/
- script:
name: download and configure Terraform OCI Provider
code: |
curl -LO --retry 3 https://github.com/oracle/terraform-provider-oci/releases/download/v2.0.6/linux.tar.gz
tar -xzvf linux.tar.gz -C /
echo 'providers { oci = "/linux_amd64/terraform-provider-oci_v2.0.6" }' > ~/.terraformrc
- script:
name: download kubectl binary
code: |
curl -LO --retry 3 https://storage.googleapis.com/kubernetes-release/release/v1.8.5/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv kubectl /usr/bin/
- script:
name: run cluster creation tests
code: |
rm -rf .terraform/
export TF_VAR_private_key_path=/tmp/bmcs_api_key.pem
echo -e "$TF_VAR_private_key" > $TF_VAR_private_key_path
terraform init
terraform validate
cd tests/
export EXTERNAL_IP=$(curl -s -m 10 http://whatismyip.akamai.com/)
find ./resources/configs -type f -exec sed -i "s/0.0.0.0\/0/$EXTERNAL_IP\/32/g" {} +
python2.7 create/runner.py 2>&1 | tee createtests.log ; test ${PIPESTATUS[0]} -eq 0
after-steps:
- script:
name: print cluster creation test log
code: |
cat tests/createtests.log || true
- script:
name: perform additional cleanup after tests
code: |
export TF_VAR_private_key_path=/tmp/bmcs_api_key.pem
echo -e "$TF_VAR_private_key" > $TF_VAR_private_key_path
terraform destroy -force || true
terraform destroy -refresh=true -force || true
terraform destroy -force -target=module.instances-k8smaster-ad1 || true
terraform destroy -force -target=module.instances-k8smaster-ad2 || true
terraform destroy -force -target=module.instances-k8smaster-ad3 || true
terraform destroy -force -target=module.instances-k8sworker-ad1 || true
terraform destroy -force -target=module.instances-k8sworker-ad2 || true
terraform destroy -force -target=module.instances-k8sworker-ad3 || true
terraform destroy -force -target=module.instances-etcd-ad1 || true
terraform destroy -force -target=module.instances-etcd-ad2 || true
terraform destroy -force -target=module.instances-etcd-ad3 || true