dogapi 1.42.0 → 1.43.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c18772d3cb81c83a5fd80ed6eb50c21860414635d0219dfea836673e272c3e52
4
- data.tar.gz: 2a98454037254f50ea58c828be224c0906d6eb1ae7fa0f817e6f2df75b55c984
3
+ metadata.gz: ee43257bd0dee8a6d716ec81374f9c9345037eadb1d64ae56948354058611d42
4
+ data.tar.gz: f09c94bb876b09cf12dcf2bbe473b30e55964a62d8a78bedad6fbc54a6352e87
5
5
  SHA512:
6
- metadata.gz: 82b3841b8ae9209a25b434194463b0a37f830004fc608a6eb29184fb3972791db94434a81ca7542b26166e903d80346b6e49fe49e80d55b18115451fc15837b4
7
- data.tar.gz: 51a17532ec14faf58ea93448c390bdda914e12d8300e754998915cd3792b7a375a98cf6240478da357172ed8e77e9cf01ac52bf15eb2b0c64685e23d6cc191eb
6
+ metadata.gz: 7d69cb4d01bc6673e183f714899a2a21021114163a7f7d69d99a1ba73bd2badcb21f0795d6f78f3694ce24cee391ce1063566789ed3a85d7cbd19c25273b1ad5
7
+ data.tar.gz: 362e14cea14f234a3fe8649dc2c6044e245d903e255a0a78c61e0577e54e1046fbecdd7d3cb5277a374845d82bb1c5a9f45143d1eab9635656908a3c9b8cd63a
@@ -9,10 +9,36 @@ pr:
9
9
  include:
10
10
  - master
11
11
 
12
+ resources:
13
+ containers:
14
+ - container: datadog-agent
15
+ image: datadog/agent:7
16
+ options: --health-cmd="exit 0" --health-interval=1s
17
+ ports:
18
+ - 8125:8125
19
+ - 8126:8126/tcp
20
+ env:
21
+ DD_API_KEY: $(ddAPIKey)
22
+ DD_APM_ENABLED: "true"
23
+ DD_APM_NON_LOCAL_TRAFFIC: "true"
24
+ DD_LOGS_ENABLED: "true"
25
+ DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL: "true"
26
+ DD_AC_EXCLUDE: "name:datadog-agent"
27
+ volumes:
28
+ - /var/run/docker.sock:/var/run/docker.sock:ro
29
+ - /proc/:/host/proc/:ro
30
+ - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
31
+
12
32
  jobs:
13
33
  - job: UnitTests
14
34
  pool:
15
35
  vmImage: "Ubuntu-16.04"
36
+ container:
37
+ image: ruby:$(RUBY_VERSION)
38
+ options: >-
39
+ -l com.datadoghq.ad.logs="[{\"source\": \"Azure Pipeline\", \"service\": \"dogapi-rb\"}]"
40
+ services:
41
+ datadog-agent: datadog-agent
16
42
  strategy:
17
43
  matrix:
18
44
  Rb24:
@@ -31,17 +57,19 @@ jobs:
31
57
  RUBY_VERSION: '2.6'
32
58
  TASK: rubocop
33
59
  steps:
34
- - task: UseRubyVersion@0
35
- displayName: Use Ruby $(RUBY_VERSION)
36
- inputs:
37
- versionSpec: $(RUBY_VERSION)
38
- addToPath: true
39
- - script: |
40
- gem install bundler
41
- bundle install --retry=3 --jobs=4
60
+ - script: bundle install --retry=3 --jobs=4
42
61
  displayName: 'bundle install'
62
+ env:
63
+ GEM_HOME: '~/.gem'
43
64
  - script: bundle exec rake $(TASK)
44
65
  displayName: Run $(TASK) via bundle
66
+ env:
67
+ GEM_HOME: '~/.gem'
68
+ DD_AGENT_HOST: datadog-agent
69
+ DD_ENV: ci
70
+ DD_SERVICE: dogapi-rb
71
+ DD_TAGS: "team:integration-tools-and-libraries,runtime:ruby-$(RUBY_VERSION),ci.job.name:$(System.JobName),matrix:$(TASK)"
72
+ DD_TRACE_ANALYTICS_ENABLED: "true"
45
73
  - job: TestRuby19
46
74
  pool:
