Skip to content

Commit 14e6d51

Browse files
chore(ci): delve option for virtualization-controller
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
1 parent 81a2a7c commit 14e6d51

5 files changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/dev_module_build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ on:
3535
type: number
3636
pull_request:
3737
types: [opened, reopened, synchronize, labeled, unlabeled]
38+
branches:
39+
- main
40+
- chore/dev/dev-build-virtualization-controller
3841
push:
3942
branches:
4043
- main
@@ -56,6 +59,7 @@ jobs:
5659
modules_module_tag: ${{ steps.modules_module_tag.outputs.MODULES_MODULE_TAG }}
5760
module_edition: ${{ steps.modules_module_tag.outputs.MODULE_EDITION }}
5861
runner_type: ${{ steps.modules_module_tag.outputs.RUNNER_TYPE }}
62+
delve_debug: ${{ steps.modules_module_tag.outputs.DELVE_DEBUG }}
5963
steps:
6064
- name: Get Pull Request Labels
6165
id: get-labels
@@ -107,6 +111,13 @@ jobs:
107111
echo "RUNNER_TYPE=[\"self-hosted\", \"regular\", \"selectel\"]" >> "$GITHUB_OUTPUT"
108112
fi
109113
114+
# Delve debug
115+
if echo "${{ steps.get-labels.outputs.result }}" | grep -q "delve/"; then
116+
echo "DELVE_DEBUG=true" >> "$GITHUB_OUTPUT"
117+
else
118+
echo "DELVE_DEBUG=false" >> "$GITHUB_OUTPUT"
119+
fi
120+
110121
show_dev_manifest:
111122
runs-on: ubuntu-latest
112123
name: Show manifest
@@ -228,6 +239,7 @@ jobs:
228239
MODULES_MODULE_TAG: ${{needs.set_vars.outputs.modules_module_tag}}
229240
MODULE_EDITION: ${{needs.set_vars.outputs.module_edition}}
230241
WERF_VIRTUAL_MERGE: 0
242+
DELVE_DEBUG: ${{needs.set_vars.outputs.delve_debug}}
231243
steps:
232244
- name: Print vars
233245
run: |
@@ -237,6 +249,7 @@ jobs:
237249
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE
238250
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG
239251
echo MODULE_EDITION=$MODULE_EDITION
252+
echo DELVE_DEBUG=$DELVE_DEBUG
240253
241254
- uses: actions/checkout@v4
242255
with:

images/virtualization-artifact/werf.inc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ mount:
2424
to: /go/pkg
2525
shell:
2626
install:
27+
{{- if eq $.DELVE_DEBUG "true" }}
28+
- go install github.com/go-delve/delve/cmd/dlv@latest
29+
{{- end }}
2730
- cd /usr/local/go/src/virtualization-controller
2831
- go mod download
2932
setup:

images/virtualization-controller/werf.inc.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ import:
66
add: /usr/local/go/src/virtualization-controller/virtualization-controller
77
to: /app/virtualization-controller
88
after: install
9+
{{- if eq $.DELVE_DEBUG "true" }}
10+
- image: virtualization-artifact
11+
add: /go/bin/dlv
12+
to: /app/dlv
13+
after: install
14+
{{- end }}
915
docker:
1016
USER: 64535
1117
WORKDIR: "/app"
18+
{{- if eq $.DELVE_DEBUG "true" }}
19+
ENTRYPOINT: ["./dlv", "--listen=:2345", "--headless=true", "--continue", "--log=true", "--log-output=debugger,debuglineerr,gdbwire,lldbout,rpc", "--accept-multiclient", "--api-version=2", "exec", "./virtualization-controller", "--"]
20+
{{- else }}
1221
ENTRYPOINT: ["/app/virtualization-controller"]
22+
{{- end }}

werf-giterminism.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ config:
66
- MODULES_MODULE_TAG
77
- SOURCE_REPO
88
- MODULE_EDITION
9+
- DELVE_DEBUG
910
stapel:
1011
mount:
1112
allowBuildDir: true

werf.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ configVersion: 1
4646
# Edition module settings
4747
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }}
4848

49+
# Delve debag
50+
{{- $_ := set . "DELVE_DEBUG" (env "DELVE_DEBUG" "false") }}
51+
52+
4953
# Component versions
5054
{{ $_ := set . "Version" dict }}
5155
{{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }}
@@ -86,6 +90,7 @@ dockerfile: Dockerfile
8690
{{- $_ := set $ctx "Images" $Root.Images }}
8791
{{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }}
8892
{{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }}
93+
{{- $_ := set $ctx "DELVE_DEBUG" $Root.DELVE_DEBUG }}
8994
{{- $_ := set $ctx "Version" $Root.Version }}
9095

9196
{{- include "module_image_template" $ctx }}

0 commit comments

Comments
 (0)