Skip to content

Commit

Permalink
internal/apps: move setup-smoke-test
Browse files Browse the repository at this point in the history
Move setup-smoke-test from internal/apps/setup-smoke-test to
internal/setup-smoke tests. This allows the other internal/apps to use
the latest version of go. We want this because these apps are often used
to test the latest new features which may depend on new go version. They
are also used for screenshots where we don't want to show an old go
version.

setup-smoke-test is serving a different purpose and needs to be tested
against the minimum version of Go that we support. So move it to a
separate location and give it its own go.mod file.
  • Loading branch information
felixge committed Sep 17, 2024
1 parent 6d0e1b8 commit e20d7ee
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./internal/apps/setup-smoke-test/Dockerfile
file: ./internal/setup-smoke-test/Dockerfile
push: false
load: true
tags: smoke-test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FROM golang:$go-$build_env AS build-env

WORKDIR /src
COPY . .
WORKDIR /src/internal/apps/setup-smoke-test
WORKDIR /src/internal/setup-smoke-test

ARG build_with_cgo
RUN go env -w CGO_ENABLED=$build_with_cgo
Expand Down Expand Up @@ -67,15 +67,15 @@ RUN ldd smoke-test || true
# this image to preperly highlight the fact that the compiled program is running
# out of the box in it without any further installation.
FROM debian:11 AS debian11
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# debian12 deployment environment
# IMPORTANT NOTE: Nothing else than the compiled program must be copied into
# this image to preperly highlight the fact that the compiled program is running
# out of the box in it without any further installation.
FROM debian:12 AS debian12
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# alpine deployment environment
Expand All @@ -87,23 +87,23 @@ ARG build_with_cgo
RUN set -ex; if [ "$build_with_cgo" = "1" ]; then \
apk update && apk add libc6-compat; \
fi
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# amazonlinux:2 deployment environment
# IMPORTANT NOTE: Nothing else than the compiled program must be copied into
# this image to preperly highlight the fact that the compiled program is running
# out of the box in it without any further installation.
FROM amazonlinux:2 AS al2
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# amazonlinux:2023 deployment environment
# IMPORTANT NOTE: Nothing else than the compiled program must be copied into
# this image to preperly highlight the fact that the compiled program is running
# out of the box in it without any further installation.
FROM amazonlinux:2023 AS al2023
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# busybox deployment environment
Expand All @@ -112,15 +112,15 @@ CMD /usr/local/bin/smoke-test
# out of the box in it without any further installation.
FROM busybox AS busybox
RUN mkdir -p /usr/local/bin
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /usr/local/bin
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /usr/local/bin
CMD /usr/local/bin/smoke-test

# scratch deployment environment - meant to be used with CGO_ENABLED=0
# IMPORTANT NOTE: Nothing else than the compiled program must be copied into
# this image to preperly highlight the fact that the compiled program is running
# out of the box in it without any further installation.
FROM scratch AS scratch
COPY --from=build-env /src/internal/apps/setup-smoke-test/smoke-test /
COPY --from=build-env /src/internal/setup-smoke-test/smoke-test /
ENTRYPOINT [ "/smoke-test" ]

# Final deployment environment - helper target to end up a single one
Expand Down
42 changes: 42 additions & 0 deletions internal/setup-smoke-test/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module github.com/DataDog/dd-trace-go/internal/setup-smoke-test

go 1.22

require gopkg.in/DataDog/dd-trace-go.v1 v1.67.1

require (
github.com/DataDog/appsec-internal-go v1.7.0 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.48.1 // indirect
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect
github.com/DataDog/go-libddwaf/v3 v3.3.0 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
github.com/DataDog/gostackparse v0.7.0 // indirect
github.com/DataDog/sketches-go v1.4.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
github.com/ebitengine/purego v0.6.0-alpha.5 // indirect
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/outcaste-io/ristretto v0.2.3 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/richardartoul/molecule v1.0.1-0.20240531184615-7ca0df43c0b3 // indirect
github.com/ryanuber/go-glo