togglr-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +15 -0
  3. data/LICENSE +21 -0
  4. data/README.md +297 -0
  5. data/generated/Gemfile +9 -0
  6. data/generated/README.md +121 -0
  7. data/generated/Rakefile +10 -0
  8. data/generated/docs/DefaultApi.md +282 -0
  9. data/generated/docs/Error.md +18 -0
  10. data/generated/docs/ErrorBadRequest.md +18 -0
  11. data/generated/docs/ErrorError.md +18 -0
  12. data/generated/docs/ErrorInternalServerError.md +18 -0
  13. data/generated/docs/ErrorNotFound.md +18 -0
  14. data/generated/docs/ErrorPermissionDenied.md +18 -0
  15. data/generated/docs/ErrorTooManyRequests.md +18 -0
  16. data/generated/docs/ErrorUnauthorized.md +18 -0
  17. data/generated/docs/EvaluateResponse.md +22 -0
  18. data/generated/docs/FeatureErrorReport.md +22 -0
  19. data/generated/docs/FeatureHealth.md +30 -0
  20. data/generated/docs/HealthResponse.md +20 -0
  21. data/generated/git_push.sh +57 -0
  22. data/generated/lib/togglr-client/api/default_api.rb +284 -0
  23. data/generated/lib/togglr-client/api_client.rb +437 -0
  24. data/generated/lib/togglr-client/api_error.rb +58 -0
  25. data/generated/lib/togglr-client/configuration.rb +392 -0
  26. data/generated/lib/togglr-client/models/error.rb +237 -0
  27. data/generated/lib/togglr-client/models/error_bad_request.rb +244 -0
  28. data/generated/lib/togglr-client/models/error_error.rb +220 -0
  29. data/generated/lib/togglr-client/models/error_internal_server_error.rb +244 -0
  30. data/generated/lib/togglr-client/models/error_not_found.rb +244 -0
  31. data/generated/lib/togglr-client/models/error_permission_denied.rb +244 -0
  32. data/generated/lib/togglr-client/models/error_too_many_requests.rb +244 -0
  33. data/generated/lib/togglr-client/models/error_unauthorized.rb +244 -0
  34. data/generated/lib/togglr-client/models/evaluate_response.rb +289 -0
  35. data/generated/lib/togglr-client/models/feature_error_report.rb +274 -0
  36. data/generated/lib/togglr-client/models/feature_health.rb +342 -0
  37. data/generated/lib/togglr-client/models/health_response.rb +287 -0
  38. data/generated/lib/togglr-client/version.rb +15 -0
  39. data/generated/lib/togglr-client.rb +52 -0
  40. data/generated/spec/api/default_api_spec.rb +81 -0
  41. data/generated/spec/models/error_bad_request_spec.rb +36 -0
  42. data/generated/spec/models/error_error_spec.rb +36 -0
  43. data/generated/spec/models/error_internal_server_error_spec.rb +36 -0
  44. data/generated/spec/models/error_not_found_spec.rb +36 -0
  45. data/generated/spec/models/error_permission_denied_spec.rb +36 -0
  46. data/generated/spec/models/error_spec.rb +36 -0
  47. data/generated/spec/models/error_too_many_requests_spec.rb +36 -0
  48. data/generated/spec/models/error_unauthorized_spec.rb +36 -0
  49. data/generated/spec/models/evaluate_response_spec.rb +48 -0
  50. data/generated/spec/models/feature_error_report_spec.rb +48 -0
  51. data/generated/spec/models/feature_health_spec.rb +72 -0
  52. data/generated/spec/models/health_response_spec.rb +46 -0
  53. data/generated/spec/spec_helper.rb +111 -0
  54. data/generated/togglr-client.gemspec +41 -0
  55. data/lib/togglr/cache.rb +45 -0
  56. data/lib/togglr/client.rb +267 -0
  57. data/lib/togglr/config.rb +37 -0
  58. data/lib/togglr/errors.rb +25 -0
  59. data/lib/togglr/logger.rb +38 -0
  60. data/lib/togglr/metrics.rb +44 -0
  61. data/lib/togglr/models.rb +56 -0
  62. data/lib/togglr/options.rb +57 -0
  63. data/lib/togglr/request_context.rb +147 -0
  64. data/lib/togglr/version.rb +3 -0
  65. data/lib/togglr-client/api/default_api.rb +284 -0
  66. data/lib/togglr-client/api_client.rb +437 -0
  67. data/lib/togglr-client/api_error.rb +58 -0
  68. data/lib/togglr-client/configuration.rb +392 -0
  69. data/lib/togglr-client/models/error.rb +237 -0
  70. data/lib/togglr-client/models/error_bad_request.rb +244 -0
  71. data/lib/togglr-client/models/error_error.rb +220 -0
  72. data/lib/togglr-client/models/error_internal_server_error.rb +244 -0
  73. data/lib/togglr-client/models/error_not_found.rb +244 -0
  74. data/lib/togglr-client/models/error_permission_denied.rb +244 -0
  75. data/lib/togglr-client/models/error_too_many_requests.rb +244 -0
  76. data/lib/togglr-client/models/error_unauthorized.rb +244 -0
  77. data/lib/togglr-client/models/evaluate_response.rb +289 -0
  78. data/lib/togglr-client/models/feature_error_report.rb +274 -0
  79. data/lib/togglr-client/models/feature_health.rb +342 -0
  80. data/lib/togglr-client/models/health_response.rb +287 -0
  81. data/lib/togglr-client/version.rb +15 -0
  82. data/lib/togglr-client.rb +52 -0
  83. data/lib/togglr.rb +14 -0
  84. data/spec/examples.txt +11 -0
  85. data/spec/spec_helper.rb +29 -0
  86. data/spec/togglr_spec.rb +98 -0
  87. metadata +199 -0
