Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/actions/go-versions/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 'Fetch Go Versions'
description: >
Fetches go-versions.yml from dd-trace-go/main and exposes the stable and
oldstable Go versions as step outputs. Uses only curl, grep and sed — no
yq or external tool installation required.

outputs:
stable:
description: 'Stable Go minor version (e.g. "1.26")'
value: ${{ steps.parse.outputs.stable }}
oldstable:
description: 'Old-stable Go minor version (e.g. "1.25")'
value: ${{ steps.parse.outputs.oldstable }}
stable_patch:
description: 'Stable Go patch version (e.g. "1.26.0")'
value: ${{ steps.parse.outputs.stable_patch }}
oldstable_patch:
description: 'Old-stable Go patch version (e.g. "1.25.7")'
value: ${{ steps.parse.outputs.oldstable_patch }}
matrix:
description: 'JSON array of minor versions ordered [oldstable, stable] for use in strategy.matrix'
value: ${{ steps.parse.outputs.matrix }}

runs:
using: composite
steps:
- name: Fetch and parse go-versions.yml
id: parse
shell: bash
run: |
url="https://raw.githubusercontent.com/DataDog/dd-trace-go/refs/heads/main/go-versions.yml"
content=$(curl -fsSL "$url") || {
echo "ERROR: Failed to fetch go-versions.yml from ${url}" >&2
exit 1
}

stable=$(echo "$content" | grep '^stable:' | sed 's/.*"\(.*\)".*/\1/')
oldstable=$(echo "$content" | grep '^oldstable:' | sed 's/.*"\(.*\)".*/\1/')
stable_patch=$(echo "$content" | grep '^stable_patch:' | sed 's/.*"\(.*\)".*/\1/')
oldstable_patch=$(echo "$content" | grep '^oldstable_patch:' | sed 's/.*"\(.*\)".*/\1/')

if [[ -z "$stable" || -z "$oldstable" || -z "$stable_patch" || -z "$oldstable_patch" ]]; then
echo "ERROR: Failed to parse one or more keys from go-versions.yml" >&2
echo " stable='${stable}' oldstable='${oldstable}' stable_patch='${stable_patch}' oldstable_patch='${oldstable_patch}'" >&2
exit 1
fi

matrix="[\"${oldstable}\",\"${stable}\"]"

echo "stable=${stable}" >> "$GITHUB_OUTPUT"
echo "oldstable=${oldstable}" >> "$GITHUB_OUTPUT"
echo "stable_patch=${stable_patch}" >> "$GITHUB_OUTPUT"
echo "oldstable_patch=${oldstable_patch}" >> "$GITHUB_OUTPUT"
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT"

