itamae-plugin-recipe-datadog 0.2.0 → 0.3.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: d33dd23d2f0ffa8e206c56b2a5664bce2872ed0b0e804db40d02eeda35dadac5
4
- data.tar.gz: d251ffdb8fad88c15d5d3697c89bea3268dde6796dd93102e5a6559a1b6684e5
3
+ metadata.gz: 270aa0439537a833f4a965cfbe7408436ee6ded43ba9672e19796e8a4f5bae24
4
+ data.tar.gz: 22652f8ec2046564635eae3986a168b1457746e848d62aaf28f2e304a124ed7c
5
5
  SHA512:
6
- metadata.gz: 813a3703de9374b149137e71915aaf806849e2626b5e23cda0146ede07b711185bfaaaa184f1ef516a8a9f50cf39d841457a2ec4abd57963a15a7117825c7562
7
- data.tar.gz: 684839e54f9d4c331baf41720550b9c67359dcb78bb08a4ba024042c6d8a22cf2065898d3e4d96d92fa78c4d7a451a28cdd0157102e3fbc387cb053db3a4cf8f
6
+ metadata.gz: '048258f6743632da7b2f03c1f49b864663481e10bed25d50afe7acd87d230c18706e4ce915777ef0d0710907faae58f7b7b4148d9b666efed02a114c0136ce72'
7
+ data.tar.gz: 2c68f7f58e89053240926b461e2f5a110c87ae86e955d4efa66371b2c420d47253d09866bcce863f83ee82f59857d477d57391c386572bfdaf02282fa8878c83
@@ -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,49 @@
1
+ ## Unreleased
2
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.3.0...master)
3
+
4
+ ## v0.3.0
5
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.2...v0.3.0)
6
+
7
+ * Add `node[:datadog][:agent_major_version]`
8
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/22
9
+ * Add `node[:datadog][:integrations]` and `install_datadog_agent_integration`
10
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/23
11
+ * Support Ubuntu Focal
12
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/24
13
+
14
+ ## v0.2.2
15
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.1...v0.2.2)
16
+
17
+ * Transferred to itamae-plugins org
18
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/11
19
+ * Setup CI. Install wget if not installed. Add itamae to runtime dependency
20
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/12
21
+ * Add `spec.metadata`
22
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/13
23
+
24
+ ## v0.2.1
25
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.2.0...v0.2.1)
26
+
27
+ * Don't re-install datadog-agent if installed
28
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/9
29
+
30
+ ## v0.2.0
31
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.1.1...v0.2.0)
32
+
33
+ * update README
34
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/2
35
+ * Upgrade install process to install V6 agent.
36
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/6
37
+ * Overwrite install script
38
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/7
39
+ * Add upgrade option to README
40
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/8
41
+
42
+ ## v0.1.1
43
+ [full changelog](https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/compare/v0.1.0...v0.1.1)
44
+
45
+ * Fix repo url
46
+ * https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/pull/1
47
+
48
+ ## v0.1.0
49
+ Initial release
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  [Itamae](https://github.com/ryotarai/itamae) plugin to install Datadog Agent.
4
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)
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -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,12 +1,23 @@
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
- command 'wget https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh -O /tmp/install_script.sh'
14
+ command 'wget https://raw.githubusercontent.com/DataDog/datadog-agent/main/cmd/agent/install_script.sh -O /tmp/install_script.sh'
15
+
16
+ # If upgrade is enabled, always download the latest install_script.sh
17
+ # If upgrade is disabled, download only when `/tmp/install_script.sh` doesn't exist
18
+ unless node[:datadog][:upgrade]
19
+ not_if 'ls /tmp/install_script.sh'
20
+ end
10
21
  end
11
22
 
12
23
  file '/tmp/install_script.sh' do
@@ -19,6 +30,19 @@ execute 'install datadog-agent' do
19
30
  options['DD_API_KEY'] = node[:datadog][:api_key]
20
31
  options['DD_INSTALL_ONLY'] = 'true' if node[:datadog][:install_only]
21
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]
22
34
  option_str = options.map { |k, v| "#{k}=#{v}" }.join(' ')
23
35
  command "#{option_str} /tmp/install_script.sh"
36
+
37
+ # If upgrade is enabled, always run `install_script.sh`
38
+ # If upgrade is disabled, run `install_script.sh` only when datadog isn't installed
39
+ unless node[:datadog][:upgrade]
40
+ not_if 'ls /etc/datadog-agent/datadog.yaml'
41
+ end
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
24
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.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
8
8
  end
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.0
4
+ version: 0.3.0
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: 2019-02-27 00:00:00.000000000 Z
13
+ date: 2022-04-01 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,17 @@ 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
+ homepage: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
76
124
  licenses:
77
125
  - MIT
78
- metadata: {}
79
- post_install_message:
126
+ metadata:
127
+ homepage_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
128
+ source_code_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog
129
+ changelog_uri: https://github.com/itamae-plugins/itamae-plugin-recipe-datadog/blob/master/CHANGELOG.md
130
+ rubygems_mfa_required: 'true'
131
+ post_install_message:
80
132
  rdoc_options: []
81
133
  require_paths:
82
134
  - lib
@@ -91,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
143
  - !ruby/object:Gem::Version
92
144
  version: '0'
93
145
  requirements: []
94
- rubygems_version: 3.0.1
95
- signing_key:
146
+ rubygems_version: 3.2.22
147
+ signing_key:
96
148
  specification_version: 4
97
149
  summary: Itamae plugin to install datadog-agent.
98
150
  test_files: []