itamae-plugin-recipe-datadog 0.2.1 → 0.3.1

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: 0ae9b400e6f30b6f5fe507b7e385474e31e9293c8b6d7336b2e464cd3d2cf0f7
4
- data.tar.gz: 30e35ccecb871ea1b32d03879d8e4074ac2dc44a97095d9f2b7af1d6db0de3b1
3
+ metadata.gz: 819762a5f68d658d9b7ec465304511c57f5cfac0d41989a5148166a8a25aeb3a
4
+ data.tar.gz: 371bf73f255954542fc95fa17d5d1166163614e7512566ecb29a67c1defaff28
5
5
  SHA512:
6
- metadata.gz: bd1e76a1884865d23d5617bab9759db252928649bed56afb928a3b59a785c95a853fb6c513ebf7e5e7d43c667f5993ebe126682981c0fbf1e09d0d809269eb7a
7
- data.tar.gz: fa74c66777b61efdeeba897ba78f89860b4ac9dbb844e1c7c12991ab705af912620877493d8ed1999d7fb5351aa989a80e82545675cd26034d7e4e690a8827f4
6
+ metadata.gz: b6507f9b5615ccaa094da683ef6891f9644236667bd8b30537cb52c1f1f6463b6f1c309ad7e688880687fcdf0051a02c0679e1fbc21514fa83a428249e2d940e
7
+ data.tar.gz: a4eee6bd8f7b67f087483aefbb8140de3221cb3d6033c56a6623964418101d74077c2c6dd16b512a96fffa7bb3ff5d4b94cd0b61a8f6d3a3212ac594e0d2378c
@@ -0,0 +1,107 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
12
+ schedule:
13
+ - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ubuntu-latest
18
+
19
+ strategy:
20
+ fail-fast: false
21
+
22
+ matrix:
23
+ ruby:
24
+ - 2.3
25
+ image:
26
+ - debian:buster
27
+ - amazonlinux:2
28
+ - ubuntu:focal
29
+
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+
33
+ - uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby }}
36
+ bundler-cache: true
37
+ rubygems: latest
38
+
39
+ - name: Cache vendor/bundle
40
+ uses: actions/cache@v1
41
+ id: cache_gem
42
+ with:
43
+ path: vendor/bundle
44
+ key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ github.sha }}
45
+ restore-keys: |
46
+ v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
47
+
48
+ - name: bundle update
49
+ run: |
50
+ set -xe
51
+ bundle config --local path $PWD/vendor/bundle
52
+ bundle config --local jobs $(nproc)
53
+ bundle update --retry 3
54
+
55
+ - name: Run test (1st installation)
56
+ run: bundle exec rake test
57
+ env:
58
+ IMAGE: ${{ matrix.image }}
59
+
60
+ - name: Run test (installation is skipped)
61
+ run: bundle exec rake test
62
+ env:
63
+ IMAGE: itamae-plugin:latest
64
+ DATADOG_UPGRADE: "false"
65
+ DD_API_KEY: api_key_2
66
+
67
+ - name: Run test (datadog-agent is upgraded)
68
+ run: bundle exec rake test
69
+ env:
70
+ IMAGE: itamae-plugin:latest
71
+ DATADOG_UPGRADE: "true"
72
+ DD_API_KEY: api_key_3
73
+
74
+ - name: Run test (DD_AGENT_MAJOR_VERSION is specified)
75
+ run: bundle exec rake test
76
+ env:
77
+ IMAGE: ${{ matrix.image }}
78
+ DD_AGENT_MAJOR_VERSION: 7
79
+
80
+ - name: Slack Notification (not success)
81
+ uses: lazy-actions/slatify@master
82
+ if: "! success()"
83
+ continue-on-error: true
84
+ with:
85
+ job_name: ${{ format('*build* ({0}, {1})', matrix.ruby, matrix.image) }}
86
+ type: ${{ job.status }}
87
+ icon_emoji: ":octocat:"
88
+ url: ${{ secrets.SLACK_WEBHOOK }}
89
+ token: ${{ secrets.GITHUB_TOKEN }}
90
+
91
+ notify:
92
+ needs:
93
+ - test
94
+
95
+ runs-on: ubuntu-latest
96
+
97
+ steps:
98
+ - name: Slack Notification (success)
99
+ uses: lazy-actions/slatify@master
100
+ if: always()
101
+ continue-on-error: true
102
+ with:
103
+ job_name: '*build*'
104
+ type: ${{ job.status }}
105
+ icon_emoji: ":octocat:"
106
+ url: ${{ secrets.SLACK_WEBHOOK }}
107
+ token: ${{ secrets.GITHUB_TOKEN }}
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,55 @@
1
+ ## Unreleased
2
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.3.1...master)
3
+
4
+ ## v0.3.1
5
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.3.0...v0.3.1)
6
+
7
+ * Support mitamae
8
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/25
9
+
10
+ ## v0.3.0
11
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.2...v0.3.0)
12
+
13
+ * Add `node[:datadog][:agent_major_version]`
14
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/22
15
+ * Add `node[:datadog][:integrations]` and `install_datadog_agent_integration`
16
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/23
17
+ * Support Ubuntu Focal
18
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/24
19
+
20
+ ## v0.2.2
21
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.1...v0.2.2)
22
+
23
+ * Transferred to itamae-plugins org
24
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/11
25
+ * Setup CI. Install wget if not installed. Add itamae to runtime dependency
26
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/12
27
+ * Add `spec.metadata`
28
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/13
29
+
30
+ ## v0.2.1
31
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.0...v0.2.1)
32
+
33
+ * Don't re-install datadog-agent if installed
34
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/9
35
+
36
+ ## v0.2.0
37
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.1.1...v0.2.0)
38
+
39
+ * update README
40
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/2
41
+ * Upgrade install process to install V6 agent.
42
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/6
43
+ * Overwrite install script
44
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/7
45
+ * Add upgrade option to README
46
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/8
47
+
48
+ ## v0.1.1
49
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.1.0...v0.1.1)
50
+
51
+ * Fix repo url
52
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/1
53
+
54
+ ## v0.1.0
55
+ Initial release
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Itamae::Plugin::Recipe::Datadog
2
2
 
