shipit-engine 0.25.0 → 0.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shipit/github_app.rb +36 -6
- data/lib/shipit/version.rb +1 -1
- metadata +122 -122
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fc984a73561067126bdfb062310f453acadeda6
|
4
|
+
data.tar.gz: 45bd1783e2aff0f6a17179181070372d9f69737c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a6acb0b4acab4a16a5b143c944f90e8dc628c4464a490ed1b316dce08a91e7d265b99482e3697cb677f420b1ef11d91c89e634c476e116b51760a9fc7fa0734
|
7
|
+
data.tar.gz: db7fcd010f4e2c1403c17b318e4dd241c3a40973842bc614d7141f3f6236dacae155753264c9ff6a43d6b344378c67615ee3775132423d86467850180ebb8309
|
data/lib/shipit/github_app.rb
CHANGED
@@ -1,11 +1,35 @@
|
|
1
1
|
module Shipit
|
2
2
|
class GitHubApp
|
3
|
+
include Mutex_m
|
4
|
+
|
5
|
+
class Token
|
6
|
+
class << self
|
7
|
+
def from_github(github_response)
|
8
|
+
new(github_response.token, github_response.expires_at)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
@token
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(token, expires_at)
|
17
|
+
@token = token
|
18
|
+
@expires_at = expires_at
|
19
|
+
end
|
20
|
+
|
21
|
+
def blank?
|
22
|
+
@expires_at.past?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
3
26
|
DOMAIN = 'github.com'.freeze
|
4
27
|
AuthenticationFailed = Class.new(StandardError)
|
5
28
|
|
6
29
|
attr_reader :oauth_teams, :domain, :bot_login
|
7
30
|
|
8
31
|
def initialize(config)
|
32
|
+
super()
|
9
33
|
@config = (config || {}).with_indifferent_access
|
10
34
|
@domain = @config[:domain] || DOMAIN
|
11
35
|
@webhook_secret = @config[:webhook_secret].presence
|
@@ -22,9 +46,9 @@ module Shipit
|
|
22
46
|
end
|
23
47
|
|
24
48
|
def api
|
25
|
-
client = Thread.current[:github_client]
|
26
|
-
if
|
27
|
-
client
|
49
|
+
client = (Thread.current[:github_client] ||= new_client(access_token: token))
|
50
|
+
if client.access_token != token
|
51
|
+
client.access_token = token
|
28
52
|
end
|
29
53
|
client
|
30
54
|
end
|
@@ -42,11 +66,17 @@ module Shipit
|
|
42
66
|
return 't0kEn' if Rails.env.test? # TODO: figure out something cleaner
|
43
67
|
return unless private_key && app_id && installation_id
|
44
68
|
|
45
|
-
|
46
|
-
|
69
|
+
@token = @token.presence || synchronize { @token.presence || fetch_new_token }
|
70
|
+
@token.to_s
|
71
|
+
end
|
72
|
+
|
73
|
+
def fetch_new_token
|
74
|
+
Rails.cache.fetch('github:integration:access-token', expires_in: 50.minutes, race_condition_ttl: 10.minutes) do
|
75
|
+
response = new_client(bearer_token: authentication_payload).create_app_installation_access_token(
|
47
76
|
installation_id,
|
48
77
|
accept: 'application/vnd.github.machine-man-preview+json',
|
49
|
-
)
|
78
|
+
)
|
79
|
+
token = Token.from_github(response)
|
50
80
|
raise AuthenticationFailed if token.blank?
|
51
81
|
token
|
52
82
|
end
|
data/lib/shipit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shipit-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.25.
|
4
|
+
version: 0.25.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -894,143 +894,143 @@ signing_key:
|
|
894
894
|
specification_version: 4
|
895
895
|
summary: Application deployment software
|
896
896
|
test_files:
|
897
|
-
- test/
|
898
|
-
- test/
|
899
|
-
- test/
|
900
|
-
- test/
|
901
|
-
- test/
|
902
|
-
- test/
|
903
|
-
- test/
|
904
|
-
- test/models/membership_test.rb
|
905
|
-
- test/models/rollbacks_test.rb
|
906
|
-
- test/models/output_chunk_test.rb
|
907
|
-
- test/models/pull_request_test.rb
|
908
|
-
- test/models/team_test.rb
|
909
|
-
- test/models/commit_deployment_status_test.rb
|
910
|
-
- test/models/deploy_spec_test.rb
|
911
|
-
- test/models/task_definitions_test.rb
|
912
|
-
- test/models/stacks_test.rb
|
913
|
-
- test/models/undeployed_commits_test.rb
|
914
|
-
- test/models/github_hook_test.rb
|
915
|
-
- test/models/status/group_test.rb
|
916
|
-
- test/models/status/missing_test.rb
|
917
|
-
- test/models/api_client_test.rb
|
918
|
-
- test/models/deploys_test.rb
|
919
|
-
- test/models/hook_test.rb
|
920
|
-
- test/models/commit_checks_test.rb
|
921
|
-
- test/models/status_test.rb
|
922
|
-
- test/models/users_test.rb
|
923
|
-
- test/models/commit_deployment_test.rb
|
924
|
-
- test/models/release_statuses_test.rb
|
925
|
-
- test/models/duration_test.rb
|
926
|
-
- test/models/tasks_test.rb
|
927
|
-
- test/models/delivery_test.rb
|
928
|
-
- test/models/commits_test.rb
|
929
|
-
- test/fixtures/payloads/push_not_master.json
|
930
|
-
- test/fixtures/payloads/status_master.json
|
931
|
-
- test/fixtures/payloads/push_master.json
|
932
|
-
- test/fixtures/timeout
|
933
|
-
- test/fixtures/shipit/users.yml
|
934
|
-
- test/fixtures/shipit/output_chunks.yml
|
935
|
-
- test/fixtures/shipit/teams.yml
|
936
|
-
- test/fixtures/shipit/github_hooks.yml
|
937
|
-
- test/fixtures/shipit/hooks.yml
|
938
|
-
- test/fixtures/shipit/commits.yml
|
939
|
-
- test/fixtures/shipit/commit_deployments.yml
|
940
|
-
- test/fixtures/shipit/statuses.yml
|
941
|
-
- test/fixtures/shipit/stacks.yml
|
942
|
-
- test/fixtures/shipit/pull_requests.yml
|
943
|
-
- test/fixtures/shipit/api_clients.yml
|
944
|
-
- test/fixtures/shipit/tasks.yml
|
945
|
-
- test/fixtures/shipit/release_statuses.yml
|
946
|
-
- test/fixtures/shipit/memberships.yml
|
947
|
-
- test/fixtures/shipit/commit_deployment_statuses.yml
|
948
|
-
- test/fixtures/shipit/deliveries.yml
|
949
|
-
- test/dummy/config/secrets.yml
|
950
|
-
- test/dummy/config/boot.rb
|
951
|
-
- test/dummy/config/database.postgresql.yml
|
952
|
-
- test/dummy/config/database.mysql.yml
|
953
|
-
- test/dummy/config/locales/en.yml
|
954
|
-
- test/dummy/config/environments/production.rb
|
955
|
-
- test/dummy/config/environments/test.rb
|
956
|
-
- test/dummy/config/environments/development.rb
|
957
|
-
- test/dummy/config/application.rb
|
958
|
-
- test/dummy/config/routes.rb
|
959
|
-
- test/dummy/config/initializers/0_load_development_secrets.rb
|
960
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
961
|
-
- test/dummy/config/initializers/session_store.rb
|
962
|
-
- test/dummy/config/initializers/inflections.rb
|
963
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
964
|
-
- test/dummy/config/initializers/assets.rb
|
965
|
-
- test/dummy/config/initializers/mime_types.rb
|
966
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
967
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
968
|
-
- test/dummy/config/environment.rb
|
969
|
-
- test/dummy/config/database.yml
|
970
|
-
- test/dummy/Rakefile
|
897
|
+
- test/dummy/public/favicon.ico
|
898
|
+
- test/dummy/public/500.html
|
899
|
+
- test/dummy/public/422.html
|
900
|
+
- test/dummy/public/404.html
|
901
|
+
- test/dummy/db/seeds.rb
|
902
|
+
- test/dummy/db/schema.rb
|
903
|
+
- test/dummy/bin/rake
|
971
904
|
- test/dummy/bin/bundle
|
972
905
|
- test/dummy/bin/rails
|
973
|
-
- test/dummy/bin/rake
|
974
906
|
- test/dummy/bin/setup
|
975
|
-
- test/dummy/
|
976
|
-
- test/dummy/public/favicon.ico
|
977
|
-
- test/dummy/public/404.html
|
978
|
-
- test/dummy/public/500.html
|
979
|
-
- test/dummy/app/helpers/application_helper.rb
|
907
|
+
- test/dummy/app/views/layouts/application.html.erb
|
980
908
|
- test/dummy/app/assets/stylesheets/application.css
|
981
909
|
- test/dummy/app/assets/javascripts/application.js
|
982
|
-
- test/dummy/app/views/layouts/application.html.erb
|
983
910
|
- test/dummy/app/controllers/application_controller.rb
|
984
|
-
- test/dummy/
|
985
|
-
- test/dummy/db/schema.rb
|
911
|
+
- test/dummy/app/helpers/application_helper.rb
|
986
912
|
- test/dummy/config.ru
|
987
|
-
- test/
|
913
|
+
- test/dummy/Rakefile
|
914
|
+
- test/dummy/config/application.rb
|
915
|
+
- test/dummy/config/database.yml
|
916
|
+
- test/dummy/config/locales/en.yml
|
917
|
+
- test/dummy/config/secrets.yml
|
918
|
+
- test/dummy/config/boot.rb
|
919
|
+
- test/dummy/config/database.mysql.yml
|
920
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
921
|
+
- test/dummy/config/initializers/session_store.rb
|
922
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
923
|
+
- test/dummy/config/initializers/mime_types.rb
|
924
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
925
|
+
- test/dummy/config/initializers/0_load_development_secrets.rb
|
926
|
+
- test/dummy/config/initializers/assets.rb
|
927
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
928
|
+
- test/dummy/config/initializers/inflections.rb
|
929
|
+
- test/dummy/config/environment.rb
|
930
|
+
- test/dummy/config/routes.rb
|
931
|
+
- test/dummy/config/database.postgresql.yml
|
932
|
+
- test/dummy/config/environments/test.rb
|
933
|
+
- test/dummy/config/environments/development.rb
|
934
|
+
- test/dummy/config/environments/production.rb
|
935
|
+
- test/controllers/webhooks_controller_test.rb
|
936
|
+
- test/controllers/rollbacks_controller_test.rb
|
937
|
+
- test/controllers/github_authentication_controller_test.rb
|
938
|
+
- test/controllers/merge_status_controller_test.rb
|
939
|
+
- test/controllers/commit_checks_controller_test.rb
|
940
|
+
- test/controllers/ccmenu_controller_test.rb
|
988
941
|
- test/controllers/stacks_controller_test.rb
|
989
|
-
- test/controllers/
|
990
|
-
- test/controllers/api/
|
991
|
-
- test/controllers/api/locks_controller_test.rb
|
992
|
-
- test/controllers/api/stacks_controller_test.rb
|
942
|
+
- test/controllers/deploys_controller_test.rb
|
943
|
+
- test/controllers/api/hooks_controller_test.rb
|
993
944
|
- test/controllers/api/ccmenu_controller_test.rb
|
945
|
+
- test/controllers/api/stacks_controller_test.rb
|
946
|
+
- test/controllers/api/base_controller_test.rb
|
947
|
+
- test/controllers/api/locks_controller_test.rb
|
948
|
+
- test/controllers/api/deploys_controller_test.rb
|
994
949
|
- test/controllers/api/commits_controller_test.rb
|
995
|
-
- test/controllers/api/outputs_controller_test.rb
|
996
|
-
- test/controllers/api/hooks_controller_test.rb
|
997
950
|
- test/controllers/api/pull_requests_controller_test.rb
|
998
951
|
- test/controllers/api/tasks_controller_test.rb
|
999
|
-
- test/controllers/api/
|
1000
|
-
- test/controllers/
|
1001
|
-
- test/controllers/release_statuses_controller_test.rb
|
1002
|
-
- test/controllers/webhooks_controller_test.rb
|
1003
|
-
- test/controllers/ccmenu_controller_test.rb
|
1004
|
-
- test/controllers/rollbacks_controller_test.rb
|
952
|
+
- test/controllers/api/outputs_controller_test.rb
|
953
|
+
- test/controllers/status_controller_test.rb
|
1005
954
|
- test/controllers/commits_controller_test.rb
|
1006
|
-
- test/controllers/
|
955
|
+
- test/controllers/release_statuses_controller_test.rb
|
1007
956
|
- test/controllers/pull_requests_controller_test.rb
|
1008
957
|
- test/controllers/tasks_controller_test.rb
|
1009
|
-
- test/controllers/merge_status_controller_test.rb
|
1010
|
-
- test/test_command_integration.rb
|
1011
|
-
- test/test_helper.rb
|
1012
|
-
- test/jobs/destroy_stack_job_test.rb
|
1013
|
-
- test/jobs/fetch_deployed_revision_job_test.rb
|
1014
|
-
- test/jobs/fetch_commit_stats_job_test.rb
|
1015
|
-
- test/jobs/merge_pull_requests_job_test.rb
|
1016
|
-
- test/jobs/cache_deploy_spec_job_test.rb
|
1017
|
-
- test/jobs/emit_event_job_test.rb
|
1018
|
-
- test/jobs/refresh_github_user_job_test.rb
|
1019
|
-
- test/jobs/chunk_rollup_job_test.rb
|
1020
|
-
- test/jobs/refresh_status_job_test.rb
|
1021
|
-
- test/jobs/purge_old_deliveries_job_test.rb
|
1022
|
-
- test/jobs/deliver_hook_job_test.rb
|
1023
|
-
- test/jobs/github_sync_job_test.rb
|
1024
|
-
- test/jobs/perform_task_job_test.rb
|
1025
|
-
- test/jobs/append_delayed_release_status_job_test.rb
|
1026
|
-
- test/jobs/unique_job_test.rb
|
1027
|
-
- test/unit/environment_variables_test.rb
|
1028
|
-
- test/unit/commands_test.rb
|
1029
|
-
- test/unit/github_app_test.rb
|
1030
|
-
- test/unit/rollback_commands_test.rb
|
1031
958
|
- test/unit/command_test.rb
|
959
|
+
- test/unit/commands_test.rb
|
960
|
+
- test/unit/deploy_commands_test.rb
|
1032
961
|
- test/unit/shipit_test.rb
|
962
|
+
- test/unit/rollback_commands_test.rb
|
1033
963
|
- test/unit/csv_serializer_test.rb
|
1034
|
-
- test/unit/deploy_commands_test.rb
|
1035
964
|
- test/unit/variable_definition_test.rb
|
1036
965
|
- test/unit/github_url_helper_test.rb
|
966
|
+
- test/unit/environment_variables_test.rb
|
967
|
+
- test/unit/github_app_test.rb
|
968
|
+
- test/models/release_statuses_test.rb
|
969
|
+
- test/models/deploys_test.rb
|
970
|
+
- test/models/undeployed_commits_test.rb
|
971
|
+
- test/models/team_test.rb
|
972
|
+
- test/models/rollbacks_test.rb
|
973
|
+
- test/models/commit_checks_test.rb
|
974
|
+
- test/models/github_hook_test.rb
|
975
|
+
- test/models/task_definitions_test.rb
|
976
|
+
- test/models/tasks_test.rb
|
977
|
+
- test/models/output_chunk_test.rb
|
978
|
+
- test/models/commit_deployment_status_test.rb
|
979
|
+
- test/models/delivery_test.rb
|
980
|
+
- test/models/users_test.rb
|
981
|
+
- test/models/commit_deployment_test.rb
|
982
|
+
- test/models/duration_test.rb
|
983
|
+
- test/models/api_client_test.rb
|
984
|
+
- test/models/commits_test.rb
|
985
|
+
- test/models/status/group_test.rb
|
986
|
+
- test/models/status/missing_test.rb
|
987
|
+
- test/models/deploy_spec_test.rb
|
988
|
+
- test/models/stacks_test.rb
|
989
|
+
- test/models/hook_test.rb
|
990
|
+
- test/models/membership_test.rb
|
991
|
+
- test/models/status_test.rb
|
992
|
+
- test/models/pull_request_test.rb
|
993
|
+
- test/test_command_integration.rb
|
994
|
+
- test/helpers/hooks_helper.rb
|
995
|
+
- test/helpers/queries_helper.rb
|
996
|
+
- test/helpers/json_helper.rb
|
997
|
+
- test/helpers/fixture_aliases_helper.rb
|
998
|
+
- test/helpers/payloads_helper.rb
|
999
|
+
- test/helpers/links_helper.rb
|
1000
|
+
- test/helpers/api_helper.rb
|
1001
|
+
- test/jobs/emit_event_job_test.rb
|
1002
|
+
- test/jobs/unique_job_test.rb
|
1003
|
+
- test/jobs/merge_pull_requests_job_test.rb
|
1004
|
+
- test/jobs/append_delayed_release_status_job_test.rb
|
1005
|
+
- test/jobs/deliver_hook_job_test.rb
|
1006
|
+
- test/jobs/refresh_status_job_test.rb
|
1007
|
+
- test/jobs/fetch_deployed_revision_job_test.rb
|
1008
|
+
- test/jobs/purge_old_deliveries_job_test.rb
|
1009
|
+
- test/jobs/refresh_github_user_job_test.rb
|
1010
|
+
- test/jobs/chunk_rollup_job_test.rb
|
1011
|
+
- test/jobs/fetch_commit_stats_job_test.rb
|
1012
|
+
- test/jobs/cache_deploy_spec_job_test.rb
|
1013
|
+
- test/jobs/perform_task_job_test.rb
|
1014
|
+
- test/jobs/github_sync_job_test.rb
|
1015
|
+
- test/jobs/destroy_stack_job_test.rb
|
1016
|
+
- test/fixtures/timeout
|
1017
|
+
- test/fixtures/shipit/release_statuses.yml
|
1018
|
+
- test/fixtures/shipit/users.yml
|
1019
|
+
- test/fixtures/shipit/output_chunks.yml
|
1020
|
+
- test/fixtures/shipit/deliveries.yml
|
1021
|
+
- test/fixtures/shipit/hooks.yml
|
1022
|
+
- test/fixtures/shipit/github_hooks.yml
|
1023
|
+
- test/fixtures/shipit/statuses.yml
|
1024
|
+
- test/fixtures/shipit/memberships.yml
|
1025
|
+
- test/fixtures/shipit/teams.yml
|
1026
|
+
- test/fixtures/shipit/tasks.yml
|
1027
|
+
- test/fixtures/shipit/api_clients.yml
|
1028
|
+
- test/fixtures/shipit/stacks.yml
|
1029
|
+
- test/fixtures/shipit/commits.yml
|
1030
|
+
- test/fixtures/shipit/pull_requests.yml
|
1031
|
+
- test/fixtures/shipit/commit_deployments.yml
|
1032
|
+
- test/fixtures/shipit/commit_deployment_statuses.yml
|
1033
|
+
- test/fixtures/payloads/status_master.json
|
1034
|
+
- test/fixtures/payloads/push_master.json
|
1035
|
+
- test/fixtures/payloads/push_not_master.json
|
1036
|
+
- test/test_helper.rb
|