Skip to content

Commit

Permalink
feat(go): support Go 1.19 and Delve 1.9.1 (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandealwis authored Sep 9, 2022
1 parent 298e5e5 commit a8b41f5
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/helper-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ARG GOVERSION=1.17
ARG GOVERSION=1.19
FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as delve
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH

ARG DELVE_VERSION=1.8.1
ARG DELVE_VERSION=1.9.1

# Patch delve to make defaults for --check-go-version and --only-same-user
# to be set at build time. We must install patch(1) to apply the patch.
Expand Down
18 changes: 18 additions & 0 deletions go/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ profiles:
docker:
buildArgs:
GOVERSION: 1.17
- op: add
path: /build/artifacts/-
value:
image: go118app
context: test/goapp
docker:
buildArgs:
GOVERSION: 1.18
- op: add
path: /build/artifacts/-
value:
image: go119app
context: test/goapp
docker:
buildArgs:
GOVERSION: 1.19
deploy:
kubectl:
manifests:
Expand All @@ -86,6 +102,8 @@ profiles:
- test/k8s-test-go115.yaml
- test/k8s-test-go116.yaml
- test/k8s-test-go117.yaml
- test/k8s-test-go118.yaml
- test/k8s-test-go119.yaml

# release: pushes images to production with :latest
- name: release
Expand Down
91 changes: 91 additions & 0 deletions go/test/k8s-test-go118.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This test approximates `skaffold debug` for a go app.
apiVersion: v1
kind: Pod
metadata:
name: go118pod
labels:
app: hello
protocol: dlv
runtime: go118
spec:
containers:
- name: go118app
image: go118app
args:
- /dbg/go/bin/dlv
- exec
- --log
- --headless
- --continue
- --accept-multiclient
# listen on 0.0.0.0 as it is exposed as a service
- --listen=0.0.0.0:56286
- --api-version=2
- ./app
ports:
- containerPort: 8080
- containerPort: 56286
name: dlv
readinessProbe:
httpGet:
path: /
port: 8080
volumeMounts:
- mountPath: /dbg
name: go-debugging-support
initContainers:
- image: skaffold-debug-go
name: install-go-support
resources: {}
volumeMounts:
- mountPath: /dbg
name: go-debugging-support
volumes:
- emptyDir: {}
name: go-debugging-support

---
apiVersion: v1
kind: Service
metadata:
name: hello-dlv-go118
spec:
ports:
- name: http
port: 8080
protocol: TCP
- name: dlv
port: 56286
protocol: TCP
selector:
app: hello
protocol: dlv
runtime: go118

---
apiVersion: batch/v1
kind: Job
metadata:
name: connect-to-go118
labels:
project: container-debug-support
type: integration-test
spec:
ttlSecondsAfterFinished: 10
backoffLimit: 1
template:
spec:
restartPolicy: Never
initContainers:
- name: wait-for-go118pod
image: kubectl
command: [sh, -c, "while ! curl -s hello-dlv-go118:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
containers:
- name: dlv-to-go118
image: skaffold-debug-go
command: [sh, -c, '
(echo bt; echo exit -c) > init.txt;
set -x;
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go118:56286']


91 changes: 91 additions & 0 deletions go/test/k8s-test-go119.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This test approximates `skaffold debug` for a go app.
apiVersion: v1
kind: Pod
metadata:
name: go119pod
labels:
app: hello
protocol: dlv
runtime: go119
spec:
containers:
- name: go119app
image: go119app
args:
- /dbg/go/bin/dlv
- exec
- --log
- --headless
- --continue
- --accept-multiclient
# listen on 0.0.0.0 as it is exposed as a service
- --listen=0.0.0.0:56286
- --api-version=2
- ./app
ports:
- containerPort: 8080
- containerPort: 56286
name: dlv
readinessProbe:
httpGet:
path: /
port: 8080
volumeMounts:
- mountPath: /dbg
name: go-debugging-support
initContainers:
- image: skaffold-debug-go
name: install-go-support
resources: {}
volumeMounts:
- mountPath: /dbg
name: go-debugging-support
volumes:
- emptyDir: {}
name: go-debugging-support

---
apiVersion: v1
kind: Service
metadata:
name: hello-dlv-go119
spec:
ports:
- name: http
port: 8080
protocol: TCP
- name: dlv
port: 56286
protocol: TCP
selector:
app: hello
protocol: dlv
runtime: go119

---
apiVersion: batch/v1
kind: Job
metadata:
name: connect-to-go119
labels:
project: container-debug-support
type: integration-test
spec:
ttlSecondsAfterFinished: 10
backoffLimit: 1
template:
spec:
restartPolicy: Never
initContainers:
- name: wait-for-go119pod
image: kubectl
command: [sh, -c, "while ! curl -s hello-dlv-go119:8080 2>/dev/null; do echo waiting for app; sleep 1; done"]
containers:
- name: dlv-to-go119
image: skaffold-debug-go
command: [sh, -c, '
(echo bt; echo exit -c) > init.txt;
set -x;
/duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go119:56286']


0 comments on commit a8b41f5

Please sign in to comment.