diff --git a/go/helper-image/Dockerfile b/go/helper-image/Dockerfile index e1bca021..ac0cb1b8 100644 --- a/go/helper-image/Dockerfile +++ b/go/helper-image/Dockerfile @@ -4,7 +4,7 @@ ARG BUILDPLATFORM ARG TARGETOS ARG TARGETARCH -ARG DELVE_VERSION=1.20.1 +ARG DELVE_VERSION=1.23.0 # 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. @@ -19,8 +19,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN curl --location --output delve.tar.gz https://github.com/go-delve/delve/archive/v$DELVE_VERSION.tar.gz \ && tar xzf delve.tar.gz \ && mv delve-$DELVE_VERSION delve-source -COPY delve-*.patch . -RUN patch -p0 -d delve-source < delve-as-options.patch # Produce an as-static-as-possible dlv binary to work on musl and glibc RUN cd delve-source \ diff --git a/go/helper-image/delve-as-options.patch b/go/helper-image/delve-as-options.patch deleted file mode 100644 index 2405efe6..00000000 --- a/go/helper-image/delve-as-options.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git cmd/dlv/cmds/commands.go cmd/dlv/cmds/commands.go -index 15df5f6..f145330 100644 ---- cmd/dlv/cmds/commands.go -+++ cmd/dlv/cmds/commands.go -@@ -46,6 +46,10 @@ var ( - apiVersion int - // acceptMulti allows multiple clients to connect to the same server - acceptMulti bool -+ // checkGoVersionDefault sets default for --check-go-version -+ checkGoVersionDefault = "true" -+ // checkLocalConnUserDefault sets default for --only-same-user -+ checkLocalConnUserDefault = "true" - // addr is the debugging server listen address. - addr string - // initFile is the path to initialization file. -@@ -139,8 +143,8 @@ func New(docCall bool) *cobra.Command { - rootCommand.PersistentFlags().StringVar(&initFile, "init", "", "Init file, executed by the terminal client.") - rootCommand.PersistentFlags().StringVar(&buildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler. For example: --build-flags=\"-tags=integration -mod=vendor -cover -v\"") - rootCommand.PersistentFlags().StringVar(&workingDir, "wd", "", "Working directory for running the program.") -- rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", true, "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.") -- rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", true, "Only connections from the same user that started this instance of Delve are allowed to connect.") -+ rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", parseBool(checkGoVersionDefault), "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.") -+ rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", parseBool(checkLocalConnUserDefault), "Only connections from the same user that started this instance of Delve are allowed to connect.") - rootCommand.PersistentFlags().StringVar(&backend, "backend", "default", `Backend selection (see 'dlv help backend').`) - rootCommand.PersistentFlags().StringArrayVarP(&redirects, "redirect", "r", []string{}, "Specifies redirect rules for target process (see 'dlv help redirect')") - rootCommand.PersistentFlags().BoolVar(&allowNonTerminalInteractive, "allow-non-terminal-interactive", false, "Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr") -@@ -1020,3 +1024,14 @@ func parseRedirects(redirects []string) ([3]string, error) { - } - return r, nil - } -+ -+// parseBool parses a boolean value represented by a string, and panics if there is an error. -+// It is intended for boolean build-time constants that are set with 'go build -ldflags=-X xxx=bool' -+// and should only be a valid value. -+func parseBool(value string) bool { -+ b, err := strconv.ParseBool(value) -+ if err != nil { -+ panic(err) -+ } -+ return b -+} diff --git a/go/skaffold.yaml b/go/skaffold.yaml index bda83a79..6515b5c5 100644 --- a/go/skaffold.yaml +++ b/go/skaffold.yaml @@ -37,37 +37,42 @@ profiles: # integration: set of `skaffold debug`-like integration tests - name: integration + build: + local: + useBuildkit: true + push: false patches: - op: add path: /build/artifacts/- value: - image: go118app + image: go121app context: test/goapp docker: buildArgs: - GOVERSION: 1.18 + GOVERSION: '1.21' - op: add path: /build/artifacts/- value: - image: go119app + image: go122app context: test/goapp docker: buildArgs: - GOVERSION: 1.19 + GOVERSION: '1.22' - op: add path: /build/artifacts/- value: - image: go120app + image: go123app context: test/goapp docker: buildArgs: - GOVERSION: '1.20' + GOVERSION: '1.23' + deploy: kubectl: manifests: - - test/k8s-test-go118.yaml - - test/k8s-test-go119.yaml - - test/k8s-test-go120.yaml + - test/k8s-test-go121.yaml + - test/k8s-test-go122.yaml + - test/k8s-test-go123.yaml # release: pushes images to production with :latest - name: release diff --git a/go/test/k8s-test-go115.yaml b/go/test/k8s-test-go115.yaml deleted file mode 100644 index 988f35b4..00000000 --- a/go/test/k8s-test-go115.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# This test approximates `skaffold debug` for a go app. -apiVersion: v1 -kind: Pod -metadata: - name: go115pod - labels: - app: hello - protocol: dlv - runtime: go115 -spec: - containers: - - name: go115app - image: go115app - 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-go115 -spec: - ports: - - name: http - port: 8080 - protocol: TCP - - name: dlv - port: 56286 - protocol: TCP - selector: - app: hello - protocol: dlv - runtime: go115 - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: connect-to-go115 - labels: - project: container-debug-support - type: integration-test -spec: - ttlSecondsAfterFinished: 10 - backoffLimit: 1 - template: - spec: - restartPolicy: Never - initContainers: - - name: wait-for-go115pod - image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go115:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] - containers: - - name: dlv-to-go115 - 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-go115:56286'] - - diff --git a/go/test/k8s-test-go116.yaml b/go/test/k8s-test-go116.yaml deleted file mode 100644 index a54cefa7..00000000 --- a/go/test/k8s-test-go116.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# This test approximates `skaffold debug` for a go app. -apiVersion: v1 -kind: Pod -metadata: - name: go116pod - labels: - app: hello - protocol: dlv - runtime: go116 -spec: - containers: - - name: go116app - image: go116app - 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-go116 -spec: - ports: - - name: http - port: 8080 - protocol: TCP - - name: dlv - port: 56286 - protocol: TCP - selector: - app: hello - protocol: dlv - runtime: go116 - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: connect-to-go116 - labels: - project: container-debug-support - type: integration-test -spec: - ttlSecondsAfterFinished: 10 - backoffLimit: 1 - template: - spec: - restartPolicy: Never - initContainers: - - name: wait-for-go116pod - image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go116:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] - containers: - - name: dlv-to-go116 - 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-go116:56286'] - - diff --git a/go/test/k8s-test-go117.yaml b/go/test/k8s-test-go117.yaml deleted file mode 100644 index b45bc81b..00000000 --- a/go/test/k8s-test-go117.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# This test approximates `skaffold debug` for a go app. -apiVersion: v1 -kind: Pod -metadata: - name: go117pod - labels: - app: hello - protocol: dlv - runtime: go117 -spec: - containers: - - name: go117app - image: go117app - 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-go117 -spec: - ports: - - name: http - port: 8080 - protocol: TCP - - name: dlv - port: 56286 - protocol: TCP - selector: - app: hello - protocol: dlv - runtime: go117 - ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: connect-to-go117 - labels: - project: container-debug-support - type: integration-test -spec: - ttlSecondsAfterFinished: 10 - backoffLimit: 1 - template: - spec: - restartPolicy: Never - initContainers: - - name: wait-for-go117pod - image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go117:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] - containers: - - name: dlv-to-go117 - 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-go117:56286'] - - diff --git a/go/test/k8s-test-go118.yaml b/go/test/k8s-test-go118.yaml deleted file mode 100644 index fd51bdf0..00000000 --- a/go/test/k8s-test-go118.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# 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'] - - diff --git a/go/test/k8s-test-go119.yaml b/go/test/k8s-test-go119.yaml deleted file mode 100644 index 85f184df..00000000 --- a/go/test/k8s-test-go119.yaml +++ /dev/null @@ -1,91 +0,0 @@ -# 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'] - - diff --git a/go/test/k8s-test-go120.yaml b/go/test/k8s-test-go121.yaml similarity index 84% rename from go/test/k8s-test-go120.yaml rename to go/test/k8s-test-go121.yaml index 3c9991ad..8f1fb2ad 100644 --- a/go/test/k8s-test-go120.yaml +++ b/go/test/k8s-test-go121.yaml @@ -2,15 +2,15 @@ apiVersion: v1 kind: Pod metadata: - name: go120pod + name: go121pod labels: app: hello protocol: dlv - runtime: go120 + runtime: go121 spec: containers: - - name: go120app - image: go120app + - name: go121app + image: go121app args: - /dbg/go/bin/dlv - exec @@ -48,7 +48,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: hello-dlv-go120 + name: hello-dlv-go121 spec: ports: - name: http @@ -60,13 +60,13 @@ spec: selector: app: hello protocol: dlv - runtime: go120 + runtime: go121 --- apiVersion: batch/v1 kind: Job metadata: - name: connect-to-go120 + name: connect-to-go121 labels: project: container-debug-support type: integration-test @@ -77,13 +77,13 @@ spec: spec: restartPolicy: Never initContainers: - - name: wait-for-go120 + - name: wait-for-go121 image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go120:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] + 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-go120 + - 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-go120:56286'] + /duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go121:56286'] diff --git a/go/test/k8s-test-go113.yaml b/go/test/k8s-test-go122.yaml similarity index 84% rename from go/test/k8s-test-go113.yaml rename to go/test/k8s-test-go122.yaml index ab4be2f3..fb2a13a3 100644 --- a/go/test/k8s-test-go113.yaml +++ b/go/test/k8s-test-go122.yaml @@ -2,15 +2,15 @@ apiVersion: v1 kind: Pod metadata: - name: go113pod + name: go122pod labels: app: hello protocol: dlv - runtime: go113 + runtime: go122 spec: containers: - - name: go113app - image: go113app + - name: go122app + image: go122app args: - /dbg/go/bin/dlv - exec @@ -48,7 +48,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: hello-dlv-go113 + name: hello-dlv-go122 spec: ports: - name: http @@ -60,13 +60,13 @@ spec: selector: app: hello protocol: dlv - runtime: go113 + runtime: go122 --- apiVersion: batch/v1 kind: Job metadata: - name: connect-to-go113 + name: connect-to-go122 labels: project: container-debug-support type: integration-test @@ -77,15 +77,13 @@ spec: spec: restartPolicy: Never initContainers: - - name: wait-for-go113pod + - name: wait-for-go122 image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go113:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] + 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-go113 + - 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-go113:56286'] - - + /duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go122:56286'] diff --git a/go/test/k8s-test-go114.yaml b/go/test/k8s-test-go123.yaml similarity index 84% rename from go/test/k8s-test-go114.yaml rename to go/test/k8s-test-go123.yaml index 9012b435..80e5b92c 100644 --- a/go/test/k8s-test-go114.yaml +++ b/go/test/k8s-test-go123.yaml @@ -2,15 +2,15 @@ apiVersion: v1 kind: Pod metadata: - name: go114pod + name: go123pod labels: app: hello protocol: dlv - runtime: go114 + runtime: go123 spec: containers: - - name: go114app - image: go114app + - name: go123app + image: go123app args: - /dbg/go/bin/dlv - exec @@ -48,7 +48,7 @@ spec: apiVersion: v1 kind: Service metadata: - name: hello-dlv-go114 + name: hello-dlv-go123 spec: ports: - name: http @@ -60,13 +60,13 @@ spec: selector: app: hello protocol: dlv - runtime: go114 + runtime: go123 --- apiVersion: batch/v1 kind: Job metadata: - name: connect-to-go114 + name: connect-to-go123 labels: project: container-debug-support type: integration-test @@ -77,15 +77,13 @@ spec: spec: restartPolicy: Never initContainers: - - name: wait-for-go114pod + - name: wait-for-go123 image: kubectl - command: [sh, -c, "while ! curl -s hello-dlv-go114:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] + command: [sh, -c, "while ! curl -s hello-dlv-go123:8080 2>/dev/null; do echo waiting for app; sleep 1; done"] containers: - - name: dlv-to-go114 + - name: dlv-to-go123 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-go114:56286'] - - + /duct-tape/go/bin/dlv connect --init init.txt hello-dlv-go123:56286'] diff --git a/integration/skaffold.yaml b/integration/skaffold.yaml index 8ae4d207..7984ec19 100644 --- a/integration/skaffold.yaml +++ b/integration/skaffold.yaml @@ -17,6 +17,9 @@ profiles: # integration: set of `skaffold debug`-like integration tests - name: integration build: + local: + useBuildkit: true + push: false artifacts: - image: kubectl context: kubectl diff --git a/publish.sh b/publish.sh old mode 100644 new mode 100755