gitlab-cloud-connector 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -3
  3. data/CONTRIBUTING.md +50 -0
  4. data/LICENSE +28 -0
  5. data/Makefile +33 -0
  6. data/README.md +11 -221
  7. data/Rakefile +1 -5
  8. data/config/add_ons/duo_enterprise.yml +2 -0
  9. data/config/add_ons/duo_pro.yml +2 -0
  10. data/config/backend_services/ai_gateway.yml +5 -0
  11. data/config/backend_services/duo_workflow_service.yml +5 -0
  12. data/config/backend_services/observability.yml +5 -0
  13. data/config/backend_services/security_gateway.yml +5 -0
  14. data/config/license_types/premium.yml +2 -0
  15. data/config/license_types/ultimate.yml +2 -0
  16. data/config/schemas/add_on_schema.json +15 -0
  17. data/config/schemas/backend_service_schema.json +26 -0
  18. data/config/schemas/license_type_schema.json +15 -0
  19. data/config/schemas/unit_primitive_schema.json +97 -0
  20. data/config/unit_primitives/ask_build.yml +15 -0
  21. data/config/unit_primitives/ask_commit.yml +15 -0
  22. data/config/unit_primitives/ask_epic.yml +15 -0
  23. data/config/unit_primitives/ask_issue.yml +15 -0
  24. data/config/unit_primitives/code_suggestions.yml +19 -0
  25. data/config/unit_primitives/complete_code.yml +19 -0
  26. data/config/unit_primitives/documentation_search.yml +19 -0
  27. data/config/unit_primitives/duo_chat.yml +19 -0
  28. data/config/unit_primitives/duo_workflow_execute_workflow.yml +13 -0
  29. data/config/unit_primitives/explain_code.yml +17 -0
  30. data/config/unit_primitives/explain_vulnerability.yml +17 -0
  31. data/config/unit_primitives/fix_code.yml +17 -0
  32. data/config/unit_primitives/generate_code.yml +19 -0
  33. data/config/unit_primitives/generate_commit_message.yml +17 -0
  34. data/config/unit_primitives/generate_issue_description.yml +15 -0
  35. data/config/unit_primitives/glab_ask_git_command.yml +17 -0
  36. data/config/unit_primitives/include_dependency_context.yml +15 -0
  37. data/config/unit_primitives/include_file_context.yml +17 -0
  38. data/config/unit_primitives/include_issue_context.yml +15 -0
  39. data/config/unit_primitives/include_merge_request_context.yml +15 -0
  40. data/config/unit_primitives/include_snippet_context.yml +17 -0
  41. data/config/unit_primitives/observability_all.yml +14 -0
  42. data/config/unit_primitives/refactor_code.yml +17 -0
  43. data/config/unit_primitives/resolve_vulnerability.yml +17 -0
  44. data/config/unit_primitives/security_scans.yml +13 -0
  45. data/config/unit_primitives/summarize_comments.yml +17 -0
  46. data/config/unit_primitives/summarize_review.yml +15 -0
  47. data/config/unit_primitives/troubleshoot_job.yml +17 -0
  48. data/config/unit_primitives/write_tests.yml +17 -0
  49. data/lib/cloud_connector.rb +10 -0
  50. data/lib/gitlab/cloud_connector/json_web_token.rb +59 -0
  51. data/lib/gitlab/cloud_connector/{backend_service.rb → version.rb} +1 -3
  52. metadata +85 -48
  53. data/.idea/.gitignore +0 -8
  54. data/.idea/gitlab-cloud-connector.iml +0 -127
  55. data/.idea/inspectionProfiles/Project_Default.xml +0 -9
  56. data/.idea/misc.xml +0 -4
  57. data/.idea/modules.xml +0 -8
  58. data/.idea/vcs.xml +0 -7
  59. data/CHANGELOG.md +0 -5
  60. data/Dangerfile +0 -5
  61. data/config/cloud_connector/backend_services/ai_gateway/unit_primitives/code_suggestions.yml +0 -19
  62. data/config/cloud_connector/backend_services/ai_gateway/unit_primitives/documentation_search.yml +0 -19
  63. data/config/cloud_connector/backend_services/ai_gateway/unit_primitives/duo_chat.yml +0 -19
  64. data/lib/gitlab/cloud_connector/auth/json_web_token.rb +0 -82
  65. data/lib/gitlab/cloud_connector/base_group.rb +0 -39
  66. data/lib/gitlab/cloud_connector/configuration.rb +0 -24
  67. data/lib/gitlab/cloud_connector/deliverable.rb +0 -31
  68. data/lib/gitlab/cloud_connector/delivered_by.rb +0 -10
  69. data/lib/gitlab/cloud_connector/purchasable_decorator.rb +0 -59
  70. data/lib/gitlab/cloud_connector/token_issuer.rb +0 -44
  71. data/lib/gitlab/cloud_connector/unit_primitives.rb +0 -195
  72. data/lib/gitlab/cloud_connector.rb +0 -68
  73. data/lib/gitlab/popen.rb +0 -68
  74. data/lib/utils/parse_helper.rb +0 -15
  75. data/lib/utils/strong_memoize.rb +0 -145
  76. data/sig/gitlab/cloud_connector.rbs +0 -0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-cloud-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojevic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-27 00:00:00.000000000 Z
11
+ date: 2024-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,100 +16,137 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.8
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.8
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: gitlab-dangerfiles
28
+ name: jwt
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.8.0
33
+ version: 2.9.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.9.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: gitlab-styles
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 12.0.1
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 4.8.0
54
+ version: 12.0.1
41
55
  - !ruby/object:Gem::Dependency
42
- name: rubocop-rails
56
+ name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "<"
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 2.21.2
61
+ version: 13.0.6
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "<"
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 2.21.2
68
+ version: 13.0.6
55
69
  - !ruby/object:Gem::Dependency
56
- name: gitlab-styles
70
+ name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 12.0.1
75
+ version: '3.8'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 12.0.1
69
- description: 'This gem provides common CloudConnector configuration and libraries
70
- for GitLab projects.} '
82
+ version: '3.8'
83
+ description: This gem provides common CloudConnector configuration and libraries for
84
+ GitLab projects.
71
85
  email:
72
86
  - nmilojevic@gitlab.com
73
87
  executables: []
74
88
  extensions: []
75
89
  extra_rdoc_files: []
76
90
  files:
77
- - ".idea/.gitignore"
78
- - ".idea/gitlab-cloud-connector.iml"
79
- - ".idea/inspectionProfiles/Project_Default.xml"
80
- - ".idea/misc.xml"
81
- - ".idea/modules.xml"
82
- - ".idea/vcs.xml"
83
91
  - ".rspec"
84
92
  - ".rubocop.yml"
85
- - CHANGELOG.md
86
- - Dangerfile
93
+ - CONTRIBUTING.md
94
+ - LICENSE
95
+ - Makefile
87
96
  - README.md
88
97
  - Rakefile
89
- - config/cloud_connector/backend_services/ai_gateway/unit_primitives/code_suggestions.yml
90
- - config/cloud_connector/backend_services/ai_gateway/unit_primitives/documentation_search.yml
91
- - config/cloud_connector/backend_services/ai_gateway/unit_primitives/duo_chat.yml
92
- - lib/gitlab/cloud_connector.rb
93
- - lib/gitlab/cloud_connector/auth/json_web_token.rb
94
- - lib/gitlab/cloud_connector/backend_service.rb
95
- - lib/gitlab/cloud_connector/base_group.rb
96
- - lib/gitlab/cloud_connector/configuration.rb
97
- - lib/gitlab/cloud_connector/deliverable.rb
98
- - lib/gitlab/cloud_connector/delivered_by.rb
99
- - lib/gitlab/cloud_connector/purchasable_decorator.rb
100
- - lib/gitlab/cloud_connector/token_issuer.rb
101
- - lib/gitlab/cloud_connector/unit_primitives.rb
102
- - lib/gitlab/popen.rb
103
- - lib/utils/parse_helper.rb
104
- - lib/utils/strong_memoize.rb
105
- - sig/gitlab/cloud_connector.rbs
106
- homepage: https://gitlab.com.
107
- licenses: []
98
+ - config/add_ons/duo_enterprise.yml
99
+ - config/add_ons/duo_pro.yml
100
+ - config/backend_services/ai_gateway.yml
101
+ - config/backend_services/duo_workflow_service.yml
102
+ - config/backend_services/observability.yml
103
+ - config/backend_services/security_gateway.yml
104
+ - config/license_types/premium.yml
105
+ - config/license_types/ultimate.yml
106
+ - config/schemas/add_on_schema.json
107
+ - config/schemas/backend_service_schema.json
108
+ - config/schemas/license_type_schema.json
109
+ - config/schemas/unit_primitive_schema.json
110
+ - config/unit_primitives/ask_build.yml
111
+ - config/unit_primitives/ask_commit.yml
112
+ - config/unit_primitives/ask_epic.yml
113
+ - config/unit_primitives/ask_issue.yml
114
+ - config/unit_primitives/code_suggestions.yml
115
+ - config/unit_primitives/complete_code.yml
116
+ - config/unit_primitives/documentation_search.yml
117
+ - config/unit_primitives/duo_chat.yml
118
+ - config/unit_primitives/duo_workflow_execute_workflow.yml
119
+ - config/unit_primitives/explain_code.yml
120
+ - config/unit_primitives/explain_vulnerability.yml
121
+ - config/unit_primitives/fix_code.yml
122
+ - config/unit_primitives/generate_code.yml
123
+ - config/unit_primitives/generate_commit_message.yml
124
+ - config/unit_primitives/generate_issue_description.yml
125
+ - config/unit_primitives/glab_ask_git_command.yml
126
+ - config/unit_primitives/include_dependency_context.yml
127
+ - config/unit_primitives/include_file_context.yml
128
+ - config/unit_primitives/include_issue_context.yml
129
+ - config/unit_primitives/include_merge_request_context.yml
130
+ - config/unit_primitives/include_snippet_context.yml
131
+ - config/unit_primitives/observability_all.yml
132
+ - config/unit_primitives/refactor_code.yml
133
+ - config/unit_primitives/resolve_vulnerability.yml
134
+ - config/unit_primitives/security_scans.yml
135
+ - config/unit_primitives/summarize_comments.yml
136
+ - config/unit_primitives/summarize_review.yml
137
+ - config/unit_primitives/troubleshoot_job.yml
138
+ - config/unit_primitives/write_tests.yml
139
+ - lib/cloud_connector.rb
140
+ - lib/gitlab/cloud_connector/json_web_token.rb
141
+ - lib/gitlab/cloud_connector/version.rb
142
+ homepage: https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector
143
+ licenses:
144
+ - MIT
108
145
  metadata:
109
146
  allowed_push_host: https://rubygems.org
110
- homepage_uri: https://gitlab.com.
111
- source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-cloud-connector.
112
- changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-cloud-connector/-/releases
147
+ homepage_uri: https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector
148
+ source_code_uri: https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector
149
+ changelog_uri: https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector/-/releases
113
150
  post_install_message:
114
151
  rdoc_options: []
115
152
  require_paths:
@@ -128,5 +165,5 @@ requirements: []
128
165
  rubygems_version: 3.4.19
129
166
  signing_key:
130
167
  specification_version: 4
131
- summary: GitLab cloud connector project..
168
+ summary: GitLab cloud connector project.
132
169
  test_files: []
