Skip to content

Commit c3f8cca

Browse files
authored
fix: disable CGO on Go test app, remove deprecated --DEBUG flag in pydevd, and remove tests for unsupported Go versions (#131)
* fix: disable CGO when building Go test app * fix: remove --DEBUG flag when calling pydevd, currently is causing an inifinite loop * feat: remove support for old go versions: 13, 14, 15, 16, 17
1 parent 32da851 commit c3f8cca

File tree

3 files changed

+18
-64
lines changed

3 files changed

+18
-64
lines changed

go/skaffold.yaml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,46 +38,6 @@ profiles:
3838
# integration: set of `skaffold debug`-like integration tests
3939
- name: integration
4040
patches:
41-
- op: add
42-
path: /build/artifacts/-
43-
value:
44-
image: go113app
45-
context: test/goapp
46-
docker:
47-
buildArgs:
48-
GOVERSION: 1.13
49-
- op: add
50-
path: /build/artifacts/-
51-
value:
52-
image: go114app
53-
context: test/goapp
54-
docker:
55-
buildArgs:
56-
GOVERSION: 1.14
57-
- op: add
58-
path: /build/artifacts/-
59-
value:
60-
image: go115app
61-
context: test/goapp
62-
docker:
63-
buildArgs:
64-
GOVERSION: 1.15
65-
- op: add
66-
path: /build/artifacts/-
67-
value:
68-
image: go116app
69-
context: test/goapp
70-
docker:
71-
buildArgs:
72-
GOVERSION: 1.16
73-
- op: add
74-
path: /build/artifacts/-
75-
value:
76-
image: go117app
77-
context: test/goapp
78-
docker:
79-
buildArgs:
80-
GOVERSION: 1.17
8141
- op: add
8242
path: /build/artifacts/-
8343
value:
@@ -105,11 +65,6 @@ profiles:
10565
deploy:
10666
kubectl:
10767
manifests:
108-
- test/k8s-test-go113.yaml
109-
- test/k8s-test-go114.yaml
110-
- test/k8s-test-go115.yaml
111-
- test/k8s-test-go116.yaml
112-
- test/k8s-test-go117.yaml
11368
- test/k8s-test-go118.yaml
11469
- test/k8s-test-go119.yaml
11570
- test/k8s-test-go120.yaml

go/test/goapp/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG TARGETOS
55
ARG TARGETARCH
66

77
COPY main.go .
8-
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -gcflags="all=-N -l" -o /app main.go
8+
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -gcflags="all=-N -l" -o /app main.go
99

1010
FROM --platform=$BUILDPLATFORM gcr.io/distroless/base
1111
CMD ["./app"]

python/helper-image/launcher/launcher.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ limitations under the License.
4141
//
4242
// This launcher is expected to be invoked as follows:
4343
//
44-
// launcher --mode <pydevd|pydevd-pycharm|debugpy|ptvsd> \
45-
// --port p [--wait] -- original-command-line ...
44+
// launcher --mode <pydevd|pydevd-pycharm|debugpy|ptvsd> \
45+
// --port p [--wait] -- original-command-line ...
4646
//
4747
// This launcher determines the python executable based on
4848
// `original-command-line`, unwrapping any python scripts, and
@@ -65,22 +65,24 @@ limitations under the License.
6565
// ```
6666
// and will then invoke:
6767
// ```
68-
// python -m pydevd --server --port 5678 --DEBUG --continue \
69-
// --file /tmp/pydevd716531212/skaffold_pydevd_launch.py
68+
//
69+
// python -m pydevd --server --port 5678 --continue \
70+
// --file /tmp/pydevd716531212/skaffold_pydevd_launch.py
71+
//
7072
// ```
7173
//
7274
// The launcher can be configured through several environment
7375
// variables:
7476
//
75-
// - Set `WRAPPER_ENABLED=false` to disable the launcher: the
76-
// launcher will execute the original-command-line as-is.
77-
// - Set `WRAPPER_SKIP_ENV=true` to avoid setting PYTHONPATH
78-
// to point to bundled debugging backends: this is useful if
79-
// your app already includes `debugpy`.
80-
// - Set `WRAPPER_PYTHON_VERSION=3.9` to avoid trying to determine
81-
// the python version by executing `python -V`
82-
// - Set `WRAPPER_VERBOSE` to one of `error`, `warn`, `info`, `debug`,
83-
// or `trace` to reduce or increase the verbosity
77+
// - Set `WRAPPER_ENABLED=false` to disable the launcher: the
78+
// launcher will execute the original-command-line as-is.
79+
// - Set `WRAPPER_SKIP_ENV=true` to avoid setting PYTHONPATH
80+
// to point to bundled debugging backends: this is useful if
81+
// your app already includes `debugpy`.
82+
// - Set `WRAPPER_PYTHON_VERSION=3.9` to avoid trying to determine
83+
// the python version by executing `python -V`
84+
// - Set `WRAPPER_VERBOSE` to one of `error`, `warn`, `info`, `debug`,
85+
// or `trace` to reduce or increase the verbosity
8486
package main
8587

8688
import (
@@ -371,8 +373,8 @@ func (pc *pythonContext) updateCommandLine(ctx context.Context) error {
371373
// debugpy expects the `-m` module argument to be separate
372374
for i, arg := range pc.args[1:] {
373375
if i == 0 && arg != "-m" && strings.HasPrefix(arg, "-m") {
374-
cmdline = append(cmdline, "-m", strings.TrimPrefix(arg, "-m"))
375-
} else {
376+
cmdline = append(cmdline, "-m", strings.TrimPrefix(arg, "-m"))
377+
} else {
376378
cmdline = append(cmdline, arg)
377379
}
378380
}
@@ -382,9 +384,6 @@ func (pc *pythonContext) updateCommandLine(ctx context.Context) error {
382384
// Appropriate location to resolve pydevd is set in updateEnv
383385
cmdline = append(cmdline, pc.args[0])
384386
cmdline = append(cmdline, "-m", "pydevd", "--server", "--port", strconv.Itoa(int(pc.port)))
385-
if pc.env["WRAPPER_VERBOSE"] != "" {
386-
cmdline = append(cmdline, "--DEBUG")
387-
}
388387
if !pc.wait {
389388
cmdline = append(cmdline, "--continue")
390389
}

0 commit comments

Comments
 (0)