Skip to content

Commit f6e0cc3

Browse files
krpsh123astefmortelumina98duckhawkAleksZimin
authored
[internal] Adds: RPC-with-TLS, alert, validation (#49)
Signed-off-by: Pavel Karpov <[email protected]> Signed-off-by: Aleksandr Stefurishin <[email protected]> Signed-off-by: mortelumina98 <[email protected]> Signed-off-by: v.oleynikov <[email protected]> Signed-off-by: Aleksandr Zimin <[email protected]> Co-authored-by: Aleksandr Stefurishin <[email protected]> Co-authored-by: mortelumina98 <[email protected]> Co-authored-by: v.oleynikov <[email protected]> Co-authored-by: Aleksandr Zimin <[email protected]>
1 parent 0703b9a commit f6e0cc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2107
-598
lines changed

.github/workflows/build_dev.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,77 @@ env:
1212
SOURCE_REPO: ${{ secrets.SOURCE_REPO }}
1313

1414
on:
15-
pull_request:
15+
#pull_request:
16+
# call from trivy_image_check.yaml, which in turn call from pull_request
17+
# https://stackoverflow.com/a/71489231
18+
workflow_call:
1619
push:
1720
branches:
1821
- main
1922

23+
defaults:
24+
run:
25+
shell: bash
26+
2027
jobs:
28+
set_edition:
29+
runs-on: [self-hosted, regular, selectel]
30+
name: Set edition
31+
outputs:
32+
module_edition: ${{ steps.set-vars.outputs.MODULE_EDITION }}
33+
steps:
34+
- name: Get Pull Request Labels
35+
id: get-labels
36+
uses: actions/github-script@v7
37+
with:
38+
script: |
39+
if (context.eventName === "pull_request" || context.eventName === "pull_request_target" ) {
40+
const prNumber = context.payload.pull_request.number;
41+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
issue_number: prNumber,
45+
});
46+
return labels.map(label => label.name);
47+
} else {
48+
return [];
49+
}
50+
result-encoding: string
51+
52+
- name: Set vars
53+
id: set-vars
54+
run: |
55+
# Slect edition for build, default EE
56+
if echo "${{ steps.get-labels.outputs.result }}" | grep -q "edition/ce"; then
57+
echo "MODULE_EDITION=CE" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "MODULE_EDITION=EE" >> "$GITHUB_OUTPUT"
60+
fi
61+
2162
dev_setup_build:
2263
runs-on: [self-hosted, regular, selectel]
2364
name: Build and Push images
65+
needs: [set_edition]
66+
env:
67+
MODULE_EDITION: ${{needs.set_edition.outputs.module_edition}}
2468
steps:
2569
- name: Set vars for PR
2670
if: ${{ github.ref_name != 'main' }}
2771
run: |
2872
MODULES_MODULE_TAG="$(echo pr${{ github.ref_name }} | sed 's/\/.*//g')"
2973
echo "MODULES_MODULE_TAG=$MODULES_MODULE_TAG" >> "$GITHUB_ENV"
30-
shell: bash
3174
- name: Set vars for main
3275
if: ${{ github.ref_name == 'main' }}
3376
run: |
3477
echo "MODULES_MODULE_TAG=${{ github.ref_name }}" >> "$GITHUB_ENV"
35-
shell: bash
3678
- name: Print vars
3779
run: |
3880
echo MODULES_REGISTRY=$MODULES_REGISTRY
3981
echo CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME
4082
echo MODULES_MODULE_NAME=$MODULES_MODULE_NAME
4183
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE
4284
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG
43-
shell: bash
85+
echo MODULE_EDITION=$MODULE_EDITION
4486
4587
- uses: actions/checkout@v4
4688
- uses: deckhouse/modules-actions/setup@v1