data/.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Default ignored files
2
- /shelf/
3
- /workspace.xml
4
- # Editor-based HTTP Client requests
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
@@ -1,127 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="FacetManager">
4
- <facet type="RailsFacetType" name="Ruby on Rails">
5
- <configuration>
6
- <RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
7
- <RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
8
- <RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
9
- </configuration>
10
- </facet>
11
- </component>
12
- <component name="ModuleRunConfigurationManager">
13
- <shared />
14
- </component>
15
- <component name="NewModuleRootManager">
16
- <content url="file://$MODULE_DIR$">
17
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
18
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
19
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
20
- <excludeFolder url="file://$MODULE_DIR$/.bundle" />
21
- <excludeFolder url="file://$MODULE_DIR$/public/packs" />
22
- <excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
23
- <excludeFolder url="file://$MODULE_DIR$/vendor/cache" />
24
- <excludeFolder url="file://$MODULE_DIR$/log" />
25
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
26
- <excludeFolder url="file://$MODULE_DIR$/public/system" />
27
- <excludeFolder url="file://$MODULE_DIR$/components" />
28
- </content>
29
- <orderEntry type="inheritedJdk" />
30
- <orderEntry type="sourceFolder" forTests="false" />
31
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, asdf: 3.2.1) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, asdf: 3.2.1) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="mail (v2.8.1, asdf: 3.2.1) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, asdf: 3.2.1) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="rack-test (v2.1.0, asdf: 3.2.1) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.6.0, asdf: 3.2.1) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, asdf: 3.2.1) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="rubocop-rails (v2.18.0, asdf: 3.2.1) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, asdf: 3.2.1) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, asdf: 3.2.1) [gem]" level="application" />
41
- </component>
42
- <component name="RModuleSettingsStorage">
43
- <LOAD_PATH number="0" />
44
- <I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
45
- </component>
46
- <component name="RailsGeneratorsCache">
47
- <option name="generators">
48
- <list>
49
- <option value="active_record:migration" />
50
- <option value="active_record:model" />
51
- <option value="active_record:observer" />
52
- <option value="active_record:session_migration" />
53
- <option value="controller" />
54
- <option value="erb:controller" />
55
- <option value="erb:mailer" />
56
- <option value="erb:scaffold" />
57
- <option value="generator" />
58
- <option value="helper" />
59
- <option value="integration_test" />
60
- <option value="mailer" />
61
- <option value="metal" />
62
- <option value="migration" />
63
- <option value="model" />
64
- <option value="model_subclass" />
65
- <option value="observer" />
66
- <option value="performance_test" />
67
- <option value="plugin" />
68
- <option value="resource" />
69
- <option value="scaffold" />
70
- <option value="scaffold_controller" />
71
- <option value="session_migration" />
72
- <option value="stylesheets" />
73
- <option value="test_unit:controller" />
74
- <option value="test_unit:helper" />
75
- <option value="test_unit:integration" />
76
- <option value="test_unit:mailer" />
77
- <option value="test_unit:model" />
78
- <option value="test_unit:observer" />
79
- <option value="test_unit:performance" />
80
- <option value="test_unit:plugin" />
81
- <option value="test_unit:scaffold" />
82
- </list>
83
- </option>
84
- <option name="myGenerators">
85
- <list>
86
- <option value="active_record:migration" />
87
- <option value="active_record:model" />
88
- <option value="active_record:observer" />
89
- <option value="active_record:session_migration" />
90
- <option value="controller" />
91
- <option value="erb:controller" />
92
- <option value="erb:mailer" />
93
- <option value="erb:scaffold" />
94
- <option value="generator" />
95
- <option value="helper" />
96
- <option value="integration_test" />
97
- <option value="mailer" />
98
- <option value="metal" />
99
- <option value="migration" />
100
- <option value="model" />
101
- <option value="model_subclass" />
102
- <option value="observer" />
103
- <option value="performance_test" />
104
- <option value="plugin" />
105
- <option value="resource" />
106
- <option value="scaffold" />
107
- <option value="scaffold_controller" />
108
- <option value="session_migration" />
109
- <option value="stylesheets" />
110
- <option value="test_unit:controller" />
111
- <option value="test_unit:helper" />
112
- <option value="test_unit:integration" />
113
- <option value="test_unit:mailer" />
114
- <option value="test_unit:model" />
115
- <option value="test_unit:observer" />
116
- <option value="test_unit:performance" />
117
- <option value="test_unit:plugin" />
118
- <option value="test_unit:scaffold" />
119
- </list>
120
- </option>
121
- </component>
122
- <component name="RakeTasksCache">
123
- <option name="myRootTask">
124
- <RakeTaskImpl id="rake" />
125
- </option>
126
- </component>
127
- </module>
@@ -1,9 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Rubocop" enabled="true" level="WARNING" enabled_by_default="true">
5
- <option name="myUseStandardGemIfPossible" value="true" />
6
- <option name="myRunRubocopOnSave" value="true" />
7
- </inspection_tool>
8
- </profile>
9
- </component>
data/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="asdf: 3.2.1" project-jdk-type="RUBY_SDK" />
4
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/gitlab-cloud-connector.iml" filepath="$PROJECT_DIR$/.idea/gitlab-cloud-connector.iml" />
6
- </modules>
7
- </component>
8
- </project>
data/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- <mapping directory="$PROJECT_DIR$/gitlab-cloud-connector" vcs="Git" />
6
- </component>
7
- </project>
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2024-06-11
4
-
5
- - Initial release
data/Dangerfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'gitlab-dangerfiles'
4
-
5
- Gitlab::Dangerfiles.for_project(self, 'gitlab-cloud-connector', &:import_defaults)
@@ -1,19 +0,0 @@
1
- ---
2
- name: code_suggestions
3
- description:
4
- backend: 'gitlab-ai-gateway'
5
- cut_off_date: 2024-02-15 00:00:00 UTC
6
- min_gitlab_version_for_free_access:
7
- min_gitlab_version: '16.8'
8
- min_backend_version:
9
- delivered_by:
10
- - code_suggestions
11
- bundled_with:
12
- - duo_pro
13
- - duo_enterprise
14
- introduced_by_url:
15
- group: group::code suggestions
16
- feature_category: code_suggestions
17
- gitlab_realms:
18
- - saas
19
- - self-managed
@@ -1,19 +0,0 @@
1
- ---
2
- name: documentation_search
3
- description:
4
- backend: 'gitlab-ai-gateway'
5
- cut_off_date:
6
- min_gitlab_version_for_free_access: '16.8'
7
- min_gitlab_version: '16.9'
8
- min_backend_version:
9
- delivered_by:
10
- - duo_chat
11
- bundled_with:
12
- - duo_pro
13
- - duo_enterprise
14
- introduced_by_url:
15
- group: group::duo_chat
16
- feature_category: duo_chat
17
- gitlab_realms:
18
- - saas
19
- - self-managed
@@ -1,19 +0,0 @@
1
- ---
2
- name: duo_chat
3
- description:
4
- backend: 'gitlab-ai-gateway'
5
- cut_off_date:
6
- min_gitlab_version_for_free_access: '16.8'
7
- min_gitlab_version: '16.9'
8
- min_backend_version:
9
- delivered_by:
10
- - duo_chat
11
- bundled_with:
12
- - duo_pro
13
- - duo_enterprise
14
- introduced_by_url:
15
- group: group::duo_chat
16
- feature_category: duo_chat
17
- gitlab_realms:
18
- - saas
19
- - self-managed
@@ -1,82 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_support"
4
- require "active_support/all"
5
-
6
- module Gitlab
7
- module CloudConnector
8
- module Auth
9
- class JsonWebToken
10
- NOT_BEFORE_TIME = 5.seconds.to_i.freeze
11
- DEFAULT_EXPIRES_IN = 3.days.to_i.freeze
12
- NoSigningKeyError = Class.new(StandardError)
13
-
14
- attr_reader :expires_at, :scopes
15
-
16
- def initialize(audience:, subject:, scopes:, expires_at: nil, extra_claims: nil, gitlab_realm: nil)
17
- @id = SecureRandom.uuid
18
- @audience = audience
19
- @subject = subject
20
- @scopes = Array.wrap(scopes)
21
- @issuer = issuer
22
- @issued_at = Time.current.to_i
23
- @not_before = @issued_at - NOT_BEFORE_TIME
24
- @expires_at = expires_at || (@issued_at + expires_in)
25
- @extra_claims = extra_claims
26
- @gitlab_realm = gitlab_realm || ::Gitlab::CloudConnector.gitlab_realm
27
- end
28
-
29
- def encode
30
- headers = { typ: 'JWT' }
31
-
32
- JWT.encode(payload, key, 'RS256', headers)
33
- end
34
-
35
- def payload
36
- reserved_claims = {
37
- jti: @id,
38
- aud: @audience,
39
- sub: @subject,
40
- iss: @issuer,
41
- iat: @issued_at,
42
- nbf: @not_before,
43
- exp: @expires_at
44
- }
45
-
46
- custom_claims = {
47
- gitlab_realm: @gitlab_realm,
48
- scopes: @scopes,
49
- extra_claims: @extra_claims
50
- }
51
-
52
- reserved_claims.merge(custom_claims)
53
- end
54
-
55
- private
56
-
57
- def expires_in
58
- ::Gitlab::CloudConnector.token_expires_in || DEFAULT_EXPIRES_IN
59
- end
60
-
61
- def issuer
62
- issuer = Gitlab::CloudConnector.token_issuer
63
-
64
- if issuer.is_a?(Proc)
65
- p "lambda?"
66
- issuer.call
67
- else
68
- issuer
69
- end
70
- end
71
-
72
- def key
73
- key_data = Settings.value(:jwt_signing_key)
74
-
75
- raise NoSigningKeyError unless key_data
76
-
77
- OpenSSL::PKey::RSA.new(key_data)
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'token_issuer'
4
-
5
- module Gitlab
6
- module CloudConnector
7
- class BaseGroup
8
- include TokenIssuer
9
-
10
- attr_reader :name, :unit_primitives
11
-
12
- def initialize(name, unit_primitives)
13
- @name = name
14
- @unit_primitives = unit_primitives
15
- end
16
-
17
- def cut_off_date
18
- unit_primitives.values.map(&:cut_off_date).compact.max
19
- end
20
-
21
- def bundled_with
22
- unit_primitives.values.flat_map(&:bundled_with).uniq
23
- end
24
- alias :add_ons :bundled_with
25
-
26
- def feature_categories
27
- unit_primitives.values.map(&:feature_category).uniq
28
- end
29
-
30
- def min_gitlab_version
31
- unit_primitives.values.flat_map(&:min_gitlab_version).compact.min
32
- end
33
-
34
- def min_gitlab_version_for_free_access
35
- unit_primitives.values.flat_map(&:min_gitlab_version_for_free_access).compact.min
36
- end
37
- end
38
- end
39
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'unit_primitives'
4
- require_relative 'purchasable_decorator'
5
-
6
- module Gitlab
7
- module CloudConnector
8
- class Configuration
9
- attr_reader :purchasable_decorator_class
10
- attr_accessor :token_issuer, :token_subject, :gitlab_version, :token_expires_in, :gitlab_realm
11
-
12
- def purchasable_decorator_class=(purchasable_decorator_class)
13
- raise ArgumentError, 'Must be a class inheriting from Gitlab::CloudConnector::PurchasableDecorator' unless
14
- purchasable_decorator_class < Gitlab::CloudConnector::PurchasableDecorator
15
-
16
- @purchasable_decorator_class = purchasable_decorator_class
17
- end
18
-
19
- def purchasable_decorator_class
20
- @purchasable_decorator_class ||= Gitlab::CloudConnector::PurchasableDecorator
21
- end
22
- end
23
- end
24
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gitlab
4
- module CloudConnector
5
- module Deliverable
6
- def delivered_by
7
- # TODO add memoization
8
- result = Hash.new{ |h, k| h[k] = [] }
9
-
10
- unit_primitives.values.each do |unit_primitive|
11
- unit_primitive.delivered_by.each do |delivered_by|
12
- result[delivered_by.to_sym] << unit_primitive
13
- end
14
- end
15
-
16
- result.each do |delivered_by, unit_primitives|
17
- result[delivered_by] = build_delivered_by(delivered_by, unit_primitives.index_by(&:key))
18
- end
19
-
20
- result
21
- end
22
-
23
- private
24
-
25
- def build_delivered_by(name, unit_primitives)
26
- delivered_by = Gitlab::CloudConnector::DeliveredBy.new(name, unit_primitives)
27
- Gitlab::CloudConnector.configuration.purchasable_decorator_class.new(delivered_by)
28
- end
29
- end
30
- end
31
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_group'
4
-
5
- module Gitlab
6
- module CloudConnector
7
- class DeliveredBy < BaseGroup
8
- end
9
- end
10
- end