echo "Go versions fetched from dd-trace-go/main:"
echo " stable=${stable} oldstable=${oldstable}"
echo " stable_patch=${stable_patch} oldstable_patch=${oldstable_patch}"
echo " matrix=${matrix}"
5 changes: 5 additions & 0 deletions .github/workflows/run-end-to-end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ jobs:
scenarios: ${{ inputs.scenarios }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Fetch Go versions
if: inputs.library == 'golang'
id: go-versions
uses: ./.github/actions/go-versions
- name: Build weblog
id: build
run: |
Expand All @@ -167,6 +171,7 @@ jobs:
./build.sh ${{ inputs.library }} -i weblog -w ${{ inputs.weblog }}
env:
SYSTEM_TEST_BUILD_ATTEMPTS: 3
GO_VERSION: ${{ steps.go-versions.outputs.stable }}

- name: Run INTEGRATION_FRAMEWORKS scenario
if: always() && steps.build.outcome == 'success' && contains(inputs.scenarios, '"INTEGRATION_FRAMEWORKS"')
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,15 @@ jobs:
if: inputs.library == 'python' && inputs._build_python_base_images
run: |
./utils/build/build_python_base_images.sh
- name: Fetch Go versions
if: inputs.library == 'golang'
id: go-versions
uses: ./.github/actions/go-versions
- name: Build weblog
id: build
run: SYSTEM_TEST_BUILD_ATTEMPTS=3 ./build.sh ${{ inputs.library }} -i weblog -w ${{ matrix.weblog.name }} -s --github-token-file "$RUNNER_TEMP/github_token.txt"
env:
GO_VERSION: ${{ steps.go-versions.outputs.stable }}
- name: Remove secrets
if: always()
run: |
Expand Down
8 changes: 8 additions & 0 deletions utils/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ build() {
echo "WEBLOG_VARIANT: $WEBLOG_VARIANT"
echo "BUILD_IMAGES: $BUILD_IMAGES"
echo "EXTRA_DOCKER_ARGS: $EXTRA_DOCKER_ARGS"
echo "GO_VERSION: $GO_VERSION"
echo ""

# Issues with Mac M1 arm64 arch. This patch is intended to affect Mac M1 only.
Expand Down Expand Up @@ -270,6 +271,7 @@ build() {
--progress=plain \
${DOCKER_PLATFORM_ARGS} \
${GITHUB_TOKEN_SECRET_ARG} \
${GO_VERSION_BUILD_ARG} \
-f ${DOCKERFILE} \
--label "system-tests-library=${TEST_LIBRARY}" \
--label "system-tests-weblog-variant=${WEBLOG_VARIANT}" \
Expand Down Expand Up @@ -351,6 +353,12 @@ TEST_LIBRARY="${TEST_LIBRARY:-${DEFAULT_TEST_LIBRARY}}"
BINARY_PATH="${BINARY_PATH:-}"
BINARY_URL="${BINARY_URL:-}"
GITHUB_TOKEN_FILE="${GITHUB_TOKEN_FILE:-}"
GO_VERSION="${GO_VERSION:-}"

GO_VERSION_BUILD_ARG=""
if [[ -n "$GO_VERSION" ]]; then
GO_VERSION_BUILD_ARG="--build-arg GO_VERSION=${GO_VERSION}"
fi

if [[ "${BUILD_IMAGES}" =~ /weblog/ && ! -d "${SCRIPT_DIR}/docker/${TEST_LIBRARY}" ]]; then
echo "Library ${TEST_LIBRARY} not found"
Expand Down
7 changes: 5 additions & 2 deletions utils/build/docker/golang/chi.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev git

Expand All @@ -8,6 +10,7 @@ RUN go version && curl --version
# build application binary
COPY utils/build/docker/golang/app/ /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}

ENV GOCACHE=/root/.cache/go-build \
GOMODCACHE=/go/pkg/mod
Expand All @@ -22,7 +25,7 @@ RUN --mount=type=cache,target=${GOMODCACHE}

# ==============================================================================

FROM golang:1.25-alpine
FROM golang:${GO_VERSION}-alpine

RUN apk add --no-cache curl bash gcc musl-dev

Expand Down
7 changes: 5 additions & 2 deletions utils/build/docker/golang/echo.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev git

Expand All @@ -7,6 +9,7 @@ RUN go version && curl --version
# build application binary
COPY utils/build/docker/golang/app/ /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}

ENV GOCACHE=/root/.cache/go-build \
GOMODCACHE=/go/pkg/mod
Expand All @@ -21,7 +24,7 @@ RUN --mount=type=cache,target=${GOMODCACHE}

# ==============================================================================

FROM golang:1.25-alpine
FROM golang:${GO_VERSION}-alpine

RUN apk add --no-cache curl bash gcc musl-dev

Expand Down
7 changes: 5 additions & 2 deletions utils/build/docker/golang/gin.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev git

Expand All @@ -8,6 +10,7 @@ RUN go version && curl --version
# build application binary
COPY utils/build/docker/golang/app /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}

ENV GOCACHE=/root/.cache/go-build \
GOMODCACHE=/go/pkg/mod
Expand All @@ -22,7 +25,7 @@ RUN --mount=type=cache,target=${GOMODCACHE}

# ==============================================================================

FROM golang:1.25-alpine
FROM golang:${GO_VERSION}-alpine

RUN apk add --no-cache curl bash gcc musl-dev

Expand Down
5 changes: 4 additions & 1 deletion utils/build/docker/golang/gqlgen.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}
ARG GO_VERSION