.github/workflows/build_prod.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ jobs:
2525
- name: SET VAR
2626
run: |
2727
echo "MODULES_MODULE_SOURCE=$MODULES_REGISTRY/$MODULE_SOURCE_NAME/ce/modules" >> "$GITHUB_ENV"
28+
echo "MODULE_EDITION=CE" >> "$GITHUB_ENV"
2829
- run: |
2930
echo $MODULES_REGISTRY
3031
echo $MODULES_MODULE_NAME
3132
echo $MODULES_MODULE_SOURCE
3233
echo $MODULES_MODULE_TAG
34+
echo $MODULE_EDITION
3335
shell: bash
3436
name: Show vars
3537
@@ -58,11 +60,13 @@ jobs:
5860
- name: SET VAR
5961
run: |
6062
echo "MODULES_MODULE_SOURCE=$MODULES_REGISTRY/$MODULE_SOURCE_NAME/ee/modules" >> "$GITHUB_ENV"
63+
echo "MODULE_EDITION=EE" >> "$GITHUB_ENV"
6164
- run: |
6265
echo $MODULES_REGISTRY
6366
echo $MODULES_MODULE_NAME
6467
echo $MODULES_MODULE_SOURCE
6568
echo $MODULES_MODULE_TAG
69+
echo $MODULE_EDITION
6670
shell: bash
6771
name: Show vars
6872
@@ -91,11 +95,13 @@ jobs:
9195
- name: SET VAR
9296
run: |
9397
echo "MODULES_MODULE_SOURCE=$MODULES_REGISTRY/$MODULE_SOURCE_NAME/fe/modules" >> "$GITHUB_ENV"
98+
echo "MODULE_EDITION=EE" >> "$GITHUB_ENV"
9499
- run: |
95100
echo $MODULES_REGISTRY
96101
echo $MODULES_MODULE_NAME
97102
echo $MODULES_MODULE_SOURCE
98103
echo $MODULES_MODULE_TAG
104+
echo $MODULE_EDITION
99105
shell: bash
100106
name: Show vars
101107
@@ -124,11 +130,13 @@ jobs:
124130
- name: SET VAR
125131
run: |
126132
echo "MODULES_MODULE_SOURCE=$MODULES_REGISTRY/$MODULE_SOURCE_NAME/se/modules" >> "$GITHUB_ENV"
133+
echo "MODULE_EDITION=EE" >> "$GITHUB_ENV"
127134
- run: |
128135
echo $MODULES_REGISTRY
129136
echo $MODULES_MODULE_NAME
130137
echo $MODULES_MODULE_SOURCE
131138
echo $MODULES_MODULE_TAG
139+
echo $MODULE_EDITION
132140
shell: bash
133141
name: Show vars
134142
@@ -157,11 +165,13 @@ jobs:
157165
- name: SET VAR
158166
run: |
159167
echo "MODULES_MODULE_SOURCE=$MODULES_REGISTRY/$MODULE_SOURCE_NAME/se-plus/modules" >> "$GITHUB_ENV"
168+
echo "MODULE_EDITION=EE" >> "$GITHUB_ENV"
160169
- run: |
161170
echo $MODULES_REGISTRY
162171
echo $MODULES_MODULE_NAME
163172
echo $MODULES_MODULE_SOURCE
164173
echo $MODULES_MODULE_TAG
174+
echo $MODULE_EDITION
165175
shell: bash
166176
name: Show vars
167177

.github/workflows/go_lint.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Go linter for images
22

3+
env:
4+
GO_BUILD_TAGS: "EE CE"
5+
36
on:
47
pull_request:
58
push:
@@ -27,17 +30,18 @@ jobs:
2730
run: |
2831
basedir=$(pwd)
2932
failed='false'
30-
for dir in $(find images -type d); do
31-
if ls $dir/go.mod &> /dev/null; then
32-
echo "Running linter in $dir"
33-
cd $dir
34-
golangci-lint run
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
3540
if [ $? -ne 0 ]; then
36-
echo "Linter failed in $dir"
41+
echo "Linter failed in $dir (edition: $edition)"
3742
failed='true'
3843
fi
39-
cd $basedir
40-
fi
44+
done
4145
done
4246
if [ $failed == 'true' ]; then
4347
exit 1

.github/workflows/go_modules_check.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ jobs:
4444
if [[ "$line" == *github.com/deckhouse/sds-* || "$line" == *github.com/deckhouse/csi-* || "$line" == *github.com/deckhouse/virtualization ]]; then
4545
repository=$(echo "$line" | awk '{print $1}' | awk -F'/' '{ print "https://"$1"/"$2"/"$3".git" }')
4646
pseudo_tag=$(echo "$line" | awk '{print $2}')
47+
48+
go_pkg=$(echo "$line" | awk '{print $1}')
49+
if grep -q "^replace $go_pkg" $go_mod_file ;then
50+
echo "Skipping $go_pkg check because it exists in replacement"
51+
continue
52+
fi
53+
4754
echo "Cloning repo $repository into $temp_dir"
48-
4955
git clone "$repository" "$temp_dir/$repository" >/dev/null 2>&1
5056
5157
if [ -d "$temp_dir/$repository/api" ]; then
@@ -68,7 +74,7 @@ jobs:
6874
else
6975
echo "No api directory in $repository"
7076
fi
71-
77+
7278
rm -rf "$temp_dir/$repository"
7379
fi
7480
done < "$go_mod_file"

.github/workflows/go_tests.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Go tests for images
22

3+
env:
4+
GO_BUILD_TAGS: "EE CE"
5+
36
on:
47
pull_request:
58
push:
@@ -24,17 +27,18 @@ jobs:
2427
run: |
2528
basedir=$(pwd)
2629
failed='false'
27-
for dir in $(find images -type d); do
28-
if ls $dir/*_test.go &> /dev/null; then
29-
echo "Running tests in $dir"
30-
cd $dir
31-
go test -v
30+
for i in $(find images -type f -name '*_test.go');do
31+
dir=$(echo $i | sed 's/[a-z_A-Z0-9-]*_test.go$//')
32+
cd $basedir/$dir
33+
# check all editions
34+
for edition in $GO_BUILD_TAGS ;do
35+
echo "Running tests in $dir (edition: $edition)"
36+
go test -v -tags $edition
3237
if [ $? -ne 0 ]; then
33-
echo "Tests failed in $dir"
38+
echo "Tests failed in $dir (edition: $edition)"
3439
failed='true'
3540
fi
36-
cd $basedir
37-
fi
41+
done
3842
done
3943
if [ $failed == 'true' ]; then
4044
exit 1

.github/workflows/trivy_image_check.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ on:
1212
pull_request:
1313

1414
jobs:
15+
build_dev:
16+
uses: ./.github/workflows/build_dev.yml
17+
secrets: inherit
1518
test:
1619
name: Trivy images check
1720
runs-on: [self-hosted, regular]
21+
needs: [build_dev]
1822

1923
steps:
2024
- uses: actions/checkout@v4

.werf/bundle.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Bundle image, stored in your.registry.io/modules/<module-name>:<semver>
22
---
33
image: bundle
4-
from: registry.deckhouse.io/base_images/scratch@sha256:b054705fcc9f2205777d80a558d920c0b4209efdc3163c22b5bfcb5dda1db5fc
5-
fromCacheVersion: "2024-09-22.1"
4+
from: {{ $.BASE_SCRATCH }}
65
import:
76
# Rendering .werf/images-digests.yaml is required!
87
- image: images-digests
@@ -14,6 +13,11 @@ import:
1413
add: /lib/python/dist
1514
to: /lib/python/dist
1615
after: setup
16+
# Rendering .werf/choise-edition.yaml is required!
17+
- image: choise-edition
18+
add: /openapi
19+
to: /openapi
20+
after: setup
1721
git:
1822
- add: /
1923
to: /
@@ -26,6 +30,5 @@ git:
2630
- hooks
2731
- monitoring
2832
- module.yaml
29-
- openapi
3033
- templates
3134
- Chart.yaml

.werf/choise-edition.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# TODO comment here
2+
---
3+
image: choise-edition
4+
from: {{ $.BASE_ALT_P11 }}
5+
fromCacheVersion: 2025-01-31.1
6+
git:
7+
- add: /
8+
to: /
9+
includePaths:
10+
- openapi
11+
shell:
12+
setup:
13+
- cd /openapi
14+
- cp -v values_{{ .MODULE_EDITION }}.yaml values.yaml
15+
- rm -rf values_*.yaml

.werf/consts.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
{{- $_ := set . "BASE_GOLANG_1_23" "registry.deckhouse.io/base_images/golang:1.23.4-bookworm@sha256:a9147a48ac5e925a66764afae7cf4b1cfd37a6e94ad7519eca74c1fd8993ae45" }}
33
{{- $_ := set . "BASE_SCRATCH" "registry.deckhouse.io/base_images/scratch@sha256:653ae76965c98c8cd1c8c9ff7725316d2983986f896655b30e0f44d2f8b2dd7e" }}
44
{{- $_ := set . "BASE_ALT_P11" "registry.deckhouse.io/base_images/alt:p11@sha256:e47d84424485d3674240cb2f67d3a1801b37d327e6d1eb8cc8d01be8ed3b34f3" }}
5+
{{- $_ := set . "BASE_ALPINE_3_16" "registry.deckhouse.io/base_images/alpine:3.16.3" }}
6+
{{- $_ := set . "BASE_ALPINE_3_20" "registry.deckhouse.io/base_images/alpine:3.20.3@sha256:41628df7c9b935d248f64542634e7a843f9bc7f2252d7f878e77f7b79a947466" }}
7+
8+
# Edition module settings, default EE
9+
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION" "EE") }}
510

611
# component versions
712
{{- $versions := dict }}
13+
{{- $_ := set $versions "KMOD" "v33" }}
14+
{{- $_ := set $versions "KTLS_UTILS" "ktls-utils-0.11" }}
815
{{- $_ := set $versions "CSI_DRIVER_NFS" "v4.7.0" }}
916
{{- $_ := set $versions "NFS_UTILS" "nfs-utils-2-7-1" }} # must match the nfs-utils package from BASE_ALT_P11
1017
{{- $_ := set $ "VERSIONS" $versions }}

.werf/images-digests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Images Digest: a files with all image digests to be able to use them in helm templates of a module
1414
---
1515
image: images-digests
16-
from: registry.deckhouse.io/base_images/alpine:3.16.3
16+
from: {{ $.BASE_ALPINE_3_20 }}
1717
dependencies:
1818
{{- range $ImageID := $ImagesIDList }}
1919
{{- $ImageNameCamel := $ImageID | splitList "/" | last | camelcase | untitle }}

0 commit comments

Comments
 (0)