gazer 0.3.15 → 0.3.17
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.
- checksums.yaml +4 -4
- data/.github/workflows/p3-issue-label.yml +1 -1
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/ruby-ci.yml +7 -8
- data/.github/workflows/triage-issue-label.yml +2 -2
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +1 -1
- data/lib/gzr/commands/alert/randomize.rb +34 -20
- data/lib/gzr/commands/alert.rb +3 -3
- data/lib/gzr/commands/plan/randomize.rb +26 -12
- data/lib/gzr/commands/plan.rb +4 -4
- data/lib/gzr/modules/cron.rb +1 -1
- data/lib/gzr/modules/dashboard.rb +11 -1
- data/lib/gzr/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7edc9ace682c86e782414efff16fd9d527ec496ec5d4d34576ac38a8db7fe240
|
4
|
+
data.tar.gz: cc98f5b428b270a33e3526944eed4e3329a3d7c185bf0a2aeba020120b1327c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc6b38241988a5d50f9dd4541ee236419499642d2e835767718e9f678ae122b0d882b779cfef0b707697d23e269b4c44472809828c0d4781019a707cf697cfd
|
7
|
+
data.tar.gz: 89f1ee0acc075233d3861cec20e75ccbea5c986f8f74e76c24ffd9053f7705806b29ada67b88e43b60ec6e92a542b36878854f8b169d9c07ed457a69130d1868
|
@@ -12,8 +12,8 @@ jobs:
|
|
12
12
|
runs-on: ubuntu-latest
|
13
13
|
steps:
|
14
14
|
# Checkout code
|
15
|
-
- uses: actions/checkout@
|
16
|
-
- uses:
|
15
|
+
- uses: actions/checkout@v4
|
16
|
+
- uses: googleapis/release-please-action@v4
|
17
17
|
id: release
|
18
18
|
with:
|
19
19
|
release-type: ruby
|
@@ -29,14 +29,14 @@ jobs:
|
|
29
29
|
|
30
30
|
steps:
|
31
31
|
- name: Cancel Previous Runs
|
32
|
-
uses: styfle/cancel-workflow-action@0.
|
32
|
+
uses: styfle/cancel-workflow-action@0.12.1
|
33
33
|
with:
|
34
34
|
access_token: ${{ secrets.GITHUB_TOKEN }}
|
35
35
|
|
36
|
-
- uses: actions/checkout@
|
36
|
+
- uses: actions/checkout@v4
|
37
37
|
|
38
38
|
- name: Authenticate to Google Cloud
|
39
|
-
uses: google-github-actions/auth@
|
39
|
+
uses: google-github-actions/auth@v2
|
40
40
|
with:
|
41
41
|
credentials_json: ${{ secrets.GCP_AR_READER_SA_KEY }}
|
42
42
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
@@ -44,7 +44,7 @@ jobs:
|
|
44
44
|
export_environment_variables: true
|
45
45
|
|
46
46
|
- name: Set up Cloud SDK
|
47
|
-
uses: google-github-actions/setup-gcloud@
|
47
|
+
uses: google-github-actions/setup-gcloud@v2
|
48
48
|
|
49
49
|
- name: Authenticate Artifact Repository
|
50
50
|
run: gcloud auth configure-docker us-west1-docker.pkg.dev --quiet
|
@@ -231,7 +231,7 @@ jobs:
|
|
231
231
|
|
232
232
|
- name: Upload ts unit test results
|
233
233
|
if: ${{ always() }}
|
234
|
-
uses: actions/upload-artifact@
|
234
|
+
uses: actions/upload-artifact@v4
|
235
235
|
with:
|
236
236
|
name: ruby-ci-test-results-${{ matrix.looker }}
|
237
237
|
path: rspec.xml
|
@@ -243,19 +243,18 @@ jobs:
|
|
243
243
|
|
244
244
|
steps:
|
245
245
|
- name: Download Artifacts
|
246
|
-
uses: actions/download-artifact@
|
246
|
+
uses: actions/download-artifact@v4
|
247
247
|
with:
|
248
248
|
path: artifacts
|
249
249
|
|
250
250
|
- name: Publish Test Results
|
251
|
-
uses: EnricoMi/publish-unit-test-result-action@
|
251
|
+
uses: EnricoMi/publish-unit-test-result-action@v2
|
252
252
|
with:
|
253
253
|
# Cosmetic issue with `check_name` being associated to the wrong
|
254
254
|
# workflow: https://github.com/EnricoMi/publish-unit-test-result-action/issues/12
|
255
255
|
check_name: Ruby-CI Tests
|
256
256
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
257
257
|
report_individual_runs: true
|
258
|
-
hide_comments: orphaned commits
|
259
258
|
check_run_annotations: 'none'
|
260
259
|
compare_to_earlier_commit: false
|
261
260
|
files: 'artifacts/**/*.xml'
|
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
permissions:
|
10
10
|
issues: write
|
11
11
|
steps:
|
12
|
-
- uses: actions/github-script@
|
12
|
+
- uses: actions/github-script@v7
|
13
13
|
with:
|
14
14
|
script: |
|
15
15
|
github.rest.issues.addLabels({
|
@@ -17,4 +17,4 @@ jobs:
|
|
17
17
|
owner: context.repo.owner,
|
18
18
|
repo: context.repo.repo,
|
19
19
|
labels: ["need triage"]
|
20
|
-
})
|
20
|
+
})
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.17](https://github.com/looker-open-source/gzr/compare/v0.3.16...v0.3.17) (2024-07-19)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* continue after 403 error on dashboard cat getting alerts if user is not admin ([5074ec3](https://github.com/looker-open-source/gzr/commit/5074ec3ddc0d1278693fdec5b42d88602bb3ee46))
|
9
|
+
|
10
|
+
## [0.3.16](https://github.com/looker-open-source/gzr/compare/v0.3.15...v0.3.16) (2024-06-27)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* randomize a specific alert by alert_id ([0e9cf40](https://github.com/looker-open-source/gzr/commit/0e9cf401346845d4f740a75379161cecddf1669b))
|
16
|
+
* randomize a specific plan by plan_id ([99d30f1](https://github.com/looker-open-source/gzr/commit/99d30f1747eafa81989bfd3bfc728c5a367fc1e3))
|
17
|
+
|
3
18
|
## [0.3.15](https://github.com/looker-open-source/gzr/compare/v0.3.14...v0.3.15) (2024-06-12)
|
4
19
|
|
5
20
|
|
data/Gemfile.lock
CHANGED
@@ -33,8 +33,9 @@ module Gzr
|
|
33
33
|
include Gzr::Alert
|
34
34
|
include Gzr::User
|
35
35
|
include Gzr::Cron
|
36
|
-
def initialize(options)
|
36
|
+
def initialize(alert_id,options)
|
37
37
|
super()
|
38
|
+
@alert_id = alert_id
|
38
39
|
@options = options
|
39
40
|
end
|
40
41
|
|
@@ -50,32 +51,45 @@ module Gzr
|
|
50
51
|
with_session do
|
51
52
|
@me ||= query_me("id")
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
return nil
|
60
|
-
end unless alerts && alerts.length > 0
|
61
|
-
|
62
|
-
alerts.each do |alert|
|
63
|
-
crontab = alert[:cron]
|
64
|
-
if crontab == ""
|
65
|
-
say_warning("skipping alert #{alert[:id]} with no cron")
|
66
|
-
next
|
54
|
+
if @alert_id
|
55
|
+
alert = get_alert(@alert_id)
|
56
|
+
if alert
|
57
|
+
randomize_alert(alert,window)
|
58
|
+
else
|
59
|
+
say_warning("Alert #{@alert_id} not found")
|
67
60
|
end
|
68
|
-
|
61
|
+
else
|
62
|
+
req = {}
|
63
|
+
req[:disabled] = false
|
64
|
+
req[:all_owners] = @options[:all] unless @options[:all].nil?
|
65
|
+
alerts = search_alerts(**req)
|
69
66
|
begin
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
say_ok "No alerts found"
|
68
|
+
return nil
|
69
|
+
end unless alerts && alerts.length > 0
|
70
|
+
|
71
|
+
alerts.each do |alert|
|
72
|
+
randomize_alert(alert,window)
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
77
76
|
end
|
78
77
|
end
|
78
|
+
|
79
|
+
def randomize_alert(alert,window=60)
|
80
|
+
crontab = alert[:cron]
|
81
|
+
if crontab == ""
|
82
|
+
say_warning("skipping alert #{alert[:id]} with no cron")
|
83
|
+
return
|
84
|
+
end
|
85
|
+
crontab = randomize_cron(crontab, window)
|
86
|
+
begin
|
87
|
+
alert[:cron] = crontab
|
88
|
+
update_alert(alert[:id], alert)
|
89
|
+
rescue LookerSDK::UnprocessableEntity => e
|
90
|
+
say_warning("Skipping invalid entry")
|
91
|
+
end
|
92
|
+
end
|
79
93
|
end
|
80
94
|
end
|
81
95
|
end
|
data/lib/gzr/commands/alert.rb
CHANGED
@@ -51,19 +51,19 @@ module Gzr
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
desc 'randomize', 'Randomize the scheduled alerts on a server'
|
54
|
+
desc 'randomize [ALERT_ID]', 'Randomize the scheduled alerts on a server'
|
55
55
|
method_option :help, aliases: '-h', type: :boolean,
|
56
56
|
desc: 'Display usage information'
|
57
57
|
method_option :window, type: :numeric, default: 60,
|
58
58
|
desc: 'Length of window'
|
59
59
|
method_option :all, type: :boolean,
|
60
60
|
desc: 'Randomize all alerts regardless of owner'
|
61
|
-
def randomize(
|
61
|
+
def randomize(alert_id=nil)
|
62
62
|
if options[:help]
|
63
63
|
invoke :help, ['randomize']
|
64
64
|
else
|
65
65
|
require_relative 'alert/randomize'
|
66
|
-
Gzr::Commands::Alert::Randomize.new(options).execute
|
66
|
+
Gzr::Commands::Alert::Randomize.new(alert_id,options).execute
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -33,8 +33,9 @@ module Gzr
|
|
33
33
|
include Gzr::Plan
|
34
34
|
include Gzr::User
|
35
35
|
include Gzr::Cron
|
36
|
-
def initialize(options)
|
36
|
+
def initialize(plan_id,options)
|
37
37
|
super()
|
38
|
+
@plan_id = plan_id
|
38
39
|
@options = options
|
39
40
|
end
|
40
41
|
|
@@ -50,22 +51,35 @@ module Gzr
|
|
50
51
|
with_session do
|
51
52
|
@me ||= query_me("id")
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
if @plan_id
|
55
|
+
plan = query_scheduled_plan(@plan_id)
|
56
|
+
if plan
|
57
|
+
randomize_plan(plan,window)
|
58
|
+
else
|
59
|
+
say_warning("Plan #{@plan_id} not found")
|
59
60
|
end
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
say_warning("Skipping invalid entry")
|
61
|
+
else
|
62
|
+
plans = query_all_scheduled_plans( @options[:all]?'all':@me[:id] )
|
63
|
+
plans.each do |plan|
|
64
|
+
randomize_plan(plan,window)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
def randomize_plan(plan,window=60)
|
71
|
+
crontab = plan[:crontab]
|
72
|
+
if crontab == ""
|
73
|
+
say_warning("skipping plan #{plan[:id]} with no crontab")
|
74
|
+
return
|
75
|
+
end
|
76
|
+
crontab = randomize_cron(crontab, window)
|
77
|
+
begin
|
78
|
+
update_scheduled_plan(plan[:id], { crontab: crontab })
|
79
|
+
rescue LookerSDK::UnprocessableEntity => e
|
80
|
+
say_warning("Skipping invalid entry")
|
81
|
+
end
|
82
|
+
end
|
69
83
|
end
|
70
84
|
end
|
71
85
|
end
|
data/lib/gzr/commands/plan.rb
CHANGED
@@ -128,7 +128,7 @@ module Gzr
|
|
128
128
|
desc 'ls', 'List the scheduled plans on a server'
|
129
129
|
method_option :help, aliases: '-h', type: :boolean,
|
130
130
|
desc: 'Display usage information'
|
131
|
-
method_option :fields, type: :string, default: 'id,enabled,name,user(id,display_name),look_id,dashboard_id,lookml_dashboard_id',
|
131
|
+
method_option :fields, type: :string, default: 'id,enabled,name,user(id,display_name),look_id,dashboard_id,lookml_dashboard_id,crontab',
|
132
132
|
desc: 'Fields to display'
|
133
133
|
method_option :disabled, type: :boolean,
|
134
134
|
desc: 'Retrieve disable plans'
|
@@ -145,19 +145,19 @@ module Gzr
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
desc 'randomize', 'Randomize the scheduled plans on a server'
|
148
|
+
desc 'randomize [PLAN_ID]', 'Randomize the scheduled plans on a server'
|
149
149
|
method_option :help, aliases: '-h', type: :boolean,
|
150
150
|
desc: 'Display usage information'
|
151
151
|
method_option :window, type: :numeric, default: 60,
|
152
152
|
desc: 'Length of window'
|
153
153
|
method_option :all, type: :boolean,
|
154
154
|
desc: 'Randomize all plans regardless of owner'
|
155
|
-
def randomize(
|
155
|
+
def randomize(plan_id = nil)
|
156
156
|
if options[:help]
|
157
157
|
invoke :help, ['randomize']
|
158
158
|
else
|
159
159
|
require_relative 'plan/randomize'
|
160
|
-
Gzr::Commands::Plan::Randomize.new(options).execute
|
160
|
+
Gzr::Commands::Plan::Randomize.new(plan_id, options).execute
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
data/lib/gzr/modules/cron.rb
CHANGED
@@ -287,7 +287,17 @@ module Gzr
|
|
287
287
|
rewrite_color_palette!(o,default_colors)
|
288
288
|
end
|
289
289
|
end
|
290
|
-
alerts =
|
290
|
+
alerts = []
|
291
|
+
begin
|
292
|
+
alerts = search_alerts(fields: 'id,dashboard_element_id', group_by: 'dashboard', all_owners: true)
|
293
|
+
rescue LookerSDK::Forbidden => e
|
294
|
+
say_warning "Must be an admin user to look up all alerts"
|
295
|
+
begin
|
296
|
+
alerts = search_alerts(fields: 'id,dashboard_element_id', group_by: 'dashboard')
|
297
|
+
rescue LookerSDK::Error => e
|
298
|
+
say_warning "Error looking up alerts owned by user."
|
299
|
+
end
|
300
|
+
end
|
291
301
|
say_warning alerts if @options[:debug]
|
292
302
|
data[:dashboard_elements].each do |e|
|
293
303
|
alerts_found = alerts.select { |a| a[:dashboard_element_id] == e[:id]}
|
data/lib/gzr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -480,7 +480,7 @@ homepage: https://github.com/looker-open-source/gzr
|
|
480
480
|
licenses:
|
481
481
|
- MIT
|
482
482
|
metadata: {}
|
483
|
-
post_install_message:
|
483
|
+
post_install_message:
|
484
484
|
rdoc_options: []
|
485
485
|
require_paths:
|
486
486
|
- lib
|
@@ -496,7 +496,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
496
496
|
version: '0'
|
497
497
|
requirements: []
|
498
498
|
rubygems_version: 3.1.6
|
499
|
-
signing_key:
|
499
|
+
signing_key:
|
500
500
|
specification_version: 4
|
501
501
|
summary: Command line tool to manage the content of a Looker instance.
|
502
502
|
test_files: []
|