This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
forked from JamesClonk/terraform-vcloud-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (120 loc) · 3.79 KB
/
master.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Update Master cluster
on:
push:
branches: [ master ]
workflow_dispatch:
permissions:
contents: read
jobs:
terraform-apply:
name: 'terraform apply'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check release version variable
run: |
TF_VAR_VERSION=$(cat variables.tf | grep 'variable "module_version"' -A2 | grep default | awk -F'"' '{print $2;}')
if [ $(git tag -l "${TF_VAR_VERSION}") ]; then
echo "Release ${TF_VAR_VERSION} already exists on GitHub! Did you forget to update the 'module_version'?"
exit 1
fi
- name: Setup Terraform Override
if: github.ref == 'refs/heads/master'
env:
TF_OVERRIDE: ${{ secrets.TF_OVERRIDE }}
run: echo "${TF_OVERRIDE}" > override.tf
- name: Setup Terraform tfvars
if: github.ref == 'refs/heads/master'
env:
TF_TFVARS: ${{ secrets.TF_TFVARS }}
run: echo "${TF_TFVARS}" > terraform.tfvars
- name: Setup Terraform CLI
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: ~1.2.8
- name: Terraform Format
id: fmt
run: terraform fmt -check
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate
- name: Terraform Plan
id: plan
run: terraform plan -input=false
- name: Terraform Apply
if: github.ref == 'refs/heads/master'
run: terraform apply -auto-approve -input=false
- name: Cleanup
if: ${{ always() }}
run: |
rm -f kubeconfig || true
rm -f terraform.tfvars || true
sonobuoy-run:
name: 'sonobuoy run'
needs: [ terraform-apply ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup kubeconfig
if: github.ref == 'refs/heads/master'
env:
MASTER_KUBECONFIG: ${{ secrets.MASTER_KUBECONFIG }}
run: echo "${MASTER_KUBECONFIG}" > kubeconfig
- name: Run Sonobuoy
run: |
wget --quiet https://github.com/vmware-tanzu/sonobuoy/releases/download/v0.56.10/sonobuoy_0.56.10_linux_amd64.tar.gz
tar -xvzf sonobuoy_0.56.10_linux_amd64.tar.gz
chmod +x sonobuoy
export KUBECONFIG=kubeconfig
./sonobuoy delete --wait || true
./sonobuoy run --mode quick --wait --plugin-env=e2e.E2E_EXTRA_ARGS=--non-blocking-taints=CriticalAddonsOnly,true,NoExecute
./sonobuoy status
results=$(./sonobuoy retrieve)
./sonobuoy results $results
./sonobuoy delete --wait
- name: Cleanup
if: ${{ always() }}
run: |
rm -f kubeconfig || true
kubernetes-testing:
name: 'kubernetes-testing'
needs: [ sonobuoy-run ]
runs-on: ubuntu-latest
steps:
- name: Checkout kubernetes-testing
uses: actions/checkout@v3
with:
repository: swisscom/kubernetes-testing
ref: master
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Setup configs
if: github.ref == 'refs/heads/master'
env:
MASTER_KUBECONFIG: ${{ secrets.MASTER_KUBECONFIG }}
MASTER_TESTING_CONFIG: ${{ secrets.MASTER_TESTING_CONFIG }}
run: |
echo "${MASTER_KUBECONFIG}" > kubeconfig
echo "${MASTER_TESTING_CONFIG}" > config.yml
- name: Setup Chrome
uses: ./.github/actions/setup-chrome
- name: Run kubernetes-testing specs
run: |
export KUBECONFIG=kubeconfig
make test
- name: Cleanup
if: ${{ always() }}
run: |
rm -f kubeconfig || true
rm -f config.yml || true