-
Notifications
You must be signed in to change notification settings - Fork 21
160 lines (146 loc) · 5.58 KB
/
pre-main.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
name: Test Incoming Changes
'on':
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: quay.io
CERTSUITE_IMAGE_NAME: redhat-best-practices-for-k8s/certsuite
CERTSUITE_IMAGE_TAG: unstable
CERTSUITE_CONFIG_DIR: /tmp/certsuite/config
CERTSUITE_OUTPUT_DIR: /tmp/certsuite/output
TERM: xterm-color
SMOKE_TESTS_LOG_LEVEL: debug
SMOKE_TESTS_LABELS_FILTER: all
jobs:
linters:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: hadolint/[email protected]
with:
dockerfile: "Dockerfile*"
recursive: true
- uses: nosborn/[email protected]
with:
files: .
- uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: --external-sources
with:
ignore_names: mo
- uses: mfinelli/setup-shfmt@v3
- run: shfmt -d scripts/*.sh
# - uses: crate-ci/typos@master # Temporarily disabled
- uses: ibiqlik/action-yamllint@v3
with:
config_data: |
extends: default
rules:
line-length:
level: warning
trailing-spaces:
level: warning
brackets:
level: warning
empty-lines:
level: warning
braces:
level: warning
smoke-tests:
name: Run Smoke Tests
runs-on: ubuntu-22.04
env:
SHELL: /bin/bash
KUBECONFIG: '/home/runner/.kube/config'
PFLT_DOCKERCONFIG: '/home/runner/.docker/config'
steps:
# Restart docker using /mnt/docker-storage (sdb) instead of /var/lib/docker (sda).
# This step needs to be done right after the partner repo's bootstrap scripts, as they
# overwrite the docker's daemon.json.
- name: Create docker/daemon.json if it does not exist
run: |
if [ ! -f /etc/docker/daemon.json ]; then
echo '{}' | sudo tee /etc/docker/daemon.json
fi
- 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: Set up Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.23.1
- name: Disable default go problem matcher
run: echo "::remove-matcher owner=go::"
- name: Write temporary docker file
run: |
mkdir -p /home/runner/.docker
touch ${PFLT_DOCKERCONFIG}
echo '{ "auths": {} }' >> ${PFLT_DOCKERCONFIG}
- name: Check out `certsuite-sample-workload`
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Start the k8s cluster
uses: ./.github/actions/start-k8s-cluster
- name: Create `local-test-infra` OpenShift resources
uses: ./.github/actions/create-local-test-infra-resources
- name: Check out `certsuite`
uses: actions/checkout@v4
with:
repository: redhat-best-practices-for-k8s/certsuite
path: certsuite
- name: Create required Certsuite config files and directories
run: |
mkdir -p $CERTSUITE_CONFIG_DIR $CERTSUITE_OUTPUT_DIR
cp /home/runner/.kube/config $CERTSUITE_CONFIG_DIR/kubeconfig
cp /home/runner/.docker/config $CERTSUITE_CONFIG_DIR/dockerconfig
cp config/*.yml $CERTSUITE_CONFIG_DIR
shell: bash
working-directory: certsuite
- name: 'Test: Run without any TS, just get diagnostic information'
run: |
docker run --rm --network host \
-v $CERTSUITE_CONFIG_DIR:/usr/certsuite/config:Z \
-v $CERTSUITE_OUTPUT_DIR:/usr/certsuite/output:Z \
${REGISTRY}/${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG} \
certsuite run \
--output-dir=/usr/certsuite/output \
--preflight-dockerconfig=/usr/certsuite/config/dockerconfig \
--offline-db=/usr/offline-db \
--log-level=${SMOKE_TESTS_LOG_LEVEL} \
--config-file=/usr/certsuite/config/certsuite_config.yml \
--kubeconfig=/usr/certsuite/config/kubeconfig \
working-directory: certsuite
- name: 'Test: Run Smoke Tests in a TNF container'
run: |
docker run --rm --network host \
-v $CERTSUITE_CONFIG_DIR:/usr/certsuite/config:Z \
-v $CERTSUITE_OUTPUT_DIR:/usr/certsuite/output:Z \
${REGISTRY}/${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG} \
certsuite run \
--output-dir=/usr/certsuite/output \
--preflight-dockerconfig=/usr/certsuite/config/dockerconfig \
--offline-db=/usr/offline-db \
--enable-data-collection=true \
--log-level=${SMOKE_TESTS_LOG_LEVEL} \
--config-file=/usr/certsuite/config/certsuite_config.yml \
--kubeconfig=/usr/certsuite/config/kubeconfig \
--label-filter="${SMOKE_TESTS_LABELS_FILTER}"
working-directory: certsuite
- name: Build the TNF tool
run: make build-certsuite-tool
working-directory: certsuite
- name: Check the smoke test results against the expected results template
run: ./certsuite check results --log-file="${CERTSUITE_OUTPUT_DIR}"/certsuite.log
working-directory: certsuite