diff --git a/.circleci/config.yml b/.circleci/config.yml index 43e9a03..a740348 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,30 +1,35 @@ version: 2 -jobs: - build: - docker: - # node-browsers come with java pre-installed - - image: circleci/node:6.14-browsers - working_directory: ~/openzipkin/web +aliases: + # install latest versions of packages + - &install-latest-dependencies + | + npm install && \ + npm install --save zipkin@latest \ + zipkin-context-cls@latest \ + zipkin-instrumentation-cujojs-rest@latest \ + zipkin-instrumentation-express@latest \ + zipkin-instrumentation-fetch@latest \ + zipkin-transport-http@latest + +defaults: &defaults + working_directory: ~/openzipkin/web + docker: + - image: circleci/node:6.14-browsers +jobs: + build-sampled: + <<: *defaults steps: - checkout: path: ~/openzipkin - - run: npm install - # install latest versions of packages - - run: | - npm install --save zipkin@latest \ - zipkin-context-cls@latest \ - zipkin-instrumentation-cujojs-rest@latest \ - zipkin-instrumentation-express@latest \ - zipkin-instrumentation-fetch@latest \ - zipkin-transport-http@latest + - run: *install-latest-dependencies - run: curl -sSL https://zipkin.io/quickstart.sh | bash -s - run: background: true command: java -jar zipkin.jar # block until zipkin is available - - run: wget --retry-connrefused -T 60 -O /dev/null http://127.0.0.1:9411/health + - run: wget --retry-connrefused -T 60 -O /dev/null --header="X-B3-TraceId: a2fb4a1d1a96d312" --header="X-B3-SpanId: a2fb4a1d1a96d312" --header="X-B3-Sampled: 1" http://127.0.0.1:9411/health # start both processes in the background, but don't use composer as it dies - run: background: true @@ -34,17 +39,45 @@ jobs: - run: | # wait just in case sleep 1 - traces="$(curl -s 127.0.0.1:9411/api/v2/traces)" + traces="$(curl -s 127.0.0.1:9411/api/v2/trace/a2fb4a1d1a96d312)" echo "queried traces: $traces" count=$(echo "$traces" | jq '.[0] | length') echo "count: $count" test $count -ge 2 + build-unsampled: + <<: *defaults + steps: + - checkout: + path: ~/openzipkin + - run: *install-latest-dependencies + - run: curl -sSL https://zipkin.io/quickstart.sh | bash -s + - run: + background: true + command: java -jar zipkin.jar + # block until zipkin is available + - run: wget --retry-connrefused -T 60 -O /dev/null --header="X-B3-TraceId: a2fb4a1d1a96d313" --header="X-B3-SpanId: a2fb4a1d1a96d313" --header="X-B3-Sampled: 0" http://127.0.0.1:9411/health + # start both processes in the background, but don't use composer as it dies + - run: + background: true + command: npm start + # hit the frontend which calls the backend + - run: wget -v --retry-connrefused -T 5 -O /dev/null 127.0.0.1:8081 + - run: | + # wait just in case + sleep 1 + traces="$(curl -s 127.0.0.1:9411/api/v2/trace/a2fb4a1d1a96d312)" + echo "queried traces: $traces" + count=$(echo "$traces" | jq '.[0] | length') + echo "count: $count" + test $count -ge 0 + workflows: version: 2 commit: jobs: - - build + - build-sampled + - build-unsampled nightly: triggers: - schedule: