gooddata 2.1.6 → 2.1.7

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: 40420df95b074cfc5ddbc5fb7713d05f15998b91e4214fdea4c00a634d7d4a82
4
- data.tar.gz: 829426dcd8a5907471c7962c738caf2925797e05a6e0c6572acf2a230e268dfc
3
+ metadata.gz: 3e17ae0abbc9f71e3d9448bfe5c37de8504d0624b1135dd084134a41fb09bbf9
4
+ data.tar.gz: b3149a806b9b190d49cf3f7788a893e78cd7a5c6faf9ff062f7d913bca1614fa
5
5
  SHA512:
6
- metadata.gz: bb18709196a65a5d062774160c8d9819d443acb2efb8f3504faa6e6f201f61051d1628ae8e510d581498272d30be8354b55015ef9f4debca751c8146c5eca860
7
- data.tar.gz: 2fd6d24efcbd79f99d40b1c13be8c355ec075abc96843b0cae8397daba2f8b3031bdfb76a164055a668f0844a24bdcb71c1f9f393d7bf58ea892d901094ed433
6
+ metadata.gz: d1f731c22d261086b28a46db79dba73f4780a51d681d7f5361a23633b5dfdaf3f0780caebad83c572972b5eb9517bae9e94f37aeefcf4923d3139d8b5f49db67
7
+ data.tar.gz: c98718e4a72a3e66c2211f51568d1f5dce93ba9464efbd4930cbd0a692bb3a341cf4d858d85c36307e86dbeeee859677c53d670662bc00879b19eb8d4f9454a6
data/.gdc-ii-config.yaml CHANGED
@@ -6,10 +6,11 @@ microservices:
6
6
  BRICKS_VERSION: 'VERSION'
7
7
 
8
8
  integratedTests:
9
- - env: bash
9
+ - kind: 'image'
10
+ env: bash
10
11
  path: .
11
12
  vault:
12
- GD_SPEC_PASSWORD: ruby/test/bia_encryption_key
13
+ GD_SPEC_PASSWORD: "$VAULT_SPECIAL_PREFIX/ruby-test-bia-encryption-key"
13
14
  command: ./bin/run_smoke_tests.sh
14
15
  image: harbor.intgdc.com/staging/lcm-bricks:GIT_REV
15
16
  repo_mount_dir: /src
data/.pronto.yml CHANGED
@@ -1,3 +1,6 @@
1
+ all:
2
+ exclude:
3
+ - 'spec/**/*'
1
4
  verbose: true
2
5
  github:
3
6
  slug: gooddata/gooddata-ruby
data/CHANGELOG.md CHANGED
@@ -1,4 +1,16 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 2.1.7
3
+ - BUGFIX: TMA-1577 Bump brick version to 3.7.9
4
+ - FEATURE: MSF-16279 Allow gooddata-ruby to be installed with Rails 6 apps
5
+ - BUGFIX: TMA-1580 Increase java heap space and logging loading rows
6
+ - BUGFIX: TMA-1577 fix user group cache
7
+ - BUGFIX: TMA-1589 K8s bricks don't propagate errors to execution log
8
+ - BUGFIX: TMA-1571 Users Brick fails when segments_filter is used
9
+ - BUGFIX: TMA-1569 Don't create MUF when all its value is NULL
10
+ - II-603: Start using new NGVault secret paths
11
+ - II-550: Update structure of integrated tests
12
+ - CONFIG: TMA-1555 Separate test results for sdk and project test
13
+
2
14
  ## 2.1.6
3
15
  - FEATURE: TMA-783 Use SST for ADS connection as default
4
16
  - BUGFIX: TMA-1549 Using valid sso provider during testing update users
data/SDK_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.6
1
+ 2.1.7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.4
1
+ 3.7.9
data/bin/run_brick.rb CHANGED
@@ -33,7 +33,9 @@ begin
33
33
  params['GDC_EXECUTION_ID'] = execution_id
34
34
  log.info "action=#{brick_type}_execution status=start commit_hash=#{commit_hash} execution_id=#{execution_id}"
