-
Notifications
You must be signed in to change notification settings - Fork 197
198 lines (198 loc) · 6.61 KB
/
release.yaml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
---
# This workflow is triggered whenever we release a new version of Starboard
# by creating an annotated Git tag and pushing it to the upstream Git repository.
#
# git tag -a v0.0.1 -m 'Release v0.0.1'
# git push upstream v0.0.1
name: Release
on:
push:
tags:
- "v*"
env:
GO_VERSION: "1.23.1"
KIND_VERSION: "v0.11.1"
KIND_IMAGE: "kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6"
jobs:
unit-tests:
name: Run unit tests
runs-on: ubuntu-20.04
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run unit tests
run: make unit-tests
itest-starboard:
name: Run integration tests / Starboard CLI
needs:
- unit-tests
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/[email protected]
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Run integration tests
run: |
make itests-starboard
env:
KUBECONFIG: /home/runner/.kube/config
STARBOARD_TEST_CLI_LOG_LEVEL: "0"
- name: Cleanup Docker and KIND resources
run: |
docker system prune -a --force
docker volume prune --force
itest-starboard-operator:
name: Run integration tests / Starboard Operator
needs:
- unit-tests
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/[email protected]
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Run integration tests
run: |
kubectl apply -f deploy/crd/vulnerabilityreports.crd.yaml \
-f deploy/crd/configauditreports.crd.yaml \
-f deploy/crd/clusterconfigauditreports.crd.yaml \
-f deploy/crd/clustercompliancereports.crd.yaml \
-f deploy/crd/clustercompliancedetailreports.crd.yaml \
-f deploy/crd/ciskubebenchreports.crd.yaml
kubectl apply -f deploy/static/01-starboard-operator.ns.yaml \
-f deploy/static/02-starboard-operator.rbac.yaml
make itests-starboard-operator
env:
KUBECONFIG: /home/runner/.kube/config
OPERATOR_NAMESPACE: starboard-system
OPERATOR_TARGET_NAMESPACES: default
- name: Cleanup Docker and KIND resources
run: |
docker system prune -a --force
docker volume prune --force
integration-operator-conftest:
name: Integration / Operator / Conftest
needs:
- unit-tests
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Kubernetes cluster (KIND)
uses: engineerd/[email protected]
with:
version: ${{ env.KIND_VERSION }}
image: ${{ env.KIND_IMAGE }}
- name: Test connection to Kubernetes cluster
run: |
kubectl cluster-info
kubectl wait --for=condition=Ready nodes --all --timeout=300s
kubectl describe node
- name: Run integration tests
run: |
kubectl apply -f deploy/crd/vulnerabilityreports.crd.yaml \
-f deploy/crd/configauditreports.crd.yaml \
-f deploy/crd/clusterconfigauditreports.crd.yaml \
-f deploy/crd/clustercompliancereports.crd.yaml \
-f deploy/crd/clustercompliancedetailreports.crd.yaml \
-f deploy/crd/ciskubebenchreports.crd.yaml
kubectl apply -f deploy/static/01-starboard-operator.ns.yaml \
-f deploy/static/02-starboard-operator.rbac.yaml
make integration-operator-conftest
env:
KUBECONFIG: /home/runner/.kube/config
OPERATOR_NAMESPACE: starboard-system
OPERATOR_TARGET_NAMESPACES: default
- name: Cleanup Docker and KIND resources
run: |
docker system prune -a --force
docker volume prune --force
release:
name: Release
needs:
- itest-starboard
- itest-starboard-operator
- integration-operator-conftest
runs-on: ubuntu-20.04
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Cleanup Docker and KIND resources (Pre-Release)
run: |
docker system prune -a --force
docker volume prune --force
- name: Check disk usage (Pre-Release)
run: df -h
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to docker.io registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Release
uses: goreleaser/goreleaser-action@v3
with:
version: v1.7.0
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Update new version for plugin 'starboard' in krew-index
# uses: rajatjindal/[email protected]
- name: Cleanup Docker and KIND resources
run: |
docker system prune -a --force
docker volume prune --force
- name: Check disk usage
run: df -h