3
- [Itamae](https://github.com/ryotarai/itamae) plugin to install Datadog Agent.
3
+ [Itamae](https://github.com/itamae-kitchen/itamae) plugin to install Datadog Agent.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/itamae-plugin-recipe-datadog.svg)](https://badge.fury.io/rb/itamae-plugin-recipe-datadog)
6
+ [![test](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/actions/workflows/test.yml/badge.svg)](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/actions/workflows/test.yml)
4
7
 
5
8
  ## Installation
6
9
 
@@ -21,7 +24,7 @@ Or install it yourself as:
21
24
  ## Usage
22
25
 
23
26
  ### Recipe
24
- ```
27
+ ```ruby
25
28
  # In your recipe
26
29
  include_recipe "datadog::install"
27
30
  ```
@@ -29,12 +32,17 @@ include_recipe "datadog::install"
29
32
  ### Node
30
33
  `$ itamae -y node.yml`
31
34
 
32
- ```
35
+ ```yaml
33
36
  # node.yml
34
37
  datadog:
35
38
  api_key: xxxxxx
36
39
  install_only: false # default: true
37
40
  upgrade: true # default: false
41
+ agent_major_version: 7 # default: none
42
+
43
+ integrations: # default: {}
44
+ datadog-puma: 1.1.0 # Install specified version (recommended)
45
+ datadog-vsphere: # Install latest version
38
46
  ```
39
47
 
40
48
  - `node[:datadog][:api_key]`
@@ -43,10 +51,37 @@ datadog:
43
51
  - An install option. If you want to install agent and don't start agent, please set this option`true`.
44
52
  - `node[:datadog][:upgrade]`
45
53
  - An install option. Upgrade datadog-agent version automatically.
54
+ - `node[:datadog][:agent_major_version]`
55
+ - Whether to install any major version of the agent. (e.g. `7`)
56
+ - default is none. installed with datadog-agent v6
57
+ - see https://docs.datadoghq.com/agent/versions/upgrade_to_agent_v7
58
+ - `node[:datadog][:integrations]`
59
+ - Install integrations
60
+ - see https://docs.datadoghq.com/agent/guide/integration-management/
61
+ - key: integration name (e.g. `datadog-puma`)
62
+ - value: integration version (e.g. `1.1.0`)
63
+
64
+ ## Definitions
65
+ ### install_datadog_agent_integration
66
+ Install datadog-agent integration
67
+
68
+ Usage
69
+
70
+ ```ruby
71
+ include_recipe "datadog::install_datadog_agent_integration"
72
+
73
+ # Install specified version (recommended)
74
+ install_datadog_agent_integration "datadog-puma" do
75
+ version "1.1.0"
76
+ end
77
+
78
+ # Install latest version
79
+ install_datadog_agent_integration "datadog-puma"
80
+ ```
46
81
 
47
82
  ## Contributing
48
83
 
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/speee/itamae-plugin-recipe-datadog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/itamae-plugins/itamae-plugin-recipe-datadog. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
50
85
 
51
86
 
52
87
  ## License
data/Rakefile CHANGED
@@ -1,6 +1,17 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
- RSpec::Core::RakeTask.new(:spec)
4
+ RSpec::Core::RakeTask.new(:serverspec)
5
5
 
6
- task :default => :spec
6
+ ENV["DOCKER_IMAGE"] = "itamae-plugin:latest"
7
+ ENV["IMAGE"] ||= "debian:buster"
8
+
9
+ desc "Run itamae"
10
+ task :itamae do
11
+ sh "itamae docker --node-yaml=spec/recipes/node.yml spec/recipes/install.rb --image=#{ENV["IMAGE"]} --tag #{ENV["DOCKER_IMAGE"]}"
12
+ end
13
+
14
+ desc "Run test"
15
+ task :test => %i(itamae serverspec)
16
+
17
+ task default: :test
@@ -6,14 +6,19 @@ require 'itamae/plugin/recipe/datadog/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "itamae-plugin-recipe-datadog"
8
8
  spec.version = Itamae::Plugin::Recipe::Datadog::VERSION
9
- spec.authors = ["Takahiro Kiso (takanamito)", "Speee, Inc."]
10
- spec.email = ["t.kiso0928@gmail.com"]
9
+ spec.authors = ["Takahiro Kiso (takanamito)", "sue445", "Speee, Inc."]
10
+ spec.email = ["t.kiso0928@gmail.com", "sue445@sue445.net"]
11
11
 
12
12
  spec.summary = %q{Itamae plugin to install datadog-agent.}
13
13
  spec.description = %q{Itamae plugin to install datadog-agent.}
14
- spec.homepage = "https://github.com/speee/itamae-plugin-recipe-datadog"
14
+ spec.homepage = "https://github.com/itamae-plugins/itamae-plugin-recipe-datadog"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
+ spec.metadata["rubygems_mfa_required"] = "true"
21
+
17
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
23
  f.match(%r{^(test|spec|features)/})
19
24
  end
@@ -21,7 +26,11 @@ Gem::Specification.new do |spec|
21
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
27
  spec.require_paths = ["lib"]
23
28
 
24
- spec.add_development_dependency "bundler", "~> 1.13"
25
- spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_dependency "itamae"
30
+
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "docker-api"
33
+ spec.add_development_dependency "rake"
26
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "serverspec"
27
36
  end
@@ -1,10 +1,15 @@
1
+ include_recipe "datadog::install_datadog_agent_integration"
2
+
1
3
  node.reverse_merge!(
2
4
  datadog: {
3
5
  install_only: true,
4
6
  upgrade: false,
7
+ integration: {},
5
8
  }
6
9
  )
7
10
 
11
+ package 'wget'
12
+
8
13
  execute 'download install script' do
9
14
  command 'wget https://raw.githubusercontent.com/DataDog/datadog-agent/main/cmd/agent/install_script.sh -O /tmp/install_script.sh'
10
15
 
@@ -25,6 +30,7 @@ execute 'install datadog-agent' do
25
30
  options['DD_API_KEY'] = node[:datadog][:api_key]
26
31
  options['DD_INSTALL_ONLY'] = 'true' if node[:datadog][:install_only]
27
32
  options['DD_UPGRADE'] = 'true' if node[:datadog][:upgrade]
33
+ options['DD_AGENT_MAJOR_VERSION'] = node[:datadog][:agent_major_version] if node[:datadog][:agent_major_version]
28
34
  option_str = options.map { |k, v| "#{k}=#{v}" }.join(' ')
29
35
  command "#{option_str} /tmp/install_script.sh"
30
36
 
@@ -34,3 +40,9 @@ execute 'install datadog-agent' do
34
40
  not_if 'ls /etc/datadog-agent/datadog.yaml'
35
41
  end
36
42
  end
43
+
44
+ node[:datadog][:integrations].each do |integration_name, integration_version|
45
+ install_datadog_agent_integration integration_name do
46
+ version integration_version
47
+ end
48
+ end
@@ -0,0 +1,14 @@
1
+ define :install_datadog_agent_integration, version: nil do
2
+ version = params[:version]
3
+ name = params[:name]
4
+
5
+ if version
6
+ execute "datadog-agent integration install -t #{name}==#{version} --allow-root" do
7
+ not_if "datadog-agent integration show #{name} | grep #{version}"
8
+ end
9
+ else
10
+ execute "datadog-agent integration install -t #{name} --allow-root" do
11
+ not_if "datadog-agent integration show #{name}"
12
+ end
13
+ end
14
+ end
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module Datadog
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
8
8
  end
data/mrblib ADDED
@@ -0,0 +1 @@
1
+ lib
metadata CHANGED
@@ -1,44 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-recipe-datadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Kiso (takanamito)
8
+ - sue445
8
9
  - Speee, Inc.
9
- autorequire:
10
+ autorequire:
10
11
  bindir: exe
11
12
  cert_chain: []
12
- date: 2022-03-19 00:00:00.000000000 Z
13
+ date: 2022-04-02 00:00:00.000000000 Z
13
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: itamae
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
14
29
  - !ruby/object:Gem::Dependency
15
30
  name: bundler
16
31
  requirement: !ruby/object:Gem::Requirement
17
32
  requirements:
18
- - - "~>"
33
+ - - ">="
19
34
  - !ruby/object:Gem::Version
20
- version: '1.13'
35
+ version: '0'
21
36
  type: :development
22
37
  prerelease: false
23
38
  version_requirements: !ruby/object:Gem::Requirement
24
39
  requirements:
25
- - - "~>"
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: docker-api
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
26
55
  - !ruby/object:Gem::Version
27
- version: '1.13'
56
+ version: '0'
28
57
  - !ruby/object:Gem::Dependency
29
58
  name: rake
30
59
  requirement: !ruby/object:Gem::Requirement
31
60
  requirements:
32
- - - "~>"
61
+ - - ">="
33
62
  - !ruby/object:Gem::Version
34
- version: '10.0'
63
+ version: '0'
35
64
  type: :development
36
65
  prerelease: false
37
66
  version_requirements: !ruby/object:Gem::Requirement
38
67
  requirements:
39
- - - "~>"
68
+ - - ">="
40
69
  - !ruby/object:Gem::Version
41
- version: '10.0'
70
+ version: '0'
42
71
  - !ruby/object:Gem::Dependency
43
72
  name: rspec
44
73
  requirement: !ruby/object:Gem::Requirement
@@ -53,14 +82,32 @@ dependencies:
53
82
  - - "~>"
54
83
  - !ruby/object:Gem::Version
55
84
  version: '3.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: serverspec
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
56
99
  description: Itamae plugin to install datadog-agent.
57
100
  email:
58
101
  - t.kiso0928@gmail.com
102
+ - sue445@sue445.net
59
103
  executables: []
60
104
  extensions: []
61
105
  extra_rdoc_files: []
62
106
  files:
107
+ - ".github/workflows/test.yml"
63
108
  - ".gitignore"
109
+ - ".rspec"
110
+ - CHANGELOG.md
64
111
  - CODE_OF_CONDUCT.md
65
112
  - Gemfile
66
113
  - LICENSE.txt
@@ -71,12 +118,18 @@ files:
71
118
  - itamae-plugin-recipe-datadog.gemspec
72
119
  - lib/itamae/plugin/recipe/datadog.rb
73
120
  - lib/itamae/plugin/recipe/datadog/install.rb
121
+ - lib/itamae/plugin/recipe/datadog/install_datadog_agent_integration.rb
74
122
  - lib/itamae/plugin/recipe/datadog/version.rb
75
- homepage: https://github.com/speee/itamae-plugin-recipe-datadog
123
+ - mrblib
124
+ homepage: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
76
125
  licenses:
77
126
  - MIT
78
- metadata: {}
79
- post_install_message:
127
+ metadata:
128
+ homepage_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
129
+ source_code_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
130
+ changelog_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/blob/master/CHANGELOG.md
131
+ rubygems_mfa_required: 'true'
132
+ post_install_message:
80
133
  rdoc_options: []
81
134
  require_paths:
82
135
  - lib
@@ -91,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
144
  - !ruby/object:Gem::Version
92
145
  version: '0'
93
146
  requirements: []
94
- rubygems_version: 3.0.3.1
95
- signing_key:
147
+ rubygems_version: 3.2.22
148
+ signing_key:
96
149
  specification_version: 4
97
150
  summary: Itamae plugin to install datadog-agent.
98
151
  test_files: []