shipit-engine 0.8.2 → 0.8.3
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/README.md +5 -1
- data/lib/shipit/version.rb +1 -1
- data/lib/shipit.rb +5 -2
- data/lib/tasks/teams.rake +30 -0
- metadata +2 -2
- data/lib/tasks/team.rake +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98a29b6cd4e544b1891a31328fe343868d656bb
|
4
|
+
data.tar.gz: c46cef3fbb2c601c45adbcd5052337ff80996034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318ea3b94e42aa292f5a31dd6a0dbac0e2b5d59bfedefdb600f9d3388a4a70e4038f84803aeab542bdd06f82c133ff7793e87f9464092d0666e2869c27271215
|
7
|
+
data.tar.gz: 0b698f6259872d236d42466447fedeac55936d80083cd2c7b78cdb7a69d8fa1a8c2fca228f703cfa6fe5e8f2fd8ec982c2100c748d8c2760c19b8874e6e7d6bf
|
data/README.md
CHANGED
@@ -453,7 +453,11 @@ development:
|
|
453
453
|
|
454
454
|
The value for `id` is your application's *Client ID*, and the value for `secret` is your application's *Client Secret* — both of these should appear on your application's GitHub page.
|
455
455
|
|
456
|
-
The `teams` key is optional, and required only if you want to
|
456
|
+
The `teams` key is optional, and required only if you want to restrict access to a set of GitHub teams.
|
457
|
+
|
458
|
+
If it's missing the Shipit installation will be public unless you setup another authentication method.
|
459
|
+
|
460
|
+
After you change the list of time you have to invoke `bin/rake teams:fetch` in production so that a webhook is setup to keep the list of members up to date.
|
457
461
|
|
458
462
|
For example:
|
459
463
|
|
data/lib/shipit/version.rb
CHANGED
data/lib/shipit.rb
CHANGED
@@ -111,8 +111,11 @@ module Shipit
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def github_teams
|
114
|
-
|
115
|
-
|
114
|
+
@github_teams ||= github_teams_handles.map { |t| Team.find_or_create_by_handle(t) }
|
115
|
+
end
|
116
|
+
|
117
|
+
def github_teams_handles
|
118
|
+
(Array(github_oauth_credentials['team']) + Array(github_oauth_credentials['teams'])).sort.uniq
|
116
119
|
end
|
117
120
|
|
118
121
|
def github_oauth_id
|
@@ -0,0 +1,30 @@
|
|
1
|
+
namespace :teams do
|
2
|
+
desc "Import the members of each team configured through the github_oauth.teams config and attempt to set a webhook to keep the list updated"
|
3
|
+
task fetch: :environment do
|
4
|
+
handles = Shipit.github_teams_handles
|
5
|
+
if handles.empty?
|
6
|
+
puts "github_oauth.teams is empty"
|
7
|
+
else
|
8
|
+
handles.each do |handle|
|
9
|
+
puts "Fetching @#{handle} members"
|
10
|
+
begin
|
11
|
+
team = Shipit::Team.find_or_create_by_handle(handle)
|
12
|
+
team.refresh_members!
|
13
|
+
rescue Octokit::Unauthorized, Octokit::NotFound => error
|
14
|
+
puts "Failed to fetch @#{handle} members. Do you have enough permissions?"
|
15
|
+
puts "#{error.class}: #{error.message}"
|
16
|
+
end
|
17
|
+
|
18
|
+
if team
|
19
|
+
puts "Ensuring webhook presence for #{team.organization}"
|
20
|
+
begin
|
21
|
+
team.setup_hooks(async: false)
|
22
|
+
rescue Octokit::Unauthorized, Octokit::NotFound => error
|
23
|
+
puts "Failed to install webhook on #{team.organization}. Do you have enough permissions?"
|
24
|
+
puts "#{error.class}: #{error.message}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shipit-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
@@ -582,7 +582,7 @@ files:
|
|
582
582
|
- lib/snippets/push-to-heroku
|
583
583
|
- lib/tasks/cron.rake
|
584
584
|
- lib/tasks/dev.rake
|
585
|
-
- lib/tasks/
|
585
|
+
- lib/tasks/teams.rake
|
586
586
|
- lib/tasks/webhook.rake
|
587
587
|
- test/controllers/api/base_controller_test.rb
|
588
588
|
- test/controllers/api/deploys_controller_test.rb
|
data/lib/tasks/team.rake
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
namespace :team do
|
2
|
-
desc "Import a team and it's members from Github and install a webhook to monitor it"
|
3
|
-
task fetch: :environment do
|
4
|
-
handle = ENV['HANDLE']
|
5
|
-
team = Shipit::Team.find_or_create_by_handle(handle)
|
6
|
-
fail "Could not find team with handle: #{handle}" unless team
|
7
|
-
team.setup_hooks(async: false)
|
8
|
-
team.refresh_members!
|
9
|
-
end
|
10
|
-
end
|