Skip to content

Commit a8b41f5

Browse files
authored
feat(go): support Go 1.19 and Delve 1.9.1 (#119)
1 parent 298e5e5 commit a8b41f5

File tree

4 files changed

+202
-2
lines changed

4 files changed

+202
-2
lines changed

go/helper-image/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
ARG GOVERSION=1.17
1+
ARG GOVERSION=1.19
22
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as delve
33
ARG BUILDPLATFORM
44
ARG TARGETOS
55
ARG TARGETARCH
66

7-
ARG DELVE_VERSION=1.8.1
7+
ARG DELVE_VERSION=1.9.1
88

99
# Patch delve to make defaults for --check-go-version and --only-same-user
1010
# to be set at build time. We must install patch(1) to apply the patch.

go/skaffold.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ profiles:
7878
docker:
7979
buildArgs:
8080
GOVERSION: 1.17
81+
- op: add
82+
path: /build/artifacts/-
83+
value:
84+
image: go118app
85+
context: test/goapp
86+
docker:
87+
buildArgs:
88+
GOVERSION: 1.18
89+
- op: add
90+
path: /build/artifacts/-
91+
value:
92+
image: go119app
93+
context: test/goapp
94+
docker:
95+
buildArgs:
96+
GOVERSION: 1.19
8197
deploy:
8298
kubectl:
8399
manifests:
@@ -86,6 +102,8 @@ profiles:
86102
- test/k8s-test-go115.yaml
87103
- test/k8s-test-go116.yaml
88104
- test/k8s-test-go117.yaml
105+
- test/k8s-test-go118.yaml
106+
- test/k8s-test-go119.yaml
89107

90108
# release: pushes images to production with :latest
91109
- name: release

go/test/k8s-test-go118.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This test approximates `skaffold debug` for a go app.
2+
apiVersion: v1
3+
kind: Pod
4+
metadata:
5+
name: go118pod
6+
labels:
7+
app: hello
8+
protocol: dlv
9+
runtime: go118
10+
spec:
11+
containers:
12+
- name: go118app
13+
image: go118app
14+
args:
15+
- /dbg/go/bin/dlv
16+
- exec
17+
- --log
18+
- --headless
19+
- --continue
20+
- --accept-multiclient
21+
# listen on 0.0.0.0 as it is exposed as a service
22+
- --listen=0.0.0.0:56286
23+
- --api-version=2
24+
- ./app
25+
ports:
26+
- containerPort: 8080
27+
- containerPort: 56286
28+
name: dlv
29+
readinessProbe:
30+
httpGet:
31+
path: /
32+
port: 8080
33+
volumeMounts:
34+
- mountPath: /dbg
35+
name: go-debugging-support
36+
initContainers:
37+
- image: skaffold-debug-go
38+
name: install-go-support
39+
resources: {}
40+
volumeMounts:
41+
- mountPath: /dbg
42+
name: go-debugging-support
43+
volumes:
44+
- emptyDir: {}
45+
name: go-debugging-support
46+
47+
---
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: hello-dlv-go118
52+
spec:
53+
ports:
54+
- name: http
55+
port: 8080
56+
protocol: TCP
57+
- name: dlv
58+
port: 56286
59+
protocol: TCP
60+
selector:
61+
app: hello
62+
protocol: dlv
63+
runtime: go118
64+
65+
---
66+
apiVersion: batch/v1
67+
kind: Job
68+
metadata:
69+
name: connect-to-go118
70+
labels:
71+
project: container-debug-support
72+
type: integration-test
73+
spec:
74+
ttlSecondsAfterFinished: 10
75+
backoffLimit: 1
76+
template:
77+
spec:
78+
restartPolicy: Never
79+
initContainers:
80+
- name: wait-for-go118pod
81+
image: kubectl
82+
command: [sh, -c, "while ! curl -s hello-dlv-go118:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
83+
containers:
84+
- name: dlv-to-go118
85+
image: skaffold-debug-go
86+
command: [sh, -c, '
87+
(echo bt; echo exit -c) > init.txt;
88+
set -x;
89+
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go118:56286']
90+
91+

go/test/k8s-test-go119.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# This test approximates `skaffold debug` for a go app.
2+
apiVersion: v1
3+
kind: Pod
4+
metadata:
5+
name: go119pod
6+
labels:
7+
app: hello
8+
protocol: dlv
9+
runtime: go119
10+
spec:
11+
containers:
12+
- name: go119app
13+
image: go119app
14+
args:
15+
- /dbg/go/bin/dlv
16+
- exec
17+
- --log
18+
- --headless
19+
- --continue
20+
- --accept-multiclient
21+
# listen on 0.0.0.0 as it is exposed as a service
22+
- --listen=0.0.0.0:56286
23+
- --api-version=2
24+
- ./app
25+
ports:
26+
- containerPort: 8080
27+
- containerPort: 56286
28+
name: dlv
29+
readinessProbe:
30+
httpGet:
31+
path: /
32+
port: 8080
33+
volumeMounts:
34+
- mountPath: /dbg
35+
name: go-debugging-support
36+
initContainers:
37+
- image: skaffold-debug-go
38+
name: install-go-support
39+
resources: {}
40+
volumeMounts:
41+
- mountPath: /dbg
42+
name: go-debugging-support
43+
volumes:
44+
- emptyDir: {}
45+
name: go-debugging-support
46+
47+
---
48+
apiVersion: v1
49+
kind: Service
50+
metadata:
51+
name: hello-dlv-go119
52+
spec:
53+
ports:
54+
- name: http
55+
port: 8080
56+
protocol: TCP
57+
- name: dlv
58+
port: 56286
59+
protocol: TCP
60+
selector:
61+
app: hello
62+
protocol: dlv
63+
runtime: go119
64+
65+
---
66+
apiVersion: batch/v1
67+
kind: Job
68+
metadata:
69+
name: connect-to-go119
70+
labels:
71+
project: container-debug-support
72+
type: integration-test
73+
spec:
74+
ttlSecondsAfterFinished: 10
75+
backoffLimit: 1
76+
template:
77+
spec:
78+
restartPolicy: Never
79+
initContainers:
80+
- name: wait-for-go119pod
81+
image: kubectl
82+
command: [sh, -c, "while ! curl -s hello-dlv-go119:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
83+
containers:
84+
- name: dlv-to-go119
85+
image: skaffold-debug-go
86+
command: [sh, -c, '
87+
(echo bt; echo exit -c) > init.txt;
88+
set -x;
89+
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go119:56286']
90+
91+

0 commit comments

Comments
 (0)