diff --git a/.azure-pipelines/all.yml b/.azure-pipelines/all.yml index af2341b5..d834c9ba 100644 --- a/.azure-pipelines/all.yml +++ b/.azure-pipelines/all.yml @@ -9,10 +9,36 @@ pr: include: - master +resources: + containers: + - container: datadog-agent + image: datadog/agent:7 + options: --health-cmd="exit 0" --health-interval=1s + ports: + - 8125:8125 + - 8126:8126/tcp + env: + DD_API_KEY: $(ddAPIKey) + DD_APM_ENABLED: "true" + DD_APM_NON_LOCAL_TRAFFIC: "true" + DD_LOGS_ENABLED: "true" + DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL: "true" + DD_AC_EXCLUDE: "name:datadog-agent" + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /proc/:/host/proc/:ro + - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro + jobs: - job: UnitTests pool: vmImage: "Ubuntu-16.04" + container: + image: ruby:$(RUBY_VERSION) + options: >- + -l com.datadoghq.ad.logs="[{\"source\": \"Azure Pipeline\", \"service\": \"dogapi-rb\"}]" + services: + datadog-agent: datadog-agent strategy: matrix: Rb24: @@ -31,17 +57,19 @@ jobs: RUBY_VERSION: '2.6' TASK: rubocop steps: - - task: UseRubyVersion@0 - displayName: Use Ruby $(RUBY_VERSION) - inputs: - versionSpec: $(RUBY_VERSION) - addToPath: true - - script: | - gem install bundler - bundle install --retry=3 --jobs=4 + - script: bundle install --retry=3 --jobs=4 displayName: 'bundle install' + env: + GEM_HOME: '~/.gem' - script: bundle exec rake $(TASK) displayName: Run $(TASK) via bundle + env: + GEM_HOME: '~/.gem' + DD_AGENT_HOST: datadog-agent + DD_ENV: ci + DD_SERVICE: dogapi-rb + DD_TAGS: "team:integration-tools-and-libraries,runtime:ruby-$(RUBY_VERSION),ci.job.name:$(System.JobName),matrix:$(TASK)" + DD_TRACE_ANALYTICS_ENABLED: "true" - job: TestRuby19 pool: vmImage: "Ubuntu-16.04" diff --git a/Gemfile b/Gemfile index 6a9db75e..2a4a68b7 100644 --- a/Gemfile +++ b/Gemfile @@ -3,10 +3,8 @@ source 'https://rubygems.org' gemspec group :test do + gem 'ddtrace', git: 'https://github.com/datadog/dd-trace-rb' gem 'rubocop', "~> 0.49.0" - # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency - # and neither our users nor our CI is vulnerable in any way - gem 'rake', '>= 2.4.2' gem 'rspec' gem 'simplecov' gem 'webmock' diff --git a/Gemfile_1.9 b/Gemfile_1.9 index 5b8e56c2..3bbe592a 100644 --- a/Gemfile_1.9 +++ b/Gemfile_1.9 @@ -4,9 +4,6 @@ gemspec group :test do gem 'rubocop', "~> 0.41.0" - # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency - # and neither our users nor our CI is vulnerable in any way - gem 'rake', '>= 2.4.2' gem 'rspec' gem 'simplecov', "~> 0.11.2" gem 'webmock' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f7fbc76d..9b9e406e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,19 @@ add_filter 'spec' end -WebMock.disable_net_connect!(allow_localhost: false) +webmock_allow = [] + +begin + require 'ddtrace' + Datadog.configure do |c| + c.use :rspec, service_name: 'dogapi-rb' + end + webmock_allow << "#{Datadog::Transport::HTTP.default_hostname}:#{Datadog::Transport::HTTP.default_port}" +rescue LoadError + puts 'ddtrace gem not found' +end + +WebMock.disable_net_connect!(allow_localhost: false, allow: webmock_allow) # include our code and methods require 'dogapi'