Skip to content

Commit e0ff51e

Browse files
committed
Merge remote-tracking branch 'origin/main' into block-device-filter
Signed-off-by: Anton Sergunov <[email protected]>
2 parents 4415970 + 594fccf commit e0ff51e

File tree

11 files changed

+103
-195
lines changed

11 files changed

+103
-195
lines changed

.github/workflows/go_checks.yaml

Lines changed: 4 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,8 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v2
2020

21-
- name: Setup Go environment
22-
uses: actions/setup-go@v5
23-
with:
24-
go-version: "1.24"
25-
26-
- name: Install golangci-lint
27-
run: go install github.com/golangci/golangci-lint/cmd/[email protected]
28-
2921
- name: Run Go lint
30-
run: |
31-
basedir=$(pwd)
32-
failed='false'
33-
for i in $(find images -type f -name go.mod);do
34-
dir=$(echo $i | sed 's/go.mod$//')
35-
cd $basedir/$dir
36-
# check all editions
37-
for edition in $GO_BUILD_TAGS ;do
38-
echo "Running linter in $dir (edition: $edition)"
39-
golangci-lint run --build-tags $edition
40-
if [ $? -ne 0 ]; then
41-
echo "Linter failed in $dir (edition: $edition)"
42-
failed='true'
43-
fi
44-
done
45-
done
46-
if [ $failed == 'true' ]; then
47-
exit 1
48-
fi
22+
uses: deckhouse/modules-actions/go_linter@v2
4923

5024
go_tests:
5125
name: Go tests for images
@@ -55,31 +29,8 @@ jobs:
5529
- name: Checkout repository
5630
uses: actions/checkout@v2
5731

58-
- name: Setup Go environment
59-
uses: actions/setup-go@v5
60-
with:
61-
go-version: "1.24"
62-
6332
- name: Run Go tests
64-
run: |
65-
basedir=$(pwd)
66-
failed='false'
67-
for i in $(find images -type f -name '*_test.go');do
68-
dir=$(echo $i | sed 's/[a-z_A-Z0-9-]*_test.go$//')
69-
cd $basedir/$dir
70-
# check all editions
71-
for edition in $GO_BUILD_TAGS ;do
72-
echo "Running tests in $dir (edition: $edition)"
73-
go test -v -tags $edition
74-
if [ $? -ne 0 ]; then
75-
echo "Tests failed in $dir (edition: $edition)"
76-
failed='true'
77-
fi
78-
done
79-
done
80-
if [ $failed == 'true' ]; then
81-
exit 1
82-
fi
33+
uses: deckhouse/modules-actions/go_tests@v2
8334

8435
go_test_coverage:
8536
name: Go test coverage for images
@@ -89,35 +40,8 @@ jobs:
8940
- name: Checkout repository
9041
uses: actions/checkout@v2
9142

92-
- name: Setup Go environment
93-
uses: actions/setup-go@v5
94-
with:
95-
go-version: "1.24"
96-
9743
- name: Run Go test coverage count
98-
run: |
99-
if [ ! -d "images" ]; then
100-
echo "No images/ directory found. Please run this script from the root of the repository."
101-
exit 1
102-
fi
103-
104-
find images/ -type f -name "go.mod" | while read -r gomod; do
105-
dir=$(dirname "$gomod")
106-
107-
echo "Test coverage in $dir"
108-
109-
cd "$dir" || continue
110-
111-
for tag in $GO_BUILD_TAGS; do
112-
echo " Build tag: $tag"
113-
114-
go test ./... -cover -tags "$tag"
115-
done
116-
117-
cd - > /dev/null
118-
119-
echo "----------------------------------------"
120-
done
44+
uses: deckhouse/modules-actions/go_test_coverage@v2
12145

12246
go_modules_check:
12347
name: Go modules version
@@ -127,83 +51,5 @@ jobs:
12751
- name: Checkout repository
12852
uses: actions/checkout@v2
12953

130-
- name: Setup Go environment
131-
uses: actions/setup-go@v5
132-
with:
133-
go-version: "1.24"
134-
13554
- name: Run Go modules version check
136-
run: |
137-
search_dir=$(pwd)"/images"
138-
139-
if [ ! -d "$search_dir" ]; then
140-
echo "Directory $search_dir does not exist."
141-
exit 1
142-
fi
143-
144-
temp_dir=$(mktemp -d)
145-
touch "$temp_dir/incorrect_alert"
146-
147-
trap 'rm -rf "$temp_dir"' EXIT
148-
149-
find images/ -type f -name "go.mod" | while read -r gomod; do
150-
dir=$(dirname "$gomod")
151-
152-
echo "Checking $dir"
153-
154-
cd "$dir" || continue
155-
156-
go list -m all | grep deckhouse | grep -v '=>' | while IFS= read -r line; do
157-
module_name=$(echo "$line" | awk '{print $1}')
158-
module_version=$(echo "$line" | awk '{print $2}')
159-
160-
if [ -z "$module_version" ]; then
161-
echo " Checking module name $module_name"
162-
correct_module_name="github.com"/"$GITHUB_REPOSITORY"/"$dir"
163-
if [ "$module_name" != "$correct_module_name" ]; then
164-
echo " Incorrect module name: $module_name, expected: $correct_module_name"
165-
echo " Incorrect module name: $module_name, expected: $correct_module_name" >> "$temp_dir/incorrect_alert"
166-
else
167-
echo " Correct module name: $module_name"
168-
fi
169-
else
170-
echo " Checking module tag $module_name"
171-
repository=$(echo "$line" | awk '{print $1}' | awk -F'/' '{ print "https://"$1"/"$2"/"$3".git" }')
172-
pseudo_tag=$(echo "$line" | awk '{print $2}')
173-
174-
echo " Cloning repo $repository into $temp_dir"
175-
if [ ! -d "$temp_dir/$repository" ]; then
176-
git clone "$repository" "$temp_dir/$repository" >/dev/null 2>&1
177-
fi
178-
179-
cd "$temp_dir/$repository" || continue
180-
181-
commit_info=$(git log -1 --pretty=format:"%H %cd" --date=iso-strict -- api/*)
182-
short_hash=$(echo "$commit_info" | awk '{print substr($1,1,12)}')
183-
commit_date=$(echo "$commit_info" | awk '{print $2}')
184-
commit_date=$(date -u -d "$commit_date" +"%Y%m%d%H%M%S")
185-
actual_pseudo_tag="v0.0.0-"$commit_date"-"$short_hash
186-
pseudo_tag_date=$(echo $pseudo_tag | awk -F'-' '{ print $2 }')
187-
echo " Latest pseudo tag for $repository: $pseudo_tag"
188-
echo " Actual pseudo tag for $repository: $actual_pseudo_tag"
189-
190-
if [[ "$pseudo_tag" != "$actual_pseudo_tag" ]]; then
191-
echo " Incorrect pseudo tag for repo $repository in file "$go_mod_file" (current: "$pseudo_tag", actual:"$actual_pseudo_tag")"
192-
echo " Incorrect pseudo tag for repo $repository in file "$go_mod_file" (current: "$pseudo_tag", actual:"$actual_pseudo_tag")" >> $temp_dir"/incorrect_alert"
193-
fi
194-
195-
cd - >/dev/null 2>&1
196-
fi
197-
done
198-
199-
cd - > /dev/null
200-
201-
echo "----------------------------------------"
202-
done
203-
204-
alert_lines_count=$(cat $temp_dir"/incorrect_alert" | wc -l)
205-
206-
if [ $alert_lines_count != 0 ]; then
207-
echo "We have non-actual pseudo-tags or modules names in repository's go.mod files"
208-
exit 1
209-
fi
55+
uses: deckhouse/modules-actions/go_modules_check@v2
Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Build and checks
22

33
on:
4+
schedule:
5+
- cron: "0 01 * * 0,3"
46
pull_request:
57
types: [opened, reopened, labeled, synchronize]
68
push:
@@ -9,7 +11,16 @@ on:
911
workflow_dispatch:
1012
inputs:
1113
release_branch:
12-
description: "release branch name, example: release-1.68"
14+
description: "Optional. Set minor version of release you want to scan. e.g.: 1.23"
15+
required: false
16+
scan_several_lastest_releases:
17+
description: "Optional. Whether to scan last several releases or not. true/false. For scheduled pipelines it is always true. Default is: false."
18+
required: false
19+
latest_releases_amount:
20+
description: "Optional. Number of latest releases to scan. Default is: 3"
21+
required: false
22+
severity:
23+
description: "Optional. Vulnerabilities severity to scan. Default is: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL"
1324
required: false
1425

1526
jobs:
@@ -19,40 +30,44 @@ jobs:
1930
secrets: inherit
2031
cve_scan_on_pr:
2132
if: github.event_name == 'pull_request'
22-
name: Trivy images check
33+
name: CVE scan for PR
2334
runs-on: [self-hosted, regular]
2435
needs: [build_dev]
2536
steps:
2637
- uses: actions/checkout@v4
27-
- uses: deckhouse/modules-actions/cve_scan@v2
38+
- uses: deckhouse/modules-actions/cve_scan@v4
2839
with:
29-
image: ${{ vars.DEV_MODULE_SOURCE }}/${{ vars.MODULE_NAME }}
3040
tag: pr${{ github.event.number }}
3141
module_name: ${{ vars.MODULE_NAME }}
32-
dd_url: ${{secrets.DEFECTDOJO_HOST}}
33-
dd_token: ${{secrets.DEFECTDOJO_API_TOKEN}}
34-
trivy_registry: ${{ vars.PROD_REGISTRY }}
35-
trivy_registry_user: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }}
36-
trivy_registry_password: ${{ secrets.PROD_MODULES_READ_REGISTRY_PASSWORD }}
37-
deckhouse_private_repo: ${{secrets.DECKHOUSE_PRIVATE_REPO}}
42+
dd_url: ${{ secrets.DEFECTDOJO_HOST }}
43+
dd_token: ${{ secrets.DEFECTDOJO_API_TOKEN }}
44+
prod_registry: "registry.deckhouse.io"
45+
prod_registry_user: "license-token"
46+
prod_registry_password: ${{ secrets.PROD_MODULES_READ_REGISTRY_PASSWORD }}
47+
dev_registry: ${{ vars.DEV_REGISTRY }}
48+
dev_registry_user: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
49+
dev_registry_password: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
50+
deckhouse_private_repo: ${{ secrets.DECKHOUSE_PRIVATE_REPO }}
51+
severity: "HIGH,CRITICAL"
3852
cve_scan:
3953
if: github.event_name != 'pull_request'
40-
name: Trivy images check
54+
name: Regular CVE scan
4155
runs-on: [self-hosted, regular]
4256
steps:
4357
- uses: actions/checkout@v4
44-
- name: Sets env vars for manual run
45-
run: |
46-
echo "MODULE_IMAGE_TAG=${{ github.event.inputs.release_branch || 'main' }}" >> $GITHUB_ENV
47-
if: github.event_name != 'workflow_dispatch'
48-
- uses: deckhouse/modules-actions/cve_scan@v2
58+
- uses: deckhouse/modules-actions/cve_scan@v4
4959
with:
50-
image: ${{ vars.DEV_MODULE_SOURCE }}/${{ vars.MODULE_NAME }}
51-
tag: ${{ env.MODULE_IMAGE_TAG || 'main' }}
60+
tag: ${{ github.event.inputs.release_branch || github.event.repository.default_branch }}
5261
module_name: ${{ vars.MODULE_NAME }}
53-
dd_url: ${{secrets.DEFECTDOJO_HOST}}
54-
dd_token: ${{secrets.DEFECTDOJO_API_TOKEN}}
55-
trivy_registry: ${{ vars.PROD_REGISTRY }}
56-
trivy_registry_user: ${{ vars.PROD_MODULES_REGISTRY_LOGIN }}
57-
trivy_registry_password: ${{ secrets.PROD_MODULES_READ_REGISTRY_PASSWORD }}
58-
deckhouse_private_repo: ${{secrets.DECKHOUSE_PRIVATE_REPO}}
62+
dd_url: ${{ secrets.DEFECTDOJO_HOST }}
63+
dd_token: ${{ secrets.DEFECTDOJO_API_TOKEN }}
64+
prod_registry: "registry.deckhouse.io"
65+
prod_registry_user: "license-token"
66+
prod_registry_password: ${{ secrets.PROD_MODULES_READ_REGISTRY_PASSWORD }}
67+
dev_registry: ${{ vars.DEV_REGISTRY }}
68+
dev_registry_user: ${{ vars.DEV_MODULES_REGISTRY_LOGIN }}
69+
dev_registry_password: ${{ secrets.DEV_MODULES_REGISTRY_PASSWORD }}
70+
deckhouse_private_repo: ${{ secrets.DECKHOUSE_PRIVATE_REPO }}
71+
scan_several_lastest_releases: ${{ github.event.inputs.scan_several_lastest_releases }}
72+
latest_releases_amount: ${{ github.event.inputs.latest_releases_amount || '3' }}
73+
severity: ${{ github.event.inputs.severity }}

.werf/bundle.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
---
33
image: bundle
44
fromImage: builder/scratch
5+
56
import:
67
# Rendering .werf/images-digests.yaml is required!
78
- image: images-digests
@@ -18,6 +19,11 @@ import:
1819
add: /usr/local/bin/go-hooks
1920
to: /hooks/go-hooks
2021
after: setup
22+
# Rendering .werf/choose-edition.yaml is required!
23+
- image: choose-edition
24+
add: /openapi
25+
to: /openapi
26+
after: setup
2127
git:
2228
- add: /
2329
to: /
@@ -30,7 +36,6 @@ git:
3036
- docs
3137
- hooks
3238
- monitoring
33-
- openapi
34-
- module.yaml
3539
- templates
3640
- Chart.yaml
41+
- module.yaml

.werf/choose-edition.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
image: choose-edition
3+
fromImage: builder/alt
4+
fromCacheVersion: {{ div .Commit.Date.Unix (mul 60 60 24 30) }}
5+
6+
git:
7+
- add: /
8+
to: /
9+
includePaths:
10+
- openapi
11+
shell:
12+
setup:
13+
- cd /openapi
14+
- if [[ {{ .MODULE_EDITION }} == "ce" ]]; then cp -v values_ce.yaml values.yaml; else cp -v values_ee.yaml values.yaml; fi
15+
- rm -rf values_*.yaml

module.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ descriptions:
44
en: "sds node configurator module"
55
requirements:
66
bootstrapped: true
7+
deckhouse: ">= 1.67"
78
namespace: "d8-sds-node-configurator"
File renamed without changes.

openapi/values_ee.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
x-extend:
2+
schema: config-values.yaml
3+
type: object
4+
properties:
5+
internal:
6+
type: object
7+
default: {}
8+
properties:
9+
pythonVersions:
10+
type: array
11+
default: []
12+
items:
13+
type: string
14+
customWebhookCert:
15+
type: object
16+
default: {}
17+
x-required-for-helm:
18+
- crt
19+
- key
20+
- ca
21+
properties:
22+
crt:
23+
type: string
24+
x-examples: ["YjY0ZW5jX3N0cmluZwo="]
25+
key:
26+
type: string
27+
x-examples: ["YjY0ZW5jX3N0cmluZwo="]
28+
ca:
29+
type: string
30+
x-examples: ["YjY0ZW5jX3N0cmluZwo="]
31+
registry:
32+
type: object
33+
description: "System field, overwritten by Deckhouse. Don't use"

templates/sds-health-watcher-controller/deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ metadata:
4747
namespace: d8-{{ .Chart.Name }}
4848
{{- include "helm_lib_module_labels" (list . (dict "app" "sds-health-watcher-controller")) | nindent 2 }}
4949
spec:
50-
{{- include "helm_lib_deployment_on_master_strategy_and_replicas_for_ha" . | nindent 2 }}
5150
revisionHistoryLimit: 2
51+
{{- include "helm_lib_deployment_strategy_and_replicas_for_ha" . | nindent 2 }}
5252
selector:
5353
matchLabels:
5454
app: sds-health-watcher-controller
@@ -61,6 +61,7 @@ spec:
6161
{{- include "helm_lib_node_selector" (tuple . "system") | nindent 6 }}
6262
{{- include "helm_lib_tolerations" (tuple . "system") | nindent 6 }}
6363
{{- include "helm_lib_module_pod_security_context_run_as_user_nobody" . | nindent 6 }}
64+
{{- include "helm_lib_pod_anti_affinity_for_ha" (list . (dict "app" "sds-health-watcher-controller")) | nindent 6 }}
6465
imagePullSecrets:
6566
- name: {{ .Chart.Name }}-module-registry
6667
serviceAccountName: sds-health-watcher-controller

trivy-silent.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

trivy.yaml

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

0 commit comments

Comments
 (0)