govuk_app_config 4.4.3 → 4.6.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: 3f16f62211076d736b18b819761138fd5dfa687e5ed28287f1f4123e549c78fa
4
- data.tar.gz: 7684a590d49e6455e3e3ad20976c64cc4e64df9a1b3ab68f22317a42d3635fe4
3
+ metadata.gz: af0d0c077a99208b9ea35cae5cf9c3709f3438351cf9ca4505d65fa1316a0d6d
4
+ data.tar.gz: 47cba1eb775a978b13f6f412c7656f186cd949333be0f544fb911fd7282fdf26
5
5
  SHA512:
6
- metadata.gz: e66c28bc057dee6ee862209809282b6c6b419733023a1496ed108be9dcebd8186e37933fc1bb54ee98f0299d4d2358592a91428b992569e37bf9c35408e90b29
7
- data.tar.gz: f13576617de0af36f1367a9aa56c56745cb6329b1446788ac17dcfb5cea4c4cf8da591d571ffd8e21356546f905983a2651bf251a9244f4f35be258bf8c30517
6
+ metadata.gz: d8c3eb4089c054710ec20f14d439c9fb54106fe476d5044dc92cabd0f96d56f2345807edefaddd2bd4736e6f04cf8144af6d23ee7392e3bfcc5434cb4d1214b8
7
+ data.tar.gz: de87e2236b6def3d21bb010ada8f3e217c192cfdc215d2949408c7ffc1abcf8e7320afe6df38de864ec22b086fe0dfe8b4b3aeb1636b9ad2c9ceec658c849f17
@@ -0,0 +1,56 @@
1
+ on: [push, pull_request]
2
+ jobs:
3
+ # Run the test suite against multiple Ruby and Rails versions
4
+ test_matrix:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
9
+ ruby: [2.7, '3.0', 3.1]
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby }}
16
+ bundler-cache: true
17
+ - run: bundle exec rake
18
+
19
+ # Branch protection rules cannot directly depend on status checks from matrix jobs.
20
+ # So instead we define `test` as a dummy job which only runs after the preceding `test_matrix` checks have passed.
21
+ # Solution inspired by: https://github.community/t/status-check-for-a-matrix-jobs/127354/3
22
+ test:
23
+ needs: test_matrix
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - run: echo "All matrix tests have passed 🚀"
27
+
28
+ release:
29
+ needs: test
30
+ runs-on: ubuntu-latest
31
+ if: ${{ github.ref == 'refs/heads/main' }}
32
+ permissions:
33
+ contents: write
34
+ steps:
35
+ - uses: actions/checkout@v3
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ rubygems: latest
39
+ - env:
40
+ GEM_HOST_API_KEY: ${{ secrets.ALPHAGOV_RUBYGEMS_API_KEY }}
41
+ GEM_NAME: govuk_app_config
42
+ run: |
43
+ VERSION=$(ruby -e "puts eval(File.read('$GEM_NAME.gemspec')).version")
44
+ GEM_VERSION=$(gem list --exact --remote $GEM_NAME)
45
+
46
+ # Publish to RubyGems.org
47
+ if [ "${GEM_VERSION}" != "$GEM_NAME (${VERSION})" ]; then
48
+ gem build $GEM_NAME.gemspec
49
+ gem push "$GEM_NAME-${VERSION}.gem"
50
+ fi
51
+
52
+ # Create a release tag
53
+ if ! git ls-remote --tags --exit-code origin v${VERSION}; then
54
+ git tag v${VERSION}
55
+ git push --tags
56
+ fi
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 2.7.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # 4.6.1
2
+
3
+ - Fixes warning message to refer to correct Sidekiq gem dependency name ([#243](https://github.com/alphagov/govuk_app_config/pull/243)).
4
+
5
+ # 4.6.0
6
+
7
+ - Add a warning for apps using GovukError with Sidekiq that don't have sentry-sidekiq installed ([#241](https://github.com/alphagov/govuk_app_config/pull/241)).
8
+ - Add internal Sidekiq exception "Sidekiq::JobRetry::Skip" to excluded exceptions ([#241](https://github.com/alphagov/govuk_app_config/pull/241)).
9
+
10
+ # 4.5.0
11
+
12
+ - Add lux.speedcurve.com to connect_src for GOV.UK Content Security Policy ([#232](https://github.com/alphagov/govuk_app_config/pull/232))
13
+ - Fix prometheus_exporter to only be enabled when the GOVUK_PROMETHEUS_EXPORTER env var is set to "true" ([#231](https://github.com/alphagov/govuk_app_config/pull/231)).
14
+ - Add Prometheus monitoring for EKS section to README.md ([#231](https://github.com/alphagov/govuk_app_config/pull/231)).
15
+ - Fix govuk_error being incompatible with Ruby >= 3 ([#233](https://github.com/alphagov/govuk_app_config/pull/233))
16
+ - Require Ruby 2.7 as the minimum supported Ruby version ([#233](https://github.com/alphagov/govuk_app_config/pull/233))
17
+ - Require Sentry 5 and Unicorn 6 major versions ([#237](https://github.com/alphagov/govuk_app_config/pull/237))
18
+ - Prevent sentry-rails logger warnings when govuk_error is used with non-Rails apps ([#234](https://github.com/alphagov/govuk_app_config/pull/234))
19
+
1
20
  # 4.4.3
2
21
 
3
22
  - Update prometheus exporter server to 0.0.0.0 from localhost ([#227](https://github.com/alphagov/govuk_app_config/pull/227)).
data/README.md CHANGED
@@ -7,6 +7,7 @@ Adds the basics of a GOV.UK application:
7
7
  - Statsd client for reporting stats
8
8
  - Rails logging
9
9
  - Content Security Policy generation for frontend apps
10
+ - Prometheus monitoring for EKS
10
11
 
11
12
  ## Installation
12
13
 
@@ -166,6 +167,15 @@ GovukContentSecurityPolicy.configure
166
167
 
167
168
  Some frontend apps support languages that are not defined in the i18n gem. This provides them with our own custom rules for these languages.
168
169
 
170
+ ## Prometheus monitoring for EKS
171
+
172
+ Create a `/config/initializers/prometheus.rb` file in the app and add the following
173
+
174
+ ```ruby
175
+ require "govuk_app_config/govuk_prometheus_exporter"
176
+ GovukPrometheusExporter.configure
177
+ ```
178
+
169
179
  ## License
170
180
 
171
181
  [MIT License](LICENSE.md)
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  desc "Lint Ruby"
7
7
  task :lint do
8
- sh "bundle exec rubocop --format clang"
8
+ sh "bundle exec rubocop"
9
9
  end
10
10
 
11
11
  task default: %i[spec lint]
@@ -13,28 +13,28 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/alphagov/govuk_app_config"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.required_ruby_version = ">= 2.6"
16
+ spec.required_ruby_version = ">= 2.7"
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
19
  spec.bindir = "exe"
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = %w[lib]
22
22
 
23
- spec.add_dependency "logstasher", ">= 1.2.2", "< 2.2.0"
24
- spec.add_dependency "prometheus_exporter", "~> 2.0.2"
25
- spec.add_dependency "puma", "~> 5.0"
26
- spec.add_dependency "sentry-rails", "~> 4.5.0"
27
- spec.add_dependency "sentry-ruby", "~> 4.5.0"
28
- spec.add_dependency "statsd-ruby", "~> 1.5.0"
29
- spec.add_dependency "unicorn", ">= 5.4", "< 5.9"
23
+ spec.add_dependency "logstasher", "~> 2.1"
24
+ spec.add_dependency "prometheus_exporter", "~> 2.0"
25
+ spec.add_dependency "puma", "~> 5.6"
26
+ spec.add_dependency "sentry-rails", "~> 5.3"
27
+ spec.add_dependency "sentry-ruby", "~> 5.3"
28
+ spec.add_dependency "statsd-ruby", "~> 1.5"
29
+ spec.add_dependency "unicorn", "~> 6.1"
30
30
 
31
31
  spec.add_development_dependency "byebug"
32
32
  spec.add_development_dependency "climate_control"
33
33
  spec.add_development_dependency "rack-test", "~> 1.1"
34
- spec.add_development_dependency "rails", "~> 6"
34
+ spec.add_development_dependency "rails", "~> 7"
35
35
  spec.add_development_dependency "rake", "~> 13.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.10"
37
37
  spec.add_development_dependency "rspec-its", "~> 1.3"
38
- spec.add_development_dependency "rubocop-govuk"
38
+ spec.add_development_dependency "rubocop-govuk", "4.4.0"
39
39
  spec.add_development_dependency "webmock"
40
40
  end
@@ -31,11 +31,10 @@ module GovukContentSecurityPolicy
31
31
  :data, # Base64 encoded images
32
32
  *GOVUK_DOMAINS,
33
33
  *GOOGLE_ANALYTICS_DOMAINS, # Tracking pixels
34
+ # Speedcurve real user monitoring (RUM) - as per: https://support.speedcurve.com/docs/add-rum-to-your-csp
35
+ "lux.speedcurve.com",
34
36
  # Some content still links to an old domain we used to use
35
- "assets.digital.cabinet-office.gov.uk",
36
- # Allow images to be loaded for Speedcurve's LUX - used for
37
- # getting real user metrics on GOV.UK
38
- "lux.speedcurve.com"
37
+ "assets.digital.cabinet-office.gov.uk"
39
38
 
40
39
  # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
41
40
  policy.script_src :self,
@@ -71,6 +70,8 @@ module GovukContentSecurityPolicy
71
70
  policy.connect_src :self,
72
71
  *GOVUK_DOMAINS,
73
72
  *GOOGLE_ANALYTICS_DOMAINS,
73
+ # Speedcurve real user monitoring (RUM) - as per: https://support.speedcurve.com/docs/add-rum-to-your-csp
74
+ "lux.speedcurve.com",
74
75
  # Allow connecting to web chat from HMRC contact pages
75
76
  "www.tax.service.gov.uk",
76
77
  # Allow JSON call to Nuance - HMRC web chat provider
@@ -53,6 +53,7 @@ module GovukError
53
53
  "Mongoid::Errors::DocumentNotFound",
54
54
  "Sinatra::NotFound",
55
55
  "Slimmer::IntermittentRetrievalError",
56
+ "Sidekiq::JobRetry::Skip",
56
57
  ]
57
58
 
58
59
  # This will exclude exceptions that are triggered by one of the ignored
@@ -1,5 +1,5 @@
1
1
  require "sentry-ruby"
2
- require "sentry-rails"
2
+ require "sentry-rails" if defined?(Rails)
3
3
  require "govuk_app_config/govuk_statsd"
4
4
  require "govuk_app_config/govuk_error/configuration"
5
5
  require "govuk_app_config/version"
@@ -21,9 +21,9 @@ module GovukError
21
21
  args[:tags][:govuk_app_config_version] = GovukAppConfig::VERSION
22
22
 
23
23
  if exception_or_message.is_a?(String)
24
- Sentry.capture_message(exception_or_message, args)
24
+ Sentry.capture_message(exception_or_message, **args)
25
25
  else
26
- Sentry.capture_exception(exception_or_message, args)
26
+ Sentry.capture_exception(exception_or_message, **args)
27
27
  end
28
28
  end
29
29
 
@@ -34,6 +34,10 @@ module GovukError
34
34
  def self.configure
35
35
  raise GovukError::AlreadyInitialised if is_configured?
36
36
 
37
+ if defined?(Sidekiq) && !defined?(Sentry::Sidekiq)
38
+ warn "Warning: GovukError is not configured to track Sidekiq errors, install the sentry-sidekiq gem to track them."
39
+ end
40
+
37
41
  Sentry.init do |sentry_config|
38
42
  config = Configuration.new(sentry_config)
39
43
  yield config if block_given?
@@ -1,6 +1,6 @@
1
1
  module GovukPrometheusExporter
2
2
  def self.configure
3
- unless Rails.env == "test"
3
+ unless Rails.env == "test" || (ENV["GOVUK_PROMETHEUS_EXPORTER"]) != "true"
4
4
  require "prometheus_exporter"
5
5
  require "prometheus_exporter/server"
6
6
  require "prometheus_exporter/middleware"
@@ -1,3 +1,3 @@
1
1
  module GovukAppConfig
2
- VERSION = "4.4.3".freeze
2
+ VERSION = "4.6.1".freeze
3
3
  end
metadata CHANGED
@@ -1,125 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_app_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.3
4
+ version: 4.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-18 00:00:00.000000000 Z
11
+ date: 2022-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstasher
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.2.2
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: 2.2.0
19
+ version: '2.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 1.2.2
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: 2.2.0
26
+ version: '2.1'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: prometheus_exporter
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
- version: 2.0.2
33
+ version: '2.0'
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
38
  - - "~>"
45
39
  - !ruby/object:Gem::Version
46
- version: 2.0.2
40
+ version: '2.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: puma
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '5.0'
47
+ version: '5.6'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '5.0'
54
+ version: '5.6'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: sentry-rails
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: 4.5.0
61
+ version: '5.3'
68
62
  type: :runtime
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: 4.5.0
68
+ version: '5.3'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: sentry-ruby
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: 4.5.0
75
+ version: '5.3'
82
76
  type: :runtime
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: 4.5.0
82
+ version: '5.3'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: statsd-ruby
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: 1.5.0
89
+ version: '1.5'
96
90
  type: :runtime
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: 1.5.0
96
+ version: '1.5'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: unicorn
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '5.4'
110
- - - "<"
101
+ - - "~>"
111
102
  - !ruby/object:Gem::Version
112
- version: '5.9'
103
+ version: '6.1'
113
104
  type: :runtime
114
105
  prerelease: false
115
106
  version_requirements: !ruby/object:Gem::Requirement
116
107
  requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: '5.4'
120
- - - "<"
108
+ - - "~>"
121
109
  - !ruby/object:Gem::Version
122
- version: '5.9'
110
+ version: '6.1'
123
111
  - !ruby/object:Gem::Dependency
124
112
  name: byebug
125
113
  requirement: !ruby/object:Gem::Requirement
@@ -168,14 +156,14 @@ dependencies:
168
156
  requirements:
169
157
  - - "~>"
170
158
  - !ruby/object:Gem::Version
171
- version: '6'
159
+ version: '7'
172
160
  type: :development
173
161
  prerelease: false
174
162
  version_requirements: !ruby/object:Gem::Requirement
175
163
  requirements:
176
164
  - - "~>"
177
165
  - !ruby/object:Gem::Version
178
- version: '6'
166
+ version: '7'
179
167
  - !ruby/object:Gem::Dependency
180
168
  name: rake
181
169
  requirement: !ruby/object:Gem::Requirement
@@ -222,16 +210,16 @@ dependencies:
222
210
  name: rubocop-govuk
223
211
  requirement: !ruby/object:Gem::Requirement
224
212
  requirements:
225
- - - ">="
213
+ - - '='
226
214
  - !ruby/object:Gem::Version
227
- version: '0'
215
+ version: 4.4.0
228
216
  type: :development
229
217
  prerelease: false
230
218
  version_requirements: !ruby/object:Gem::Requirement
231
219
  requirements:
232
- - - ">="
220
+ - - '='
233
221
  - !ruby/object:Gem::Version
234
- version: '0'
222
+ version: 4.4.0
235
223
  - !ruby/object:Gem::Dependency
236
224
  name: webmock
237
225
  requirement: !ruby/object:Gem::Requirement
@@ -254,13 +242,13 @@ extensions: []
254
242
  extra_rdoc_files: []
255
243
  files:
256
244
  - ".github/dependabot.yml"
245
+ - ".github/workflows/ci.yml"
257
246
  - ".gitignore"
258
247
  - ".rspec"
259
248
  - ".rubocop.yml"
260
249
  - ".ruby-version"
261
250
  - CHANGELOG.md
262
251
  - Gemfile
263
- - Jenkinsfile
264
252
  - LICENSE.md
265
253
  - README.md
266
254
  - Rakefile
@@ -301,14 +289,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
289
  requirements:
302
290
  - - ">="
303
291
  - !ruby/object:Gem::Version
304
- version: '2.6'
292
+ version: '2.7'
305
293
  required_rubygems_version: !ruby/object:Gem::Requirement
306
294
  requirements:
307
295
  - - ">="
308
296
  - !ruby/object:Gem::Version
309
297
  version: '0'
310
298
  requirements: []
311
- rubygems_version: 3.0.3
299
+ rubygems_version: 3.3.14
312
300
  signing_key:
313
301
  specification_version: 4
314
302
  summary: Base configuration for GOV.UK applications
data/Jenkinsfile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env groovy
2
-
3
- library("govuk")
4
-
5
- node {
6
- govuk.buildProject()
7
- }