-
Notifications
You must be signed in to change notification settings - Fork 4
191 lines (158 loc) · 5.85 KB
/
pre-main.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
name: Test Incoming Changes
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CM_BIN: /usr/local/bin/checkmake
CM_URL_LINUX: https://github.com/mrtazz/checkmake/releases/download/0.2.2/checkmake-0.2.2.linux.amd64 # yamllint disable-line
jobs:
lint:
name: Run Linters and Vet
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
steps:
- name: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23.4
- name: Disable default go problem matcher
run: echo "::remove-matcher owner=go::"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Extract dependent Pull Requests
uses: depends-on/depends-on-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install checkmake
run: |
curl --location --output $CM_BIN --silent $CM_URL_LINUX
chmod +x $CM_BIN
- name: Install Shfmt
uses: mfinelli/setup-shfmt@v3
- name: Golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.62
args: --timeout 10m0s
- name: Checkmake
run: checkmake --config=.checkmake Makefile
- name: Hadolint
uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
recursive: true
# - name: Shfmt
# run: shfmt -d *.sh script
- name: Markdownlint
uses: nosborn/[email protected]
with:
files: .
- name: ShellCheck
uses: ludeeus/action-shellcheck@master
- name: Typos
uses: crate-ci/typos@master
- name: Yamllint
uses: ibiqlik/action-yamllint@v3
with:
config_file: .yamllint.yml
- name: Go vet
run: make vet
test:
name: Build, install and test operator in a Kind cluster
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
KUBECONFIG: '/home/runner/.kube/config'
steps:
- name: Disable default go problem matcher
run: echo "::remove-matcher owner=go::"
# Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda).
- name: Make docker to use /mnt (sdb) for storage
run: |
df -h
lsblk
sudo mkdir /mnt/docker-storage
sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json
sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json
cat /etc/docker/daemon.json
sudo systemctl restart docker
sudo ls -la /mnt/docker-storage
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Build operator
run: ./scripts/ci/build.sh
- name: Removed unused docker images and go cache cleanup
run: |
df -h
docker rmi $(docker images -f "dangling=true" -q) || true
docker builder prune --all -f
go clean -modcache
df -h
# Create a Kind cluster for testing.
- name: Check out `certsuite-sample-workload` repo
uses: actions/checkout@v4
with:
repository: redhat-best-practices-for-k8s/certsuite-sample-workload
path: certsuite-sample-workload
- name: Bootstrap cluster, docker, and python
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make bootstrap-cluster && make bootstrap-docker-ubuntu-local && make bootstrap-python-ubuntu-local
# Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda).
# This step needs to be done right after the sample workload repo's bootstrap scripts, as they
# overwrite the docker's daemon.json.
- name: Make docker to use /mnt (sdb) for storage
run: |
df -h
lsblk
sudo mkdir /mnt/docker-storage || true
sudo jq '. +={"data-root" : "/mnt/docker-storage"}' < /etc/docker/daemon.json > /tmp/docker-daemon.json
sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json
cat /etc/docker/daemon.json
sudo systemctl restart docker
sudo ls -la /mnt/docker-storage
- name: Run 'make rebuild-cluster'
uses: nick-fields/retry@v3
env:
SKIP_PRELOAD_IMAGES: true
with:
timeout_minutes: 15
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make rebuild-cluster
- name: Run 'make install'
uses: nick-fields/retry@v3
env:
SKIP_PRELOAD_IMAGES: true
with:
timeout_minutes: 20
max_attempts: 3
command: cd ${GITHUB_WORKSPACE}/certsuite-sample-workload; make install
- name: Install cert-manager to cluster
run: |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
kubectl wait --for=condition=ready pod --all=true -n cert-manager --timeout=5m
- name: Install consoleplugin CRD to cluster
run: |
kubectl apply -f https://raw.githubusercontent.com/openshift/api/master/console/v1/zz_generated.crd-manifests/90_consoleplugins-Default.crd.yaml
- name: More cleanup
run: |
df -h
docker rmi $(docker images -f "dangling=true" -q) || true
docker builder prune --all -f
go clean -modcache
rm -rf ${GITHUB_WORKSPACE}/certsuite-sample-workload
df -h
- name: Install operator in the Kind cluster
run: ./scripts/ci/deploy.sh
- name: Run simple smoke test.
run: ./scripts/ci/smoke_test.sh