# print important lib versions
RUN go version && curl --version
Expand All @@ -10,6 +12,7 @@ RUN apt-get update && apt-get -y install jq git
RUN mkdir -p /app
COPY utils/build/docker/golang/app/go.mod utils/build/docker/golang/app/go.sum /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}
RUN go mod download && go mod verify

# copy the app code
Expand Down
5 changes: 4 additions & 1 deletion utils/build/docker/golang/graph-gophers.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}
ARG GO_VERSION

# print important lib versions
RUN go version && curl --version
Expand All @@ -10,6 +12,7 @@ RUN apt-get update && apt-get -y install jq git
RUN mkdir -p /app
COPY utils/build/docker/golang/app/go.mod utils/build/docker/golang/app/go.sum /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}
RUN go mod download && go mod verify

# copy the app code
Expand Down
5 changes: 4 additions & 1 deletion utils/build/docker/golang/graphql-go.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}
ARG GO_VERSION

# print important lib versions
RUN go version && curl --version
Expand All @@ -10,6 +12,7 @@ RUN apt-get update && apt-get -y install jq git
RUN mkdir -p /app
COPY utils/build/docker/golang/app/go.mod utils/build/docker/golang/app/go.sum /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}
RUN go mod download && go mod verify

# copy the app code
Expand Down
7 changes: 5 additions & 2 deletions utils/build/docker/golang/net-http-orchestrion.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev git

Expand All @@ -11,6 +13,7 @@ COPY utils/build/docker/golang/app/ /app/
# WORKDIR /app will fail with the following error:
# main module (systemtests.weblog) does not contain package systemtests.weblog/net-http-orchestrion
WORKDIR /app/net-http-orchestrion
RUN go mod edit -go=${GO_VERSION}

ENV GOCACHE=/root/.cache/go-build \
GOMODCACHE=/go/pkg/mod
Expand All @@ -26,7 +29,7 @@ RUN --mount=type=cache,target=${GOMODCACHE}

# ==============================================================================

FROM golang:1.25-alpine
FROM golang:${GO_VERSION}-alpine

RUN apk add --no-cache curl bash gcc musl-dev

Expand Down
7 changes: 5 additions & 2 deletions utils/build/docker/golang/net-http.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev git

Expand All @@ -8,6 +10,7 @@ RUN go version && curl --version
# build application binary
COPY utils/build/docker/golang/app/ /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}

ENV GOCACHE=/root/.cache/go-build \
GOMODCACHE=/go/pkg/mod
Expand All @@ -22,7 +25,7 @@ RUN --mount=type=cache,target=${GOMODCACHE}

# ==============================================================================

FROM golang:1.25-alpine
FROM golang:${GO_VERSION}-alpine

RUN apk add --no-cache curl bash gcc musl-dev

Expand Down
5 changes: 4 additions & 1 deletion utils/build/docker/golang/parametric/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

FROM golang:1.25
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}
ARG GO_VERSION

# install jq
RUN apt-get update && apt-get -y install jq
WORKDIR /app
COPY utils/build/docker/golang/parametric/go.mod /app
COPY utils/build/docker/golang/parametric/go.sum /app
RUN go mod edit -go=${GO_VERSION}
COPY utils/build/docker/golang/parametric/. /app
# download the proper tracer version
COPY utils/build/docker/golang/install_ddtrace.sh binaries* /binaries/
Expand Down
5 changes: 4 additions & 1 deletion utils/build/docker/golang/uds-echo.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.25-alpine AS build
ARG GO_VERSION=1.25
FROM golang:${GO_VERSION}-alpine AS build
ARG GO_VERSION

RUN apk add --no-cache jq curl bash gcc musl-dev socat git

Expand All @@ -9,6 +11,7 @@ RUN go version && curl --version
RUN mkdir -p /app
COPY utils/build/docker/golang/app/go.mod utils/build/docker/golang/app/go.sum /app/
WORKDIR /app
RUN go mod edit -go=${GO_VERSION}
RUN go mod download && go mod verify

# copy the app code
Expand Down
Loading