From fff8c15fd98cbecd1d3c82dd836d6d2e4aad304f Mon Sep 17 00:00:00 2001 From: Will Gittoes Date: Mon, 18 Feb 2019 16:28:07 +1100 Subject: [PATCH] Replace all mentions of dd-opentracing-cpp version numbers with calls to github to find the latest version number --- .circleci/config.yml | 4 ++-- .gitmodules | 1 + examples/cpp-tracing/compiled-in/Dockerfile | 14 +++++++++----- examples/cpp-tracing/dynamic-loading/Dockerfile | 17 +++++++++++------ .../dynamic-loading/tracer_example.cpp | 4 ++-- .../Dockerfile-ddopentracing-envoy | 8 +++++--- .../Dockerfile-ddopentracing-service | 8 +++++--- examples/envoy-tracing/README.md | 2 +- examples/nginx-tracing/Dockerfile | 9 ++++++--- scripts/build_nginx_plugin.sh | 2 +- scripts/install_dependencies.sh | 2 +- test/integration/nginx/Dockerfile | 2 +- 12 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6e68db1a..d3d76d23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ jobs: CMAKE_ARGS: -DBUILD_PLUGIN=ON -DBUILD_STATIC=ON -DBUILD_SHARED=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo # If BUILD_ALL_NGINX_VERSIONS is set, builds all NGINX versions. Otherwise, builds just the first # version to use it for integration testing. - NGINX_VERSIONS: 1.14.1 1.12.2 1.13.12 1.15.0 + NGINX_VERSIONS: 1.14.2 1.12.2 1.15.8 CFLAGS: -march=x86-64 -fPIC CXXFLAGS: -march=x86-64 -fPIC LDFLAGS: -fPIC @@ -108,7 +108,7 @@ jobs: docker: - image: datadog/docker-library:dd_opentracing_cpp_test_0_3_0 environment: - NGINX_VERSION: 1.14.1 + NGINX_VERSION: 1.14.2 steps: - checkout - attach_workspace: diff --git a/.gitmodules b/.gitmodules index 4393db13..3f6ff21e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,4 +2,5 @@ path = nginx-plugin/nginx-opentracing url = https://github.com/opentracing-contrib/nginx-opentracing ignore = dirty + tag = v0.8.0 diff --git a/examples/cpp-tracing/compiled-in/Dockerfile b/examples/cpp-tracing/compiled-in/Dockerfile index d1247829..b9020790 100644 --- a/examples/cpp-tracing/compiled-in/Dockerfile +++ b/examples/cpp-tracing/compiled-in/Dockerfile @@ -4,10 +4,14 @@ RUN apt-get update && \ apt-get -y install build-essential cmake wget # Download and install dd-opentracing-cpp library. -RUN wget https://github.com/DataDog/dd-opentracing-cpp/archive/v0.3.7.tar.gz -O dd-opentracing-cpp.tar.gz && \ - tar zxvf dd-opentracing-cpp.tar.gz && \ - mkdir dd-opentracing-cpp-0.3.7/.build && \ - cd dd-opentracing-cpp-0.3.7/.build && \ +RUN get_latest_release() { \ + wget -qO- "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'; \ + } && \ + VERSION="$(get_latest_release DataDog/dd-opentracing-cpp)" && \ + wget https://github.com/DataDog/dd-opentracing-cpp/archive/${VERSION}.tar.gz -O dd-opentracing-cpp.tar.gz && \ + mkdir -p dd-opentracing-cpp/.build && \ + tar zxvf dd-opentracing-cpp.tar.gz -C ./dd-opentracing-cpp/ --strip-components=1 && \ + cd dd-opentracing-cpp/.build && \ # Download and install the correct version of opentracing-cpp, & other deps. ../scripts/install_dependencies.sh && \ cmake .. && \ @@ -16,7 +20,7 @@ RUN wget https://github.com/DataDog/dd-opentracing-cpp/archive/v0.3.7.tar.gz -O COPY tracer_example.cpp . -RUN g++ -o tracer_example tracer_example.cpp -ldd_opentracing -lopentracing +RUN g++ -std=c++14 -o tracer_example tracer_example.cpp -ldd_opentracing -lopentracing # Add /usr/local/lib to LD_LIBRARY_PATH RUN ldconfig diff --git a/examples/cpp-tracing/dynamic-loading/Dockerfile b/examples/cpp-tracing/dynamic-loading/Dockerfile index 1f44333a..569ea6bf 100644 --- a/examples/cpp-tracing/dynamic-loading/Dockerfile +++ b/examples/cpp-tracing/dynamic-loading/Dockerfile @@ -4,21 +4,26 @@ RUN apt-get update && \ apt-get -y install build-essential cmake wget # Download and install OpenTracing-cpp -RUN wget https://github.com/opentracing/opentracing-cpp/archive/v1.5.0.tar.gz -O opentracing-cpp.tar.gz && \ - tar zxvf opentracing-cpp.tar.gz && \ - mkdir opentracing-cpp-1.5.0/.build && \ - cd opentracing-cpp-1.5.0/.build && \ +RUN get_latest_release() { \ + wget -qO- "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'; \ + } && \ + DD_OPENTRACING_CPP_VERSION="$(get_latest_release DataDog/dd-opentracing-cpp)" && \ + OPENTRACING_VERSION="$(get_latest_release opentracing/opentracing-cpp)" && \ + wget https://github.com/opentracing/opentracing-cpp/archive/${OPENTRACING_VERSION}.tar.gz -O opentracing-cpp.tar.gz && \ + mkdir -p opentracing-cpp/.build && \ + tar zxvf opentracing-cpp.tar.gz -C ./opentracing-cpp/ --strip-components=1 && \ + cd opentracing-cpp/.build && \ cmake .. && \ make && \ make install && \ # Install dd-opentracing-cpp shared plugin. - wget https://github.com/DataDog/dd-opentracing-cpp/releases/download/v0.3.7/linux-amd64-libdd_opentracing_plugin.so.gz && \ + wget https://github.com/DataDog/dd-opentracing-cpp/releases/download/${DD_OPENTRACING_CPP_VERSION}/linux-amd64-libdd_opentracing_plugin.so.gz && \ gunzip linux-amd64-libdd_opentracing_plugin.so.gz -c > /usr/local/lib/libdd_opentracing_plugin.so COPY tracer_example.cpp . -RUN g++ -o tracer_example tracer_example.cpp -lopentracing +RUN g++ -std=c++11 -o tracer_example tracer_example.cpp -lopentracing # Add /usr/local/lib to LD_LIBRARY_PATH RUN ldconfig diff --git a/examples/cpp-tracing/dynamic-loading/tracer_example.cpp b/examples/cpp-tracing/dynamic-loading/tracer_example.cpp index 53a6d868..ac8814a9 100644 --- a/examples/cpp-tracing/dynamic-loading/tracer_example.cpp +++ b/examples/cpp-tracing/dynamic-loading/tracer_example.cpp @@ -9,7 +9,7 @@ int main(int argc, char* argv[]) { "/usr/local/lib/libdd_opentracing_plugin.so", error_message); if (!handle_maybe) { std::cerr << "Failed to load tracer library " << error_message << "\n"; - return false; + return 1; } // Read in the tracer's configuration. @@ -24,7 +24,7 @@ int main(int argc, char* argv[]) { auto tracer_maybe = tracer_factory.MakeTracer(tracer_config.c_str(), error_message); if (!tracer_maybe) { std::cerr << "Failed to create tracer " << error_message << "\n"; - return false; + return 1; } auto& tracer = *tracer_maybe; diff --git a/examples/envoy-tracing/Dockerfile-ddopentracing-envoy b/examples/envoy-tracing/Dockerfile-ddopentracing-envoy index 9cda8213..ca06e2b4 100644 --- a/examples/envoy-tracing/Dockerfile-ddopentracing-envoy +++ b/examples/envoy-tracing/Dockerfile-ddopentracing-envoy @@ -3,9 +3,11 @@ # - add install step for dd-opentracing-cpp library FROM envoyproxy/envoy:latest -ARG DATADOG_PLUGIN_VERSION=0.3.7 - -ADD https://github.com/DataDog/dd-opentracing-cpp/releases/download/v${DATADOG_PLUGIN_VERSION}/linux-amd64-libdd_opentracing_plugin.so.gz linux-amd64-libdd_opentracing_plugin.so.gz +RUN get_latest_release() { \ + wget -qO- "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'; \ + } && \ + DATADOG_PLUGIN_VERSION="$(get_latest_release DataDog/dd-opentracing-cpp)" && \ + wget https://github.com/DataDog/dd-opentracing-cpp/releases/download/${DATADOG_PLUGIN_VERSION}/linux-amd64-libdd_opentracing_plugin.so.gz RUN gunzip linux-amd64-libdd_opentracing_plugin.so.gz -c > /usr/local/lib/libdd_opentracing.so CMD /usr/local/bin/envoy -c /etc/front-envoy.yaml --service-cluster front-proxy diff --git a/examples/envoy-tracing/Dockerfile-ddopentracing-service b/examples/envoy-tracing/Dockerfile-ddopentracing-service index cae32bdc..b005bbe8 100644 --- a/examples/envoy-tracing/Dockerfile-ddopentracing-service +++ b/examples/envoy-tracing/Dockerfile-ddopentracing-service @@ -3,9 +3,11 @@ # - add install step for dd-opentracing-cpp library FROM envoyproxy/envoy-alpine:latest -ARG DATADOG_PLUGIN_VERSION=0.3.7 - -ADD https://github.com/DataDog/dd-opentracing-cpp/releases/download/v${DATADOG_PLUGIN_VERSION}/linux-amd64-libdd_opentracing_plugin.so.gz linux-amd64-libdd_opentracing_plugin.so.gz +RUN get_latest_release() { \ + wget -qO- "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'; \ + } && \ + DATADOG_PLUGIN_VERSION="$(get_latest_release DataDog/dd-opentracing-cpp)" && \ + wget https://github.com/DataDog/dd-opentracing-cpp/releases/download/${DATADOG_PLUGIN_VERSION}/linux-amd64-libdd_opentracing_plugin.so.gz RUN gunzip linux-amd64-libdd_opentracing_plugin.so.gz -c > /usr/local/lib/libdd_opentracing.so RUN apk update && apk add python3 bash diff --git a/examples/envoy-tracing/README.md b/examples/envoy-tracing/README.md index 44d17f2a..432d6909 100644 --- a/examples/envoy-tracing/README.md +++ b/examples/envoy-tracing/README.md @@ -24,7 +24,7 @@ This will build and launch To interact with these services, a docker container needs to be connected on the network created by docker-compose. ```sh-session -$ docker run --net=envoytracing_envoymesh --rm -i -t busybox +$ docker run --net=envoy-tracing_envoymesh --rm -i -t busybox / # wget -q -O- http://front-envoy/service/1 Hello from behind Envoy (service 1)! hostname: 6060fcea4f2a resolvedhostname: 192.168.16.4 / # wget -q -O- http://front-envoy/service/2 diff --git a/examples/nginx-tracing/Dockerfile b/examples/nginx-tracing/Dockerfile index 922a4d8e..c73ea311 100644 --- a/examples/nginx-tracing/Dockerfile +++ b/examples/nginx-tracing/Dockerfile @@ -1,8 +1,7 @@ # Builds and runs a simple nginx server, traced by Datadog FROM ubuntu:18.04 -ARG NGINX_VERSION=1.14.1 -ARG DATADOG_PLUGIN_VERSION=0.3.7 +ARG NGINX_VERSION=1.14.2 RUN apt-get update && \ apt-get install -y git gnupg wget tar @@ -21,7 +20,11 @@ RUN mkdir -p /var/www/ COPY ./examples/nginx-tracing/index.html /var/www/index.html # Install Datadog module -ADD https://github.com/DataDog/dd-opentracing-cpp/releases/download/v${DATADOG_PLUGIN_VERSION}/linux-amd64-nginx-${NGINX_VERSION}-ngx_http_module.so.tgz linux-amd64-nginx-${NGINX_VERSION}-ngx_http_module.so.tgz +RUN get_latest_release() { \ + wget -qO- "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'; \ + } && \ + DD_OPENTRACING_CPP_VERSION="$(get_latest_release DataDog/dd-opentracing-cpp)" && \ + wget https://github.com/DataDog/dd-opentracing-cpp/releases/download/${DD_OPENTRACING_CPP_VERSION}/linux-amd64-nginx-${NGINX_VERSION}-ngx_http_module.so.tgz RUN tar zxf linux-amd64-nginx-${NGINX_VERSION}-ngx_http_module.so.tgz -C /usr/lib/nginx/modules # Test nginx config. diff --git a/scripts/build_nginx_plugin.sh b/scripts/build_nginx_plugin.sh index 818568d8..a75d7f81 100755 --- a/scripts/build_nginx_plugin.sh +++ b/scripts/build_nginx_plugin.sh @@ -8,7 +8,7 @@ set -eo pipefail # make && make install # popd -NGINX_VERSION=${NGINX_VERSION:-1.14.1} +NGINX_VERSION=${NGINX_VERSION:-1.14.2} BUILD_DIR=${BUILD_DIR:-/tmp/build/} rm -rf .nginx-build diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 0fcb56c0..310718bb 100755 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -2,7 +2,7 @@ set -e OPENTRACING_VERSION=${OPENTRACING_VERSION:-1.5.0} -CURL_VERSION=${CURL_VERSION:-7.61.1} +CURL_VERSION=${CURL_VERSION:-7.64.0} MSGPACK_VERSION=${MSGPACK_VERSION:-3.1.1} ZLIB_VERSION=${ZLIB_VERSION:-1.2.11} diff --git a/test/integration/nginx/Dockerfile b/test/integration/nginx/Dockerfile index ec62ae03..1302c78f 100644 --- a/test/integration/nginx/Dockerfile +++ b/test/integration/nginx/Dockerfile @@ -1,6 +1,6 @@ # Creates an image with nginx and the Datadog OpenTracing nginx module installed. # Runs a simple integration test. -ARG NGINX_VERSION=1.14.1 +ARG NGINX_VERSION=1.14.2 # The nginx testbed. Build this image first since we don't want it rebuilt if just the code changes. FROM ubuntu:18.04 as nginx-testbed