@@ -0,0 +1,282 @@
1
+ # TogglrClient::DefaultApi
2
+
3
+ All URIs are relative to *http://localhost:8090*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**get_feature_health**](DefaultApi.md#get_feature_health) | **GET** /sdk/v1/features/{feature_key}/health | Get health status of feature (including auto-disable state) |
8
+ | [**report_feature_error**](DefaultApi.md#report_feature_error) | **POST** /sdk/v1/features/{feature_key}/report-error | Report feature execution error (for auto-disable) |
9
+ | [**sdk_v1_features_feature_key_evaluate_post**](DefaultApi.md#sdk_v1_features_feature_key_evaluate_post) | **POST** /sdk/v1/features/{feature_key}/evaluate | Evaluate feature for given context |
10
+ | [**sdk_v1_health_get**](DefaultApi.md#sdk_v1_health_get) | **GET** /sdk/v1/health | Health check for SDK server |
11
+
12
+
13
+ ## get_feature_health
14
+
15
+ > <FeatureHealth> get_feature_health(feature_key)
16
+
17
+ Get health status of feature (including auto-disable state)
18
+
19
+ ### Examples
20
+
21
+ ```ruby
22
+ require 'time'
23
+ require 'togglr-client'
24
+ # setup authorization
25
+ TogglrClient.configure do |config|
26
+ # Configure API key authorization: ApiKeyAuth
27
+ config.api_key['Authorization'] = 'YOUR API KEY'
28
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
29
+ # config.api_key_prefix['Authorization'] = 'Bearer'
30
+ end
31
+
32
+ api_instance = TogglrClient::DefaultApi.new
33
+ feature_key = 'feature_key_example' # String |
34
+
35
+ begin
36
+ # Get health status of feature (including auto-disable state)
37
+ result = api_instance.get_feature_health(feature_key)
38
+ p result
39
+ rescue TogglrClient::ApiError => e
40
+ puts "Error when calling DefaultApi->get_feature_health: #{e}"
41
+ end
42
+ ```
43
+
44
+ #### Using the get_feature_health_with_http_info variant
45
+
46
+ This returns an Array which contains the response data, status code and headers.
47
+
48
+ > <Array(<FeatureHealth>, Integer, Hash)> get_feature_health_with_http_info(feature_key)
49
+
50
+ ```ruby
51
+ begin
52
+ # Get health status of feature (including auto-disable state)
53
+ data, status_code, headers = api_instance.get_feature_health_with_http_info(feature_key)
54
+ p status_code # => 2xx
55
+ p headers # => { ... }
56
+ p data # => <FeatureHealth>
57
+ rescue TogglrClient::ApiError => e
58
+ puts "Error when calling DefaultApi->get_feature_health_with_http_info: #{e}"
59
+ end
60
+ ```
61
+
62
+ ### Parameters
63
+
64
+ | Name | Type | Description | Notes |
65
+ | ---- | ---- | ----------- | ----- |
66
+ | **feature_key** | **String** | | |
67
+
68
+ ### Return type
69
+
70
+ [**FeatureHealth**](FeatureHealth.md)
71
+
72
+ ### Authorization
73
+
74
+ [ApiKeyAuth](../README.md#ApiKeyAuth)
75
+
76
+ ### HTTP request headers
77
+
78
+ - **Content-Type**: Not defined
79
+ - **Accept**: application/json
80
+
81
+
82
+ ## report_feature_error
83
+
84
+ > report_feature_error(feature_key, feature_error_report)
85
+
86
+ Report feature execution error (for auto-disable)
87
+
88
+ ### Examples
89
+
90
+ ```ruby
91
+ require 'time'
92
+ require 'togglr-client'
93
+ # setup authorization
94
+ TogglrClient.configure do |config|
95
+ # Configure API key authorization: ApiKeyAuth
96
+ config.api_key['Authorization'] = 'YOUR API KEY'
97
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
98
+ # config.api_key_prefix['Authorization'] = 'Bearer'
99
+ end
100
+
101
+ api_instance = TogglrClient::DefaultApi.new
102
+ feature_key = 'feature_key_example' # String |
103
+ feature_error_report = TogglrClient::FeatureErrorReport.new({error_type: 'timeout', error_message: 'Service X did not respond in 5s'}) # FeatureErrorReport |
104
+
105
+ begin
106
+ # Report feature execution error (for auto-disable)
107
+ api_instance.report_feature_error(feature_key, feature_error_report)
108
+ rescue TogglrClient::ApiError => e
109
+ puts "Error when calling DefaultApi->report_feature_error: #{e}"
110
+ end
111
+ ```
112
+
113
+ #### Using the report_feature_error_with_http_info variant
114
+
115
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
116
+
117
+ > <Array(nil, Integer, Hash)> report_feature_error_with_http_info(feature_key, feature_error_report)
118
+
119
+ ```ruby
120
+ begin
121
+ # Report feature execution error (for auto-disable)
122
+ data, status_code, headers = api_instance.report_feature_error_with_http_info(feature_key, feature_error_report)
123
+ p status_code # => 2xx
124
+ p headers # => { ... }
125
+ p data # => nil
126
+ rescue TogglrClient::ApiError => e
127
+ puts "Error when calling DefaultApi->report_feature_error_with_http_info: #{e}"
128
+ end
129
+ ```
130
+
131
+ ### Parameters
132
+
133
+ | Name | Type | Description | Notes |
134
+ | ---- | ---- | ----------- | ----- |
135
+ | **feature_key** | **String** | | |
136
+ | **feature_error_report** | [**FeatureErrorReport**](FeatureErrorReport.md) | | |
137
+
138
+ ### Return type
139
+
140
+ nil (empty response body)
141
+
142
+ ### Authorization
143
+
144
+ [ApiKeyAuth](../README.md#ApiKeyAuth)
145
+
146
+ ### HTTP request headers
147
+
148
+ - **Content-Type**: application/json
149
+ - **Accept**: application/json
150
+
151
+
152
+ ## sdk_v1_features_feature_key_evaluate_post
153
+
154
+ > <EvaluateResponse> sdk_v1_features_feature_key_evaluate_post(feature_key, request_body)
155
+
156
+ Evaluate feature for given context
157
+
158
+ Returns feature evaluation result for given project and context. The project is derived from the API key.
159
+
160
+ ### Examples
161
+
162
+ ```ruby
163
+ require 'time'
164
+ require 'togglr-client'
165
+ # setup authorization
166
+ TogglrClient.configure do |config|
167
+ # Configure API key authorization: ApiKeyAuth
168
+ config.api_key['Authorization'] = 'YOUR API KEY'
169
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
170
+ # config.api_key_prefix['Authorization'] = 'Bearer'
171
+ end
172
+
173
+ api_instance = TogglrClient::DefaultApi.new
174
+ feature_key = 'feature_key_example' # String |
175
+ request_body = { key: 3.56} # Hash<String, Object> |
176
+
177
+ begin
178
+ # Evaluate feature for given context
179
+ result = api_instance.sdk_v1_features_feature_key_evaluate_post(feature_key, request_body)
180
+ p result
181
+ rescue TogglrClient::ApiError => e
182
+ puts "Error when calling DefaultApi->sdk_v1_features_feature_key_evaluate_post: #{e}"
183
+ end
184
+ ```
185
+
186
+ #### Using the sdk_v1_features_feature_key_evaluate_post_with_http_info variant
187
+
188
+ This returns an Array which contains the response data, status code and headers.
189
+
190
+ > <Array(<EvaluateResponse>, Integer, Hash)> sdk_v1_features_feature_key_evaluate_post_with_http_info(feature_key, request_body)
191
+
192
+ ```ruby
193
+ begin
194
+ # Evaluate feature for given context
195
+ data, status_code, headers = api_instance.sdk_v1_features_feature_key_evaluate_post_with_http_info(feature_key, request_body)
196
+ p status_code # => 2xx
197
+ p headers # => { ... }
198
+ p data # => <EvaluateResponse>
199
+ rescue TogglrClient::ApiError => e
200
+ puts "Error when calling DefaultApi->sdk_v1_features_feature_key_evaluate_post_with_http_info: #{e}"
201
+ end
202
+ ```
203
+
204
+ ### Parameters
205
+
206
+ | Name | Type | Description | Notes |
207
+ | ---- | ---- | ----------- | ----- |
208
+ | **feature_key** | **String** | | |
209
+ | **request_body** | [**Hash&lt;String, Object&gt;**](Object.md) | | |
210
+
211
+ ### Return type
212
+
213
+ [**EvaluateResponse**](EvaluateResponse.md)
214
+
215
+ ### Authorization
216
+
217
+ [ApiKeyAuth](../README.md#ApiKeyAuth)
218
+
219
+ ### HTTP request headers
220
+
221
+ - **Content-Type**: application/json
222
+ - **Accept**: application/json
223
+
224
+
225
+ ## sdk_v1_health_get
226
+
227
+ > <HealthResponse> sdk_v1_health_get
228
+
229
+ Health check for SDK server
230
+
231
+ ### Examples
232
+
233
+ ```ruby
234
+ require 'time'
235
+ require 'togglr-client'
236
+
237
+ api_instance = TogglrClient::DefaultApi.new
238
+
239
+ begin
240
+ # Health check for SDK server
241
+ result = api_instance.sdk_v1_health_get
242
+ p result
243
+ rescue TogglrClient::ApiError => e
244
+ puts "Error when calling DefaultApi->sdk_v1_health_get: #{e}"
245
+ end
246
+ ```
247
+
248
+ #### Using the sdk_v1_health_get_with_http_info variant
249
+
250
+ This returns an Array which contains the response data, status code and headers.
251
+
252
+ > <Array(<HealthResponse>, Integer, Hash)> sdk_v1_health_get_with_http_info
253
+
254
+ ```ruby
255
+ begin
256
+ # Health check for SDK server
257
+ data, status_code, headers = api_instance.sdk_v1_health_get_with_http_info
258
+ p status_code # => 2xx
259
+ p headers # => { ... }
260
+ p data # => <HealthResponse>
261
+ rescue TogglrClient::ApiError => e
262
+ puts "Error when calling DefaultApi->sdk_v1_health_get_with_http_info: #{e}"
263
+ end
264
+ ```
265
+
266
+ ### Parameters
267
+
268
+ This endpoint does not need any parameter.
269
+
270
+ ### Return type
271
+
272
+ [**HealthResponse**](HealthResponse.md)
273
+
274
+ ### Authorization
275
+
276
+ No authorization required
277
+
278
+ ### HTTP request headers
279
+
280
+ - **Content-Type**: Not defined
281
+ - **Accept**: application/json
282
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::Error
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::Error.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorBadRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorBadRequest.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **message** | **String** | | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorError.new(
15
+ message: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorInternalServerError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorInternalServerError.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorNotFound
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorNotFound.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorPermissionDenied
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorPermissionDenied.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorTooManyRequests
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorTooManyRequests.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # TogglrClient::ErrorUnauthorized
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error** | [**ErrorError**](ErrorError.md) | | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'togglr-client'
13
+
14
+ instance = TogglrClient::ErrorUnauthorized.new(
15
+ error: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,22 @@
1
+ # TogglrClient::EvaluateResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **feature_key** | **String** | | |
8
+ | **enabled** | **Boolean** | | |
9
+ | **value** | **String** | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'togglr-client'
15
+
16
+ instance = TogglrClient::EvaluateResponse.new(
17
+ feature_key: null,
18
+ enabled: null,
19
+ value: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,22 @@
1
+ # TogglrClient::FeatureErrorReport
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **error_type** | **String** | | |
8
+ | **error_message** | **String** | | |
9
+ | **context** | **Hash&lt;String, Object&gt;** | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'togglr-client'
15
+
16
+ instance = TogglrClient::FeatureErrorReport.new(
17
+ error_type: timeout,
18
+ error_message: Service X did not respond in 5s,
19
+ context: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,30 @@
1
+ # TogglrClient::FeatureHealth
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **feature_key** | **String** | | |
8
+ | **environment_key** | **String** | | |
9
+ | **enabled** | **Boolean** | | |
10
+ | **auto_disabled** | **Boolean** | | |
11
+ | **error_rate** | **Float** | | [optional] |
12
+ | **threshold** | **Float** | | [optional] |
13
+ | **last_error_at** | **Time** | | [optional] |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'togglr-client'
19
+
20
+ instance = TogglrClient::FeatureHealth.new(
21
+ feature_key: null,
22
+ environment_key: null,
23
+ enabled: null,
24
+ auto_disabled: null,
25
+ error_rate: 0.15,
26
+ threshold: 0.2,
27
+ last_error_at: null
28
+ )
29
+ ```
30
+
@@ -0,0 +1,20 @@
1
+ # TogglrClient::HealthResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **status** | **String** | | |
8
+ | **server_time** | **Time** | | |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'togglr-client'
14
+
15
+ instance = TogglrClient::HealthResponse.new(
16
+ status: null,
17
+ server_time: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="GIT_USER_ID"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="GIT_REPO_ID"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'