From ee2309e068cf617dd8df807ea096c8e453037e34 Mon Sep 17 00:00:00 2001 From: Eliott Bouhana Date: Thu, 9 Jan 2025 19:18:25 +0100 Subject: [PATCH] fix build errors Signed-off-by: Eliott Bouhana --- utils/build/docker/golang/install_ddtrace.sh | 20 ++-------------- .../docker/golang/install_orchestrion.sh | 23 +++++++++++++++++++ .../golang/net-http-orchestrion.Dockerfile | 10 +++----- 3 files changed, 28 insertions(+), 25 deletions(-) create mode 100755 utils/build/docker/golang/install_orchestrion.sh diff --git a/utils/build/docker/golang/install_ddtrace.sh b/utils/build/docker/golang/install_ddtrace.sh index a6fa2d402d..f6820ac704 100755 --- a/utils/build/docker/golang/install_ddtrace.sh +++ b/utils/build/docker/golang/install_ddtrace.sh @@ -15,31 +15,15 @@ else go get -v -d -u gopkg.in/DataDog/dd-trace-go.v1 fi -# Install orchestrion -if [ -n "$INSTALL_ORCHESTRION" ]; then - if [ -e "/binaries/orchestrion" ]; then - echo "Install from folder /binaries/orchestrion" - go mod edit -replace github.com/DataDog/orchestrion=/binaries/orchestrion - go -C /binaries/orchestrion build -o "$(go env GOPATH)/bin/orchestrion" . - elif [ -e "/binaries/orchestrion-load-from-go-get" ]; then - echo "Install from go get -d $(cat /binaries/orchestrion-load-from-go-get)" - go install "$(cat /binaries/orchestrion-load-from-go-get)" - else - echo "Installing production orchestrion" - go install github.com/DataDog/orchestrion@latest - fi -fi - - # Downloading a newer version of the tracer may require to resolve again all dependencies go mod tidy # Read the library version out of the version.go file lib_mod_dir=$(go list -f '{{.Dir}}' -m gopkg.in/DataDog/dd-trace-go.v1) version=$(sed -nrE 's#.*"v(.*)".*#\1#p' $lib_mod_dir/internal/version/version.go) # Parse the version string content "v.*" -echo $version > SYSTEM_TESTS_LIBRARY_VERSION +echo "$version" > SYSTEM_TESTS_LIBRARY_VERSION -rules_mod_dir=$(go list -f '{{.Dir}}' -m github.com/DataDog/appsec-internal-go) +rules_mod_dir="$(go list -f '{{.Dir}}' -m github.com/DataDog/appsec-internal-go)" echo "dd-trace-go version: $(cat /app/SYSTEM_TESTS_LIBRARY_VERSION)" diff --git a/utils/build/docker/golang/install_orchestrion.sh b/utils/build/docker/golang/install_orchestrion.sh new file mode 100755 index 0000000000..88d9f303c6 --- /dev/null +++ b/utils/build/docker/golang/install_orchestrion.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euv + +if [ -e "/binaries/orchestrion" ]; then + echo "Install from folder /binaries/orchestrion" + go mod edit -replace github.com/DataDog/orchestrion=/binaries/orchestrion + go -C /binaries/orchestrion build -o "$(go env GOPATH)/bin/orchestrion" . +elif [ -e "/binaries/orchestrion-load-from-go-get" ]; then + echo "Install from go get -d $(cat /binaries/orchestrion-load-from-go-get)" + go install "$(cat /binaries/orchestrion-load-from-go-get)" +else + echo "Installing production orchestrion" + go install github.com/DataDog/orchestrion@latest +fi + +orchestrion pin + +output="$(orchestrion version)" +version="${output#"orchestrion "}" +echo "$version" > SYSTEM_TESTS_ORCHESTRION_VERSION + +echo "orchestrion version: $(cat /app/SYSTEM_TESTS_ORCHESTRION_VERSION)" diff --git a/utils/build/docker/golang/net-http-orchestrion.Dockerfile b/utils/build/docker/golang/net-http-orchestrion.Dockerfile index 2e7fa2ef47..b370732baa 100644 --- a/utils/build/docker/golang/net-http-orchestrion.Dockerfile +++ b/utils/build/docker/golang/net-http-orchestrion.Dockerfile @@ -13,14 +13,10 @@ RUN go mod download && go mod verify COPY utils/build/docker/golang/app /app # download the proper tracer version -COPY utils/build/docker/golang/install_ddtrace.sh binaries* /binaries/ -RUN INSTALL_ORCHESTRION=true /binaries/install_ddtrace.sh +COPY utils/build/docker/golang/install_*.sh binaries* /binaries/ +RUN /binaries/install_ddtrace.sh && /binaries/install_orchestrion.sh -ENV DD_ORCHESTRION_IS_GOMOD_VERSION=true - -RUN orchestrion pin - -RUN orchestrion go build -v -tags appsec -o weblog ./net-http-orchestrion +RUN DD_ORCHESTRION_IS_GOMOD_VERSION=true orchestrion go build -v -tags appsec -o weblog ./net-http-orchestrion # ==============================================================================