gooddata 2.1.0 → 2.1.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: b5b1f5f142a1e5fb5ae689550364a5bdcdf9045af5fea13acd37f01997a329e1
4
- data.tar.gz: a7a3d5c467585b0672536ee74d1d125081cf4cbcebe1fe94187a47945764fd25
3
+ metadata.gz: b0a6047c04e32252d2247ddc1dd771330a89e54ea28d85c29ebbfbabe7b51b3e
4
+ data.tar.gz: b4380ee2cdc9ae5566efbcc7dde50fa3f918db471878db7cd0809ccc133ab810
5
5
  SHA512:
6
- metadata.gz: 33500f79f543efff14484ae90dc7446f0abe9d83e4143a103956f31fbab97ffe887311d7526588eda1a648462e49593ea42b111651cd1fbb892878de6a933bde
7
- data.tar.gz: bf50a7eb79fc8bfb5d84394b0a1d634be45d02c2fbd1c18328947b5c93a17941986c856124f3d1b00113efe02637de8b5fb94bf4509f5ee2663a5f0d332d2f0a
6
+ metadata.gz: 7e770b10ccddb418f87708c0fe144726ac2482707985be2b6456f749cf3332aab6866c79acbdc2adf0e4bd83e038a862c516770750d2459fd85c8df248e4e881
7
+ data.tar.gz: c1e667bd6c8b96917730908d05fd81c9553dece6b60cb30c1e6b4bacfaefcf07578cccc487e132fa85961744b96d82dcc398b3faade98907d6314748fdf1d036
@@ -25,19 +25,36 @@ jobs:
25
25
  git fetch upstream develop
26
26
  bundle exec pronto run -c upstream/develop --exit-code
27
27
 
28
- - name: unit tests
28
+ # UNIT TESTS ON LINUX IN ALL SUPPORTED RUBY VERSIONS
29
+ - name: unit tests 2.2
29
30
  stage: before-merge
30
31
  script: bundle exec rake test:unit
31
- rvm:
32
- - 2.2
33
- - 2.3
34
- - 2.4
35
- - 2.5
36
- - 2.6
37
- - jruby-1.7.19
38
- - jruby-9.1.5
39
- - jruby-9.1.7
40
- - jruby-9.1.14
32
+ rvm: 2.2
33
+
34
+ - name: unit tests 2.3
35
+ stage: before-merge
36
+ script: bundle exec rake test:unit
37
+ rvm: 2.3
38
+
39
+ - name: unit tests 2.4
40
+ stage: before-merge
41
+ script: bundle exec rake test:unit
42
+ rvm: 2.4
43
+
44
+ - name: unit tests 2.5
45
+ stage: before-merge
46
+ script: bundle exec rake test:unit
47
+ rvm: 2.5
48
+
49
+ - name: unit tests 2.6
50
+ stage: before-merge
51
+ script: bundle exec rake test:unit
52
+ rvm: 2.6
53
+
54
+ - name: unit tests jruby-9.1.14
55
+ stage: before-merge
56
+ script: bundle exec rake test:unit
57
+ rvm: jruby-9.1.14
41
58
 
42
59
  - name: sdk integration (vcr) tests - base
43
60
  stage: before-merge
@@ -193,6 +210,50 @@ jobs:
193
210
  name: staging3 - test environment clean-up
194
211
  env: GD_ENV=development
195
212
 
213
+ # AFTER MERGE UNIT TESTS ON ALTERNATIVE PLATFORM
214
+
215
+ - name: unit tests 2.3
216
+ stage: after-merge
217
+ script: bundle exec rake test:unit
218
+ os: osx
219
+ osx_image: xcode7.3
220
+ rvm: 2.3
221
+
222
+ - name: unit tests 2.4
223
+ stage: after-merge
224
+ script: bundle exec rake test:unit
225
+ os: osx
226
+ osx_image: xcode9.3
227
+ rvm: 2.4
228
+
229
+ - name: unit tests 2.5
230
+ stage: after-merge
231
+ script: bundle exec rake test:unit
232
+ os: osx
233
+ osx_image: xcode9
234
+ rvm: 2.5
235
+
236
+ - name: unit tests 2.6
237
+ stage: after-merge
238
+ script: bundle exec rake test:unit
239
+ os: osx
240
+ osx_image: xcode9
241
+ rvm: 2.6
242
+
243
+ - name: unit tests jruby-9.1.14
244
+ stage: after-merge
245
+ script: bundle exec rake test:unit
246
+ os: osx
247
+ rvm: jruby-9.1.14
248
+
249
+ - name: unit tests 2.2
250
+ stage: after-merge
251
+ before_install:
252
+ - gem install bundler -v 1.17
253
+ script: bundle exec rake test:unit
254
+ os: osx
255
+ rvm: 2.2
256
+
196
257
  - stage: gem-release