35
35
  brick_pipeline.call(params)
36
- rescue StandardError => e
36
+ rescue Exception => e # rubocop:disable RescueException
37
+ execution_log = GoodData.logger
38
+ execution_log.error "Execution failed. Message: #{e.message}. Error: #{e}" unless execution_log.nil?
37
39
  log.info "action=#{brick_type}_execution status=failed commit_hash=#{commit_hash} execution_id=#{execution_id} exception=#{e}"
38
40
  raise
39
41
  end
data/bin/users.sh CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ export JRUBY_OPTS=-J-Xmx2560m
4
+
3
5
  /bin/bash -l -c "bundle exec ./bin/run_brick.rb users_brick"
data/gooddata.gemspec CHANGED
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
54
54
 
55
55
  s.add_development_dependency 'sqlite3' if RUBY_PLATFORM != 'java'
56
56
 
57
- s.add_dependency 'activesupport', '> 4.2.9', '< 5.2'
57
+ s.add_dependency 'activesupport', '> 4.2.9', '< 6.1'
58
58
 
59
59
  s.add_dependency 'aws-sdk-s3', '~> 1.16'
60
60
  s.add_dependency 'docile', '~> 1.1'
@@ -45,7 +45,8 @@ module GoodData
45
45
  logger.level = params['GDC_LOG_LEVEL'] || 'info'
46
46
  end
47
47
  GoodData.logger = logger
48
- logger.info('Pipeline starts')
48
+ request_id = params.include?('GDC_REQUEST_ID') ? ", request_id=#{params['GDC_REQUEST_ID']}" : ''
49
+ logger.info("Pipeline starts #{request_id}")
49
50
  params['GDC_LOGGER'] = logger
50
51
  GoodData.logging_http_on if params['HTTP_LOGGING'] && params['HTTP_LOGGING'].to_b
51
52
 
@@ -30,8 +30,8 @@ module GoodData
30
30
 
31
31
  def self.users_brick_pipeline
32
32
  prepare([
33
- DecodeParamsMiddleware,
34
33
  LoggerMiddleware,
34
+ DecodeParamsMiddleware,
35
35
  BenchMiddleware,
36
36
  GoodDataMiddleware,
37
37
  AWSMiddleware,
@@ -42,8 +42,8 @@ module GoodData
42
42
 
43
43
  def self.user_filters_brick_pipeline
44
44
  prepare([
45
- DecodeParamsMiddleware,
46
45
  LoggerMiddleware,
46
+ DecodeParamsMiddleware,
47
47
  BenchMiddleware,
48
48
  GoodDataMiddleware,
49
49
  AWSMiddleware,
@@ -55,8 +55,8 @@ module GoodData
55
55
 
56
56
  def self.release_brick_pipeline
57
57
  prepare([
58
- DecodeParamsMiddleware,
59
58
  LoggerMiddleware,
59
+ DecodeParamsMiddleware,
60
60
  BenchMiddleware,
61
61
  GoodDataMiddleware,
62
62
  AWSMiddleware,
@@ -67,8 +67,8 @@ module GoodData
67
67
 
68
68
  def self.provisioning_brick_pipeline
69
69
  prepare([
70
- DecodeParamsMiddleware,
71
70
  LoggerMiddleware,
71
+ DecodeParamsMiddleware,
72
72
  BenchMiddleware,
73
73
  GoodDataMiddleware,
74
74
  AWSMiddleware,
@@ -79,8 +79,8 @@ module GoodData
79
79
 
80
80
  def self.rollout_brick_pipeline
81
81
  prepare([
82
- DecodeParamsMiddleware,
83
82
  LoggerMiddleware,
83
+ DecodeParamsMiddleware,
84
84
  BenchMiddleware,
85
85
  GoodDataMiddleware,
86
86
  AWSMiddleware,
@@ -92,8 +92,8 @@ module GoodData
92
92
  def self.hello_world_brick_pipeline
93
93
  prepare(
94
94
  [
95
- DecodeParamsMiddleware,
96
95
  LoggerMiddleware,
96
+ DecodeParamsMiddleware,
97
97
  BenchMiddleware,
98
98
  HelloWorldBrick
99
99
  ]
@@ -103,8 +103,8 @@ module GoodData
103
103
  def self.help_brick_pipeline
104
104
  prepare(
105
105
  [
106
- DecodeParamsMiddleware,
107
106
  LoggerMiddleware,
107
+ DecodeParamsMiddleware,
108
108
  BenchMiddleware,
109
109
  HelpBrick
110
110
  ]
@@ -251,7 +251,8 @@ module GoodData
251
251
  project.import_users(users, common_params)
252
252
  end
253
253
  when 'sync_domain_client_workspaces'
254
- domain_clients = domain.clients(:all, data_product)
254
+ all_domain_clients = domain.clients(:all, data_product)
255
+ domain_clients = all_domain_clients
255
256
  if params.segments
256
257
  segment_uris = params.segments.map(&:uri)
257
258
  domain_clients = domain_clients.select { |c| segment_uris.include?(c.segment_uri) }
@@ -262,7 +263,13 @@ module GoodData
262
263
  fail "Client id cannot be empty" if client_id.blank?
263
264
 
264
265
  c = domain_clients.detect { |specific_client| specific_client.id == client_id }
265
- fail "The client \"#{client_id}\" does not exist in data product \"#{data_product.data_product_id}\"" if c.nil?
266
+ if c.nil?
267
+ filtered_client = all_domain_clients.detect { |f_client| f_client.id == client_id }
268
+ fail "The client \"#{client_id}\" does not exist in data product \"#{data_product.data_product_id}\"" if filtered_client.nil?
269
+
270
+ GoodData.logger.info("Client \"#{client_id}\" is not belong to filtered segments")
271
+ next
272
+ end
266
273
 
267
274
  if params.segments && !segment_uris.include?(c.segment_uri)
268
275
  GoodData.logger.info("Client #{client_id} is outside segments_filter #{params.segments}")
@@ -347,7 +354,12 @@ module GoodData
347
354
  tmp = without_check(PARAMS, params) do
348
355
  File.open(data_source.realize(params), 'r:UTF-8')
349
356
  end
350
- data = CSV.read(tmp, headers: true)
357
+
358
+ begin
359
+ data = read_csv_file(tmp)
360
+ rescue Exception => e # rubocop:disable RescueException
361
+ fail "There was an error during loading users from csv file. Message: #{e.message}. Error: #{e}"
362
+ end
351
363
  end
352
364
 
353
365
  data.map do |row|
@@ -387,6 +399,30 @@ module GoodData
387
399
  }
388
400
  end
389
401
  end
402
+
403
+ def read_csv_file(path)
404
+ GoodData.logger.info('Start reading csv file')
405
+ res = []
406
+ row_count = 0
407
+
408
+ CSV.foreach(path, :headers => true) do |row|
409
+ if block_given?
410
+ data = yield row
411
+ else
412
+ data = row
413
+ end
414
+
415
+ if data
416
+ row_count += 1
417
+ res << data
418
+ end
419
+
420
+ GoodData.logger.info("Read #{row_count} rows") if (row_count % 50_000).zero?
421
+ end
422
+
423
+ GoodData.logger.info("Done reading csv file, total #{row_count} rows")
424
+ res
425
+ end
390
426
  end
391
427
  end
392
428
  end
@@ -315,7 +315,7 @@ module GoodData
315
315
  # Invoke action
316
316
  begin
317
317
  out = run_action action, params
318
- rescue => e
318
+ rescue Exception => e # rubocop:disable RescueException
319
319
  errors << {
320
320
  action: action,
321
321
  err: e,
@@ -1611,7 +1611,7 @@ module GoodData
1611
1611
  whitelisted_new_users, whitelisted_users = whitelist_users(new_users.map(&:to_hash), users_list, options[:whitelists])
1612
1612
 
1613
1613
  # First check that if groups are provided we have them set up
1614
- options[:user_groups_cache] = check_groups(new_users.map(&:to_hash).flat_map { |u| u[:user_group] || [] }.uniq, options[:user_groups_cache], options)
1614
+ user_groups_cache = check_groups(new_users.map(&:to_hash).flat_map { |u| u[:user_group] || [] }.uniq, options[:user_groups_cache], options)
1615
1615
 
1616
1616
  # conform the role on list of new users so we can diff them with the users coming from the project
1617
1617
  diffable_new_with_default_role = whitelisted_new_users.map do |u|
@@ -1707,11 +1707,17 @@ module GoodData
1707
1707
  end
1708
1708
  mappings.group_by { |_, g| g }.each do |g, mapping|
1709
1709
  remote_users = mapping.map { |user, _| user }.map { |login| users_lookup[login] && users_lookup[login].uri }.reject(&:nil?)
1710
+ GoodData.logger.info("Assigning users #{remote_users} to group #{g}")
1710
1711
  next if remote_users.empty?
1711
- user_groups(g).set_members(remote_users)
1712
+ existing_group = user_groups(g)
1713
+ if existing_group.nil?
1714
+ GoodData.logger.warn("Group #{g} not found!!!")
1715
+ else
1716
+ existing_group.set_members(remote_users)
1717
+ end
1712
1718
  end
1713
1719
  mentioned_groups = mappings.map(&:last).uniq
1714
- groups_to_cleanup = options[:user_groups_cache].reject { |g| mentioned_groups.include?(g.name) }
1720
+ groups_to_cleanup = user_groups_cache.reject { |g| mentioned_groups.include?(g.name) }
1715
1721
  # clean all groups not mentioned with exception of whitelisted users
1716
1722
  groups_to_cleanup.each do |g|
1717
1723
  g.set_members(whitelist_users(g.members.map(&:to_hash), [], options[:whitelists], :include).first.map { |x| x[:uri] })
@@ -1750,11 +1756,12 @@ module GoodData
1750
1756
  end
1751
1757
 
1752
1758
  def check_groups(specified_groups, user_groups_cache = nil, options = {})
1753
- user_groups_cache = user_groups if user_groups_cache.nil? || user_groups_cache.empty?
1754
- groups = user_groups_cache.map(&:name)
1759
+ current_user_groups = user_groups if user_groups_cache.nil? || user_groups_cache.empty?
1760
+ groups = current_user_groups.map(&:name)
1755
1761
  missing_groups = specified_groups - groups
1756
1762
  if options[:create_non_existing_user_groups]
1757
1763
  missing_groups.each do |g|
1764
+ GoodData.logger.info("Creating group #{g}")
1758
1765
  create_group(name: g, description: g)
1759
1766
  end
1760
1767
  else
@@ -1764,7 +1771,7 @@ module GoodData
1764
1771
  "#{groups.join(',')} and you asked for #{missing_groups.join(',')}"
1765
1772
  end
1766
1773
  end
1767
- user_groups_cache
1774
+ current_user_groups
1768
1775
  end
1769
1776
 
1770
1777
  # Update user
@@ -1778,7 +1785,8 @@ module GoodData
1778
1785
  payload = generate_user_payload(user_uri, 'ENABLED', roles)
1779
1786
  res = client.post(url, payload)
1780
1787
  failure = GoodData::Helpers.get_path(res, %w(projectUsersUpdateResult failed))
1781
- fail ArgumentError, "User #{user_uri} could not be aded. #{failure.first['message']}" unless failure.blank?
1788
+ fail ArgumentError, "User #{user_uri} could not be added. #{failure.first['message']}" unless failure.blank?
1789
+
1782
1790
  res
1783
1791
  end
1784
1792
  alias_method :add_user, :set_user_roles
@@ -199,16 +199,6 @@ module GoodData
199
199
  attr_cache
200
200
  end
201
201
 
202
- def self.create_muf_expression_cache(filters)
203
- filters.reduce({}) do |a, e|
204
- a[e[:login]] = e[:filters].reduce({}) do |h, filter|
205
- h[filter[:label]] = :none
206
- h
207
- end
208
- a
209
- end
210
- end
211
-
212
202
  # Walks over provided labels and picks those that have fewer than certain amount of values
213
203
  # This tries to balance for speed when working with small datasets (like users)
214
204
  # so it precaches the values and still be able to function for larger ones even
@@ -223,9 +213,12 @@ module GoodData
223
213
  # @param lookups_cache e.g. { 'label_uri': { "jirka@gooddata.com": 'value_uri' }}
224
214
  def self.create_expression(filter, labels_cache, lookups_cache, attr_cache, options = {})
225
215
  values = filter[:values]
216
+ # Do not create MUF for label when all its values is NULL (https://jira.intgdc.com/browse/TMA-1361)
217
+ non_null_values = values.select { |value| !value.nil? && value.downcase != 'null' }
218
+ return ['TRUE', []] if non_null_values.empty?
219
+
226
220
  label = labels_cache[filter[:label]]
227
221
  errors = []
228
- muf_expression_cache = options[:muf_expression_cache]
229
222
 
230
223
  element_uris_by_values = Hash[values.map do |v|
231
224
  if lookups_cache.key?(label.uri)
@@ -254,12 +247,7 @@ module GoodData
254
247
  # as the proper MUF can not be constructed yet
255
248
  case options[:type]
256
249
  when :muf
257
- muf_expression_cache[filter[:label]] = :all
258
- if muf_expression_cache.value?(:none) || muf_expression_cache.value?(:restrict)
259
- 'TRUE'
260
- else
261
- '1 <> 1'
262
- end
250
+ '1 <> 1'
263
251
  when :variable
264
252
  nil
265
253
  end
@@ -267,12 +255,10 @@ module GoodData
267
255
  # create a filter that is always true to ensure the user can see all data
268
256
  'TRUE'
269
257
  elsif filter[:over] && filter[:to]
270
- muf_expression_cache[filter[:label]] = :restrict
271
258
  over = attr_cache[filter[:over]]
272
259
  to = attr_cache[filter[:to]]
273
260
  "([#{label.attribute_uri}] IN (#{element_uris.sort.map { |e| '[' + e + ']' }.join(', ')})) OVER [#{over && over.uri}] TO [#{to && to.uri}]"
274
261
  else
275
- muf_expression_cache[filter[:label]] = :restrict
276
262
  "[#{label.attribute_uri}] IN (#{element_uris.sort.map { |e| '[' + e + ']' }.join(', ')})"
277
263
  end
278
264
  [expression, errors]
@@ -305,9 +291,8 @@ module GoodData
305
291
  small_labels = get_small_labels(labels_cache)
306
292
  lookups_cache = create_lookups_cache(small_labels)
307
293
  attrs_cache = create_attrs_cache(filters, options)
308
- muf_expression_cache = create_muf_expression_cache(filters)
309
294
  create_filter_proc = proc do |login, f|
310
- expression, errors = create_expression(f, labels_cache, lookups_cache, attrs_cache, options.merge(muf_expression_cache: muf_expression_cache[login]))
295
+ expression, errors = create_expression(f, labels_cache, lookups_cache, attrs_cache, options)
311
296
  safe_login = login.downcase
312
297
  profiles_uri = if options[:type] == :muf
313
298
  project_user = project_users.find { |u| u.login == safe_login }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-08-19 00:00:00.000000000 Z
17
+ date: 2019-11-01 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: license_finder
@@ -291,7 +291,7 @@ dependencies:
291
291
  version: 4.2.9
292
292
  - - "<"
293
293
  - !ruby/object:Gem::Version
294
- version: '5.2'
294
+ version: '6.1'
295
295
  type: :runtime
296
296
  prerelease: false
297
297
  version_requirements: !ruby/object:Gem::Requirement
@@ -301,7 +301,7 @@ dependencies:
301
301
  version: 4.2.9
302
302
  - - "<"
303
303
  - !ruby/object:Gem::Version
304
- version: '5.2'
304
+ version: '6.1'
305
305
  - !ruby/object:Gem::Dependency
306
306
  name: aws-sdk-s3
307
307
  requirement: !ruby/object:Gem::Requirement