Skip to content

Commit 1007219

Browse files
chore(ci): delve option for virtualization-controller
Signed-off-by: Nikita Korolev <[email protected]>
1 parent 81a2a7c commit 1007219

File tree

6 files changed

+30
-2
lines changed

6 files changed

+30
-2
lines changed

.github/workflows/dev_module_build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ on:
3535
type: number
3636
pull_request:
3737
types: [opened, reopened, synchronize, labeled, unlabeled]
38+
branches:
39+
- chore/dev/dev-build-virtualization-controller
3840
push:
3941
branches:
4042
- main
@@ -56,6 +58,7 @@ jobs:
5658
modules_module_tag: ${{ steps.modules_module_tag.outputs.MODULES_MODULE_TAG }}
5759
module_edition: ${{ steps.modules_module_tag.outputs.MODULE_EDITION }}
5860
runner_type: ${{ steps.modules_module_tag.outputs.RUNNER_TYPE }}
61+
delve_debug: ${{ steps.modules_module_tag.outputs.DELVE_DEBUG }}
5962
steps:
6063
- name: Get Pull Request Labels
6164
id: get-labels
@@ -107,6 +110,13 @@ jobs:
107110
echo "RUNNER_TYPE=[\"self-hosted\", \"regular\", \"selectel\"]" >> "$GITHUB_OUTPUT"
108111
fi
109112
113+
# Delve debug
114+
if echo "${{ steps.get-labels.outputs.result }}" | grep -q "delve/"; then
115+
echo "DELVE_DEBUG=true" >> "$GITHUB_OUTPUT"
116+
else
117+
echo "DELVE_DEBUG=false" >> "$GITHUB_OUTPUT"
118+
fi
119+
110120
show_dev_manifest:
111121
runs-on: ubuntu-latest
112122
name: Show manifest
@@ -228,6 +238,7 @@ jobs:
228238
MODULES_MODULE_TAG: ${{needs.set_vars.outputs.modules_module_tag}}
229239
MODULE_EDITION: ${{needs.set_vars.outputs.module_edition}}
230240
WERF_VIRTUAL_MERGE: 0
241+
DELVE_DEBUG: ${{needs.set_vars.outputs.delve_debug}}
231242
steps:
232243
- name: Print vars
233244
run: |

images/virtualization-artifact/cmd/virtualization-controller/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ import (
6262
)
6363

6464
const (
65-
logDebugControllerListEnv = "LOG_DEBUG_CONTROLLER_LIST"
66-
logDebugVerbosityEnv = "LOG_DEBUG_VERBOSITY"
65+
logDebugControllerListEnv = "LOG_DELVE_DEBUG_CONTROLLER_LIST"
66+
logDebugVerbosityEnv = "LOG_DELVE_DEBUG_VERBOSITY"
6767
logFormatEnv = "LOG_FORMAT"
6868
logLevelEnv = "LOG_LEVEL"
6969
logOutputEnv = "LOG_OUTPUT"

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 $.DELVE_DEBUG }}
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 $.DELVE_DEBUG }}
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 $.DELVE_DEBUG }}
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ configVersion: 1
4646
# Edition module settings
4747
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }}
4848

49+
# Delve debag
50+
{{- $_ := set . "DEBUG" "false" }}
51+
4952
# Component versions
5053
{{ $_ := set . "Version" dict }}
5154
{{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }}

0 commit comments

Comments
 (0)