197
258
  name: deploy MRI gem
198
259
  rvm: 2.3
@@ -1,4 +1,10 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 2.1.1
3
+ - TMA-1423: handle windows shell in a healthy manner
4
+ - TMA-1424: fix server strings that cause trouble
5
+ - TMA-1404: explicitly fail when segments filter is not array
6
+ - TMA-1412: fix api cmd spec
7
+
2
8
  ## 2.1.0
3
9
  - TMA-1401: print message and request id on http error
4
10
  - Add doc section to contributing.md
data/Dockerfile CHANGED
@@ -15,7 +15,7 @@ RUN yum install -y curl which \
15
15
  && yum clean all \
16
16
  && rm -rf /var/cache/yum
17
17
 
18
- RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
18
+ RUN gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
19
19
  RUN curl -sSL https://get.rvm.io | bash -s stable
20
20
 
21
21
  # Switch to directory with sources
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'remote_syslog_logger'
4
+
3
5
  require_relative '../lib/gooddata'
4
6
 
5
7
  DEFAULT_BRICK = 'hello_world_brick'
@@ -12,15 +14,26 @@ def get_brick_params(prefix)
12
14
  ENV.select { |k,| k.to_s.match(/^#{prefix}.*/) }.map { |k, v| [k.slice(prefix.length..-1), v] }.to_h
13
15
  end
14
16
 
15
- brick_pipeline = GoodData::Bricks::Pipeline.send("#{brick_type}_pipeline")
16
- normal_params = get_brick_params(BRICK_PARAM_PREFIX)
17
- hidden_params = get_brick_params(HIDDEN_BRICK_PARAMS_PREFIX)
18
- params = normal_params.merge(hidden_params)
19
-
20
- params['values_to_mask'] = hidden_params.values
21
- commit_hash = ENV['GOODDATA_RUBY_COMMIT'] || ''
22
- execution_id = ENV['GDC_EXECUTION_ID']
23
- params['gooddata_ruby_commit'] = commit_hash
24
- params['GDC_LOG_DIRECTORY'] = ENV['GDC_LOG_DIRECTORY'] || '/tmp/'
25
- params['GDC_EXECUTION_ID'] = execution_id
26
- brick_pipeline.call(params)
17
+ syslog_node = ENV['NODE_NAME']
18
+ log = RemoteSyslogLogger.new(syslog_node, 514, :program => "ruby_#{brick_type}", :facility => 'local2')
19
+
20
+ log.info "action=#{brick_type}_execution status=init"
21
+
22
+ begin
23
+ brick_pipeline = GoodData::Bricks::Pipeline.send("#{brick_type}_pipeline")
24
+ normal_params = get_brick_params(BRICK_PARAM_PREFIX)
25
+ hidden_params = get_brick_params(HIDDEN_BRICK_PARAMS_PREFIX)
26
+ params = normal_params.merge(hidden_params)
27
+
28
+ params['values_to_mask'] = hidden_params.values
29
+ commit_hash = ENV['GOODDATA_RUBY_COMMIT'] || ''
30
+ execution_id = ENV['GDC_EXECUTION_ID']
31
+ params['gooddata_ruby_commit'] = commit_hash
32
+ params['GDC_LOG_DIRECTORY'] = ENV['GDC_LOG_DIRECTORY'] || '/tmp/'
33
+ params['GDC_EXECUTION_ID'] = execution_id
34
+ log.info "action=#{brick_type}_execution status=start commit_hash=#{commit_hash} execution_id=#{execution_id}"
35
+ brick_pipeline.call(params)
36
+ rescue StandardError => e
37
+ log.info "action=#{brick_type}_execution status=failed commit_hash=#{commit_hash} execution_id=#{execution_id} exception=#{e}"
38
+ raise
39
+ end
@@ -1,4 +1,4 @@
1
1
  apiVersion: v1
2
2
  name: lcm-bricks
3
3
  description: LCM Bricks
4
- version: 1.0.2
4
+ version: 1.0.3
@@ -54,26 +54,6 @@ data:
54
54
  annotations:
55
55
  description: "{{`{{ $labels.pod }}`}} was OOMKilled in the last 10 minutes. Investigate and/or increase memoryRequest or memoryLimit."
56
56
  summary: "{{`{{ $labels.pod }}`}} OOMKill occured"
57
- - record: "container_pod:lcm_pod_container_status_error:increase10m"
58
- expr: increase(kube_pod_container_status_terminated_reason{namespace='{{ .Release.Namespace }}', reason!~"Completed|OOMKilled"}[10m])
59
- - alert: "[LCM] Container exited with error on cluster={{ .Values.clusterId }}"
60
- expr: container_pod:lcm_pod_container_status_error:increase10m >= 1
61
- labels:
62
- severity: warning
63
- team: lcm # switch to msf in production
64
- cluster_id: {{ .Values.clusterId }}
65
- annotations:
66
- description: "{{`{{ $labels.pod }}`}} container exited with non-zero exit code in the last 10 minutes. Investigate and fix."
67
- summary: "{{`{{ $labels.pod }}`}} Container exited with error"
68
- - alert: "[LCM] Container exited with error on cluster={{ .Values.clusterId }}"
69
- expr: container_pod:lcm_pod_container_status_error:increase10m >= 2
70
- labels:
71
- severity: critical
72
- team: lcm # switch to msf in production
73
- cluster_id: {{ .Values.clusterId }}
74
- annotations:
75
- description: "{{`{{ $labels.pod }}`}} container exited with non-zero exit code in the last 10 minutes. Investigate and fix."
76
- summary: "{{`{{ $labels.pod }}`}} Container exited with error"
77
57
  - alert: "[LCM] Container is being throttled on cluster={{ .Values.clusterId }}"
78
58
  expr: rate(container_cpu_cfs_throttled_seconds_total{namespace='{{ .Release.Namespace }}'}[1m]) > 1
79
59
  for: 5m
@@ -39,7 +39,7 @@ module GoodData
39
39
  logger = Logger.new("#{log_directory}/#{execution_id}.log")
40
40
  logger.level = params['GDC_LOG_LEVEL'] || 'info'
41
41
  values_to_mask = params['values_to_mask'] || []
42
- logger = MaskLoggerDecorator.new(logger, values_to_mask) if values_to_mask.any?
42
+ logger = MaskLoggerDecorator.new(logger, values_to_mask)
43
43
  else
44
44
  logger = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
45
45
  logger.level = params['GDC_LOG_LEVEL'] || 'info'
@@ -58,9 +58,7 @@ module GoodData
58
58
  splunk_logger.level = params['SPLUNK_LOG_LEVEL'] || GoodData::DEFAULT_SPLUNKLOG_LEVEL
59
59
  splunk_logger = splunk_logger.extend(ContextLoggerDecorator)
60
60
  splunk_logger.context_source = GoodData.gd_logger
61
- values_to_mask = params['values_to_mask'] || []
62
- values_to_mask.concat MaskLoggerDecorator.extract_values params
63
- splunk_logger = MaskLoggerDecorator.new(splunk_logger, values_to_mask) if values_to_mask.any?
61
+ splunk_logger = MaskLoggerDecorator.new(splunk_logger, params)
64
62
  GoodData.splunk_logging_on splunk_logger
65
63
  end
66
64
 
@@ -9,9 +9,9 @@ module GoodData
9
9
  # entry-point
10
10
  # @param [Logger] logger logger to decorated
11
11
  # @param [Array] values_to_mask sensitive values to be masked out from logs
12
- def initialize(logger, values_to_mask = [])
12
+ def initialize(logger, params = [])
13
13
  @logger = logger
14
- @values_to_mask = values_to_mask
14
+ @values_to_mask = GoodData::Bricks::MaskLoggerDecorator.extract_values(params)
15
15
  end
16
16
 
17
17
  class << self
@@ -39,6 +39,14 @@ module GoodData
39
39
  end
40
40
  end
41
41
 
42
+ def debug?
43
+ true
44
+ end
45
+
46
+ %i[warn? error? fatal? info?].each do |level|
47
+ alias_method level, :debug?
48
+ end
49
+
42
50
  # Decorator pretends being inner logger itselfs.
43
51
  # @return inner logger class
44
52
  def class
@@ -62,13 +62,52 @@ module GoodData
62
62
  }
63
63
  end
64
64
 
65
+ def ask_for_credentials_on_windows(credentials_file_path = Helpers::AuthHelper.credentials_file)
66
+ puts 'Enter your GoodData credentials.'
67
+
68
+ old_credentials = Helpers::AuthHelper.read_credentials(credentials_file_path)
69
+
70
+ puts 'Email'
71
+ input = $stdin.gets.chomp
72
+ user = input.empty? ? old_credentials[:username] : input
73
+
74
+ puts 'Password'
75
+ input = $stdin.gets.chomp
76
+ password = input.empty? ? old_credentials[:password] : input
77
+
78
+ puts 'Authorization (Project) Token'
79
+ input = $stdin.gets.chomp
80
+ auth_token = input.empty? ? old_credentials[:auth_token] : input
81
+
82
+ puts 'Environment'
83
+ input = $stdin.gets.chomp
84
+ environment = input.empty? ? old_credentials[:environment] : input
85
+ # in windows console, an empty input does not flush the previous buffer
86
+ # so if you do not fill any environment, the previous value is still present in $stdin
87
+ # so this is a default
88
+ environment = GoodData::Project::DEFAULT_ENVIRONMENT if environment == auth_token
89
+
90
+ puts 'Server'
91
+ input = $stdin.gets.chomp
92
+ server = input.empty? ? old_credentials[:server] : input
93
+
94
+ # Return as struct
95
+ {
96
+ :username => user,
97
+ :password => password,
98
+ :auth_token => auth_token,
99
+ :environment => environment,
100
+ :server => server
101
+ }
102
+ end
103
+
65
104
  # Ask for credentials and store them
66
105
  def store(credentials_file_path = Helpers::AuthHelper.credentials_file)
67
106
  puts 'This will store credentials to GoodData in an UNencrypted form to your harddrive to file ~/.gooddata.'
68
107
  overwrite = GoodData::CLI.terminal.ask('Do you want to continue? (y/n)')
69
108
  return if overwrite != 'y'
70
109
 
71
- credentials = ask_for_credentials
110
+ credentials = GoodData::Helpers.running_on_windows? ? ask_for_credentials_on_windows : ask_for_credentials
72
111
 
73
112
  ovewrite = if File.exist?(credentials_file_path)
74
113
  GoodData::CLI.terminal.ask('Overwrite existing stored credentials (y/n)')
@@ -29,6 +29,8 @@ module GoodData
29
29
  fail "Parameter 'segments' contains duplicate segment id(s): #{duplicated_segment_ids.join(', ')}" if duplicated_segment_ids.any?
30
30
 
31
31
  if params.segments_filter
32
+ fail 'Segments filter should be a non-empty array!' if !params.segments_filter.is_a?(Array) || params.segments_filter.empty?
33
+
32
34
  segments_filter = params.segments_filter.map(&:downcase)
33
35
 
34
36
  filtered_segments = params.segments.select do |segment|
@@ -17,7 +17,7 @@ module GoodData
17
17
  extend GoodData::Mixin::ContentPropertyWriter
18
18
 
19
19
  content_property_reader :folders, :expression, :format
20
- content_property_writer :folders, :expression
20
+ content_property_writer :folders, :expression, :format
21
21
 
22
22
  class << self
23
23
  # Method intended to get all objects of that type in a specified project
@@ -162,7 +162,7 @@ module GoodData
162
162
  headers = options[:headers] || {}
163
163
 
164
164
  options = options.merge(headers)
165
- @server = RestClient::Resource.new server, options
165
+ @server = RestClient::Resource.new fix_server_url(server), options
166
166
 
167
167
  # Install at_exit handler first
168
168
  unless @at_exit_handler_installed
@@ -468,6 +468,8 @@ module GoodData
468
468
 
469
469
  def enrich_error_message(exception)
470
470
  begin
471
+ return exception unless exception.response
472
+
471
473
  response = JSON.parse(exception.response.body, symbolize_names: true)
472
474
  return exception unless exception.message && response[:error] && response[:error][:message] && response[:error][:requestId]
473
475
 
@@ -703,6 +705,17 @@ ERR
703
705
  end
704
706
  end
705
707
  end
708
+
709
+ def fix_server_url(server)
710
+ server = server.chomp('/')
711
+ if server.starts_with? 'http://'
712
+ server = server.sub 'http://', 'https://'
713
+ GoodData.logger.warn 'You specified the HTTP protocol in your server string. It has been autofixed to HTTPS.'
714
+ end
715
+
716
+ server = 'https://' + server unless server.starts_with? 'https://'
717
+ server
718
+ end
706
719
  end
707
720
  end
708
721
  end
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.0
4
+ version: 2.1.1
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-03-14 00:00:00.000000000 Z
17
+ date: 2019-03-22 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: license_finder