47
75
  vmImage: "Ubuntu-16.04"
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 1.43.0 / 2020-12-07
4
+
5
+ * [Fixed] find_localhost: Try both `hostname` and `hostname -f` before raising. See [#242](https://github.com/DataDog/dogapi-rb/pull/242).
6
+
3
7
  ## 1.42.0 / 2020-09-17
4
8
 
5
9
  * [Added] Allow dashboard creation / updates using Template Variable Presets. See [#238](https://github.com/DataDog/dogapi-rb/pull/238).
data/Gemfile CHANGED
@@ -3,10 +3,8 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
+ gem 'ddtrace', git: 'https://github.com/datadog/dd-trace-rb'
6
7
  gem 'rubocop', "~> 0.49.0"
7
- # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
- # and neither our users nor our CI is vulnerable in any way
9
- gem 'rake', '>= 2.4.2'
10
8
  gem 'rspec'
11
9
  gem 'simplecov'
12
10
  gem 'webmock'
@@ -4,9 +4,6 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rubocop', "~> 0.41.0"
7
- # NOTE: rake < 12.3.3 is vulnerable to CVE-2020-8130, but we only use it as a test dependency
8
- # and neither our users nor our CI is vulnerable in any way
9
- gem 'rake', '>= 2.4.2'
10
7
  gem 'rspec'
11
8
  gem 'simplecov', "~> 0.11.2"
12
9
  gem 'webmock'
@@ -43,4 +43,4 @@ Install [bundler](https://bundler.io/) and setup your RubyGems credentials:
43
43
  1. Build the gem: `bundle exec gem build dogapi.gemspec`.
44
44
  1. Push the gem: `bundle exec gem push dogapi-x.x.x.gem`.
45
45
  1. Check that the [Ruby Gem is published](https://rubygems.org/gems/dogapi).
46
- 1. Bump the version again in `lib/dogapi/version.rb` to a dev version (e.g. `1.39.0` -> `1.40.0.dev`), open a PR and merge it to master.
46
+ 1. Bump the version again in `lib/dogapi/version.rb` to a dev version (e.g. `1.42.0` -> `1.42.1.dev`), open a PR and merge it to master.
@@ -210,14 +210,17 @@ module Dogapi
210
210
  @@hostname = nil
211
211
 
212
212
  def Dogapi.find_localhost
213
- unless @@hostname
214
- out, status = Open3.capture2('hostname', '-f', err: File::NULL)
215
- # Get status to check if the call was successful
216
- raise SystemCallError, 'Could not get hostname with `hostname -f`' unless status.exitstatus.zero?
217
- @@hostname = out.strip
218
- end
219
- rescue SystemCallError
220
- @@hostname = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname
213
+ return @@hostname if @@hostname
214
+ out, status = Open3.capture2('hostname', '-f', err: File::NULL)
215
+ unless status.exitstatus.zero?
216
+ begin
217
+ out = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname
218
+ rescue SocketError
219
+ out, status = Open3.capture2('hostname', err: File::NULL)
220
+ raise SystemCallError, 'Both `hostname` and `hostname -f` failed.' unless status.exitstatus.zero?
221
+ end
222
+ end
223
+ @@hostname = out.strip
221
224
  end
222
225
 
223
226
  def Dogapi.find_proxy
@@ -3,5 +3,5 @@
3
3
  # Copyright 2011-Present Datadog, Inc.
4
4
 
5
5
  module Dogapi
6
- VERSION = '1.42.0'
6
+ VERSION = '1.43.0'
7
7
  end
@@ -10,7 +10,19 @@ SimpleCov.start do
10
10
  add_filter 'spec'
11
11
  end
12
12
 
13
- WebMock.disable_net_connect!(allow_localhost: false)
13
+ webmock_allow = []
14
+
15
+ begin
16
+ require 'ddtrace'
17
+ Datadog.configure do |c|
18
+ c.use :rspec, service_name: 'dogapi-rb'
19
+ end
20
+ webmock_allow << "#{Datadog::Transport::HTTP.default_hostname}:#{Datadog::Transport::HTTP.default_port}"
21
+ rescue LoadError
22
+ puts 'ddtrace gem not found'
23
+ end
24
+
25
+ WebMock.disable_net_connect!(allow_localhost: false, allow: webmock_allow)
14
26
 
15
27
  # include our code and methods
16
28
  require 'dogapi'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.0
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubygems_version: 3.1.2
201
+ rubygems_version: 3.0.6
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Ruby bindings for Datadog's API