Skip to content

chore(ci): delve option for virtualization-controller #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/dev_module_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ on:
type: number
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
branches:
- main
- chore/dev/dev-build-virtualization-controller
push:
branches:
- main
Expand All @@ -56,6 +59,7 @@ jobs:
modules_module_tag: ${{ steps.modules_module_tag.outputs.MODULES_MODULE_TAG }}
module_edition: ${{ steps.modules_module_tag.outputs.MODULE_EDITION }}
runner_type: ${{ steps.modules_module_tag.outputs.RUNNER_TYPE }}
delve_debug: ${{ steps.modules_module_tag.outputs.DELVE_DEBUG }}
steps:
- name: Get Pull Request Labels
id: get-labels
Expand Down Expand Up @@ -107,6 +111,13 @@ jobs:
echo "RUNNER_TYPE=[\"self-hosted\", \"regular\", \"selectel\"]" >> "$GITHUB_OUTPUT"
fi

# Delve debug
if echo "${{ steps.get-labels.outputs.result }}" | grep -q "delve/"; then
echo "DELVE_DEBUG=true" >> "$GITHUB_OUTPUT"
else
echo "DELVE_DEBUG=false" >> "$GITHUB_OUTPUT"
fi

show_dev_manifest:
runs-on: ubuntu-latest
name: Show manifest
Expand Down Expand Up @@ -228,6 +239,7 @@ jobs:
MODULES_MODULE_TAG: ${{needs.set_vars.outputs.modules_module_tag}}
MODULE_EDITION: ${{needs.set_vars.outputs.module_edition}}
WERF_VIRTUAL_MERGE: 0
DELVE_DEBUG: ${{needs.set_vars.outputs.delve_debug}}
steps:
- name: Print vars
run: |
Expand All @@ -237,6 +249,7 @@ jobs:
echo MODULES_MODULE_SOURCE=$MODULES_MODULE_SOURCE
echo MODULES_MODULE_TAG=$MODULES_MODULE_TAG
echo MODULE_EDITION=$MODULE_EDITION
echo DELVE_DEBUG=$DELVE_DEBUG

- uses: actions/checkout@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions images/virtualization-artifact/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ mount:
to: /go/pkg
shell:
install:
{{- if eq $.DELVE_DEBUG "true" }}
- go install github.com/go-delve/delve/cmd/dlv@latest
{{- end }}
- cd /usr/local/go/src/virtualization-controller
- go mod download
setup:
Expand Down
10 changes: 10 additions & 0 deletions images/virtualization-controller/werf.inc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ import:
add: /usr/local/go/src/virtualization-controller/virtualization-controller
to: /app/virtualization-controller
after: install
{{- if eq $.DELVE_DEBUG "true" }}
- image: virtualization-artifact
add: /go/bin/dlv
to: /app/dlv
after: install
{{- end }}
docker:
USER: 64535
WORKDIR: "/app"
{{- if eq $.DELVE_DEBUG "true" }}
ENTRYPOINT: ["./dlv", "--listen=:2345", "--headless=true", "--continue", "--log=true", "--log-output=debugger,debuglineerr,gdbwire,lldbout,rpc", "--accept-multiclient", "--api-version=2", "exec", "./virtualization-controller", "--"]
{{- else }}
ENTRYPOINT: ["/app/virtualization-controller"]
{{- end }}
1 change: 1 addition & 0 deletions werf-giterminism.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ config:
- MODULES_MODULE_TAG
- SOURCE_REPO
- MODULE_EDITION
- DELVE_DEBUG
stapel:
mount:
allowBuildDir: true
Expand Down
5 changes: 5 additions & 0 deletions werf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ configVersion: 1
# Edition module settings
{{- $_ := set . "MODULE_EDITION" (env "MODULE_EDITION") }}

# Delve debag
{{- $_ := set . "DELVE_DEBUG" (env "DELVE_DEBUG" "false") }}


# Component versions
{{ $_ := set . "Version" dict }}
{{- $versions_ctx := (.Files.Get "cv/version_map.yml" | fromYaml) }}
Expand Down Expand Up @@ -86,6 +90,7 @@ dockerfile: Dockerfile
{{- $_ := set $ctx "Images" $Root.Images }}
{{- $_ := set $ctx "SOURCE_REPO" $Root.SOURCE_REPO }}
{{- $_ := set $ctx "MODULE_EDITION" $Root.MODULE_EDITION }}
{{- $_ := set $ctx "DELVE_DEBUG" $Root.DELVE_DEBUG }}
{{- $_ := set $ctx "Version" $Root.Version }}

{{- include "module_image_template" $ctx }}
Expand Down
Loading