Skip to content

Commit c1f9b14

Browse files
committed
wip
1 parent d8d4809 commit c1f9b14

21 files changed

+370
-494
lines changed

.github/workflows/check-pr.yml

Lines changed: 0 additions & 95 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 34 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,17 @@
1-
# Implicit requirements
2-
# runner must have `docker` and `curl` installed (true on github-runners)
3-
41
name: run-tests
52

63
on:
7-
workflow_call:
8-
workflow_dispatch:
4+
pull_request
95

106
jobs:
11-
start-runner:
12-
runs-on: ubuntu-latest
13-
outputs:
14-
runner-label: ${{ steps.start-yc-runner.outputs.label }}
15-
instance-id: ${{ steps.start-yc-runner.outputs.instance-id }}
16-
steps:
17-
- name: start-yc-runner
18-
id: start-yc-runner
19-
uses: yc-actions/yc-github-runner@v1
20-
with:
21-
mode: start
22-
yc-sa-json-credentials: ${{ secrets.CI_RUNNER_CREATOR_KEY }}
23-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
24-
folder-id: b1gmgbhccra2qca8v5g6
25-
image-id: fd80o2eikcn22b229tsa
26-
cores: 16
27-
disk-type: network-ssd-nonreplicated
28-
disk-size: 465GB
29-
memory: 32GB
30-
core-fraction: 100
31-
subnet-id: e9bu12i8ocv6q8kl83ru
32-
user: yc-admin
33-
ssh-public-key: ${{ secrets.CI_RUNNER_DEBUG_SHH_PUBLIC_KEY }}
34-
smart-checkout:
35-
needs:
36-
- start-runner
37-
runs-on: ${{ needs.start-runner.outputs.runner-label }}
38-
steps:
39-
- name: checkout-when-fork-source
40-
uses: actions/checkout@v3
41-
if: github.event.pull_request.head.sha != ''
42-
with:
43-
ref: ${{ github.event.pull_request.head.sha }}
44-
- name: checkout-when-this-repo-source
45-
uses: actions/checkout@v3
46-
if: github.event.pull_request.head.sha == ''
477
lint:
488
concurrency:
499
group: lint-golangci-${{ github.head_ref || github.ref_name }}
5010
cancel-in-progress: true
51-
needs:
52-
- start-runner
53-
- smart-checkout
54-
runs-on: ${{ needs.start-runner.outputs.runner-label }}
11+
runs-on: ubuntu-latest
5512
steps:
56-
- name: set-env-vars
57-
run: |
58-
echo "HOME=/actions-runner" >> $GITHUB_ENV
13+
- name: checkout
14+
uses: actions/checkout@v3
5915
- name: setup-go
6016
uses: actions/setup-go@v3
6117
with:
@@ -68,42 +24,30 @@ jobs:
6824
concurrency:
6925
group: lint-autoformat-${{ github.head_ref || github.ref_name }}
7026
cancel-in-progress: true
71-
needs:
72-
- start-runner
73-
- smart-checkout
74-
runs-on: ${{ needs.start-runner.outputs.runner-label }}
27+
runs-on: ubuntu-latest
7528
steps:
76-
- name: set-env-vars
77-
run: |
78-
echo "HOME=/actions-runner" >> $GITHUB_ENV
29+
- name: checkout
30+
uses: actions/checkout@v3
7931
- name: setup-go
8032
uses: actions/setup-go@v3
8133
with:
8234
go-version: '1.20'
83-
- name: Install utilities
35+
- name: install-utilities
8436
run: |
8537
go install mvdan.cc/[email protected]
8638
go install github.com/rinchsan/gosimports/cmd/[email protected]
8739
- name: format all files with auto-formatter
8840
run: bash ./.github/scripts/format-all-go-code.sh "$PWD"
89-
- name: Check repository diff
41+
- name: check-repository-diff
9042
run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
9143
run-unit-tests:
9244
concurrency:
9345
group: run-unit-tests-${{ github.head_ref || github.ref_name }}
9446
cancel-in-progress: true
95-
needs:
96-
- start-runner
97-
- smart-checkout
98-
- lint
99-
- code-format-check
100-
runs-on: ${{ needs.start-runner.outputs.runner-label }}
101-
outputs:
102-
result: ${{ steps.run-unit-tests.outputs.result }}
47+
runs-on: ubuntu-latest
10348
steps:
104-
- name: set-env-vars
105-
run: |
106-
echo "HOME=/actions-runner" >> $GITHUB_ENV
49+
- name: checkout
50+
uses: actions/checkout@v3
10751
- name: setup-go
10852
uses: actions/setup-go@v3
10953
with:
@@ -139,18 +83,17 @@ jobs:
13983
group: run-e2e-tests-${{ github.head_ref || github.ref_name }}
14084
cancel-in-progress: true
14185
needs:
142-
- start-runner
143-
- smart-checkout
144-
- lint
145-
- code-format-check
14686
- run-unit-tests
147-
runs-on: ${{ needs.start-runner.outputs.runner-label }}
148-
outputs:
149-
result: ${{ steps.run-e2e-tests.outputs.result }}
87+
runs-on: ubuntu-latest
15088
steps:
151-
- name: set-env-vars
152-
run: |
153-
echo "HOME=/actions-runner" >> $GITHUB_ENV
89+
- name: maximize-build-space
90+
uses: AdityaGarg8/[email protected]
91+
with:
92+
remove-android: 'true'
93+
remove-haskell: 'true'
94+
remove-codeql: 'true'
95+
- name: checkout
96+
uses: actions/checkout@v3
15497
- name: setup-go
15598
uses: actions/setup-go@v3
15699
with:
@@ -175,10 +118,6 @@ jobs:
175118
echo "$(pwd)" >> $GITHUB_PATH
176119
echo "$HOME/ydb/bin" >> $GITHUB_PATH
177120
echo "$HOME/go/bin" >> $GITHUB_PATH
178-
- name: configure-system
179-
run: |
180-
sudo sysctl fs.inotify.max_user_instances=1280
181-
sudo sysctl fs.inotify.max_user_watches=655360
182121
- name: check-dependencies
183122
run: |
184123
gcc --version
@@ -192,7 +131,12 @@ jobs:
192131
kind create cluster \
193132
--image=kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5 \
194133
--config=./e2e/kind-cluster-config.yaml
134+
195135
kubectl wait --timeout=5m --for=condition=ready node -l worker=true
136+
137+
kubectl label --overwrite node kind-worker topology.kubernetes.io/zone=fakeZone1
138+
kubectl label --overwrite node kind-worker2 topology.kubernetes.io/zone=fakeZone2
139+
kubectl label --overwrite node kind-worker3 topology.kubernetes.io/zone=fakeZone3
196140
- name: build-operator-image
197141
uses: docker/build-push-action@v3
198142
with:
@@ -203,7 +147,7 @@ jobs:
203147
tags: kind/ydb-operator:current
204148
- name: load-and-deploy-operator
205149
run: |
206-
kind load docker-image kind/ydb-operator:current
150+
kind load docker-image kind/ydb-operator:current --nodes kind-worker,kind-worker2,kind-worker3
207151
- name: pull-and-load-kube-webhook-certgen-image
208152
uses: nick-fields/retry@v3
209153
with:
@@ -212,20 +156,21 @@ jobs:
212156
max_attempts: 3
213157
command: |
214158
docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
215-
kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0
159+
kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --nodes kind-worker,kind-worker2,kind-worker3
216160
- name: pull-and-load-ydb-image
217161
run: |
218-
# TODO would be cool to parse YDB image from manifests to avoid duplicating information
219-
docker pull cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
220-
kind load docker-image cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
162+
YDB_IMAGE=$(grep "anchor_for_fetching_image_from_workflow" ./e2e/tests/**/*.go | grep -o -E '"cr\.yandex.*"')
163+
YDB_IMAGE=${YDB_IMAGE:1:-1} # strip ""
164+
docker pull $YDB_IMAGE
165+
kind load docker-image $YDB_IMAGE --nodes kind-worker,kind-worker2,kind-worker3
221166
- name: setup-gotestsum
222167
run: |
223168
go install gotest.tools/[email protected]
224169
- name: run-e2e-tests
225170
id: run-e2e-tests
226171
run: |
227172
gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./e2e/... -ginkgo.vv
228-
- name: convert-to-human-readable
173+
- name: convert-json-log-to-human-readable
229174
run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true
230175
- name: artifact-upload-step
231176
uses: actions/upload-artifact@v4
@@ -240,21 +185,4 @@ jobs:
240185
- name: teardown-k8s-cluster
241186
run: |
242187
kind delete cluster
243-
stop-runner:
244-
needs:
245-
- start-runner
246-
- lint
247-
- code-format-check
248-
- run-unit-tests
249-
- run-e2e-tests
250-
runs-on: ubuntu-latest
251-
if: always()
252-
steps:
253-
- name: stop-yc-runner
254-
uses: yc-actions/yc-github-runner@v1
255-
with:
256-
mode: stop
257-
yc-sa-json-credentials: ${{ secrets.CI_RUNNER_CREATOR_KEY }}
258-
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
259-
label: ${{ needs.start-runner.outputs.runner-label }}
260-
instance-id: ${{ needs.start-runner.outputs.instance-id }}
188+

.github/workflows/upload-artifacts.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Implicit requirements
2-
# runner must have `docker` and `curl` installed (true on github-runners)
3-
41
name: upload-artifacts
52
on:
63
push:

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ linters:
130130
disable-all: true
131131
enable:
132132
# - cyclop
133-
- deadcode
134133
- depguard
135134
- dogsled
136135
# - dupl
@@ -176,7 +175,6 @@ linters:
176175
- revive
177176
- staticcheck
178177
- stylecheck
179-
- structcheck
180178
# - tagliatelle
181179
# - testpackage
182180
# - thelper
@@ -186,7 +184,6 @@ linters:
186184
- unparam
187185
- unused
188186
# - varnamelen
189-
- varcheck
190187
- whitespace
191188
# - wrapcheck
192189
# - wsl

docs/tests.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ kind create cluster \
8888
kubectl config use-context kind-local-kind
8989

9090
# Within tests, the following two images are used:
91-
# cr.yandex/crptqonuodf51kdj7a7d/ydb:23.3.17
91+
# cr.yandex/crptqonuodf51kdj7a7d/ydb:<version>
9292
# kind/ydb-operator:current
9393

9494
# You have to download the ydb image and build the operator image yourself. Then, explicitly
9595
# upload them into the kind cluster. Refer to `./github/e2e.yaml` github workflow which essentially
9696
# does the same thing.
9797
kind --name local-kind load docker-image kind/ydb-operator:current
98-
kind --name local-kind load docker-image ydb:23.3.17
98+
kind --name local-kind load docker-image ydb:<version>
9999

100100
# Run all tests with disabled concurrency, because there is only one cluster to run tests against
101101
go test -p 1 -v ./...

0 commit comments

Comments
 (0)