From 00fa99f09f57af7bbec52ef8432f3c6c76020b74 Mon Sep 17 00:00:00 2001 From: Zibi Mandziejewicz Date: Tue, 2 Apr 2024 15:10:17 +0700 Subject: [PATCH] feat: go 1.22 support --- go/helper-image/Dockerfile | 4 +- go/skaffold.yaml | 12 ++--- go/test/k8s-test-go121.yaml | 89 +++++++++++++++++++++++++++++++++++++ go/test/k8s-test-go122.yaml | 89 +++++++++++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+), 8 deletions(-) create mode 100644 go/test/k8s-test-go121.yaml create mode 100644 go/test/k8s-test-go122.yaml diff --git a/go/helper-image/Dockerfile b/go/helper-image/Dockerfile index e1bca021..924dd57b 100644 --- a/go/helper-image/Dockerfile +++ b/go/helper-image/Dockerfile @@ -1,10 +1,10 @@ -ARG GOVERSION=1.20 +ARG GOVERSION=1.22 FROM --platform=$BUILDPLATFORM golang:${GOVERSION} as delve ARG BUILDPLATFORM ARG TARGETOS ARG TARGETARCH -ARG DELVE_VERSION=1.20.1 +ARG DELVE_VERSION=1.22.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. diff --git a/go/skaffold.yaml b/go/skaffold.yaml index bda83a79..49b94b14 100644 --- a/go/skaffold.yaml +++ b/go/skaffold.yaml @@ -41,27 +41,27 @@ profiles: - op: add path: /build/artifacts/- value: - image: go118app + image: go119app context: test/goapp docker: buildArgs: - GOVERSION: 1.18 + GOVERSION: '1.19' - op: add path: /build/artifacts/- value: - image: go119app + image: go120app context: test/goapp docker: buildArgs: - GOVERSION: 1.19 + GOVERSION: '1.20' - op: add path: /build/artifacts/- value: - image: go120app + image: go121app context: test/goapp docker: buildArgs: - GOVERSION: '1.20' + GOVERSION: '1.22' deploy: kubectl: manifests: diff --git a/go/test/k8s-test-go121.yaml b/go/test/k8s-test-go121.yaml new file mode 100644 index 00000000..8f1fb2ad --- /dev/null +++ b/go/test/k8s-test-go121.yaml @@ -0,0 +1,89 @@ +# This test approximates `skaffold debug` for a go app. +apiVersion: v1 +kind: Pod +metadata: + name: go121pod + labels: + app: hello + protocol: dlv + runtime: go121 +spec: + containers: + - name: go121app + image: go121app + 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-go121 +spec: + ports: + - name: http + port: 8080 + protocol: TCP + - name: dlv + port: 56286 + protocol: TCP + selector: + app: hello + protocol: dlv + runtime: go121 + +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: connect-to-go121 + labels: + project: container-debug-support + type: integration-test +spec: + ttlSecondsAfterFinished: 10 + backoffLimit: 1 + template: + spec: + restartPolicy: Never + initContainers: + - name: wait-for-go121 + image: kubectl + command: [sh, -c, "while ! curl -s hello-dlv-go121:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] + containers: + - name: dlv-to-go121 + 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-go121:56286'] diff --git a/go/test/k8s-test-go122.yaml b/go/test/k8s-test-go122.yaml new file mode 100644 index 00000000..fb2a13a3 --- /dev/null +++ b/go/test/k8s-test-go122.yaml @@ -0,0 +1,89 @@ +# This test approximates `skaffold debug` for a go app. +apiVersion: v1 +kind: Pod +metadata: + name: go122pod + labels: + app: hello + protocol: dlv + runtime: go122 +spec: + containers: + - name: go122app + image: go122app + 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-go122 +spec: + ports: + - name: http + port: 8080 + protocol: TCP + - name: dlv + port: 56286 + protocol: TCP + selector: + app: hello + protocol: dlv + runtime: go122 + +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: connect-to-go122 + labels: + project: container-debug-support + type: integration-test +spec: + ttlSecondsAfterFinished: 10 + backoffLimit: 1 + template: + spec: + restartPolicy: Never + initContainers: + - name: wait-for-go122 + image: kubectl + command: [sh, -c, "while ! curl -s hello-dlv-go122:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] + containers: + - name: dlv-to-go122 + 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-go122:56286']