ci_toolkit 1.5.15 → 1.5.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b205a6ae043c71085c00fe53185484846926f8f19c195bd918c35620ea4bab01
4
- data.tar.gz: 2ec954b41981edcbc41a7de4f09a2035faac8a37fd9fe80ebcd781ffd38513e1
3
+ metadata.gz: 8bd3020f481c44b5a3aa5338f2642db5ad6616ed580be930532182e83ef4f434
4
+ data.tar.gz: 5bddb92459c6e5e9219e5fb2ddaf5d9c07a62674396b776d37e6b0e3769ceb85
5
5
  SHA512:
6
- metadata.gz: 455eacb27c857c78857c7e2db16136061646a3a9b208bdbd6426aaaeef222717f27b090ee498c9d2e16f174affa48242a1ad38a2659c6a468908787cabd96c9d
7
- data.tar.gz: 9d7d413d5d92a0a46310db90ba79ddbb6354c42604e73a1100b2858a3b018d99f60a1d81a5895eca1e30e466a44117c3a877ab251a3d070370444ac58781085e
6
+ metadata.gz: d45f01faa0ecd50030c092e9bbe373bdbf78c22c74c7f95d2f54ddc9448839683598b0445654d491e48a469dd73712b4898fdc9771d7f3da4d38d97a9d88b298
7
+ data.tar.gz: 3b75f18b57b521e91f235e4efe280c9c5ca77cbe968b08984eca33d16eb3d21a098495f4eef688b2806d1999eec0abe603f57700ca6178687f88400486bd08cb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.5.15)
4
+ ci_toolkit (1.5.16)
5
5
  faraday
6
6
  faraday_middleware
7
7
  gitlab
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CiToolkit
4
4
  # Use this to create an instance of Dvcs implementation based on the service type
5
- # set in an environment value called DVCS_SERVICW with value of gitlab or github
5
+ # set in an environment value called DVCS_SERVICW with value of either gitlab or github
6
6
  class DvcsPrFactory
7
7
  SERVICES = {
8
8
  "gitlab" => CiToolkit::GitlabPr,
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "gitlab"
4
+
5
+ module CiToolkit
6
+ # Utility class that provides an instance of a Gitlab Client
7
+ class GitlabBot
8
+ attr_reader :client
9
+
10
+ # Provides an endpoint and a private access token that can be used with the Gitlab client
11
+ class Credentials
12
+ attr_reader :endpoint, :project_access_token
13
+
14
+ def initialize(
15
+ endpoint = ENV["GITLAB_API_URL"],
16
+ project_access_token = ENV["GITLAB_PROJECT_ACCESS_TOKEN"]
17
+ )
18
+ @endpoint = endpoint
19
+ @project_access_token = project_access_token
20
+ end
21
+ end
22
+
23
+ def initialize(
24
+ credentials = CiToolkit::GitlabBot::Credentials.new,
25
+ client = Gitlab.client(endpoint: credentials.endpoint, private_token: credentials.project_access_token)
26
+ )
27
+ @client = client
28
+ end
29
+ end
30
+ end
@@ -10,16 +10,15 @@ module CiToolkit
10
10
  build_types = ENV["BUILD_TYPES"]&.split(/,/) || ["BluetoothDemo", "Acceptance PreProd", "Acceptance Prod",
11
11
  "Latest Prod", "Latest PreProd", "Mock", "Design System"],
12
12
 
13
- client = Gitlab.client(endpoint: ENV["GITLAB_API_URL"] || "",
14
- private_token: ENV["GITLAB_USER_PRIVATE_TOKEN"] || "")
13
+ bot = CiToolkit::GitlabBot.new
15
14
  )
16
15
  super()
17
16
  @pr_number = env.pull_request_number
18
17
  @repo_slug = env.repository_path
19
18
  @commit_sha = env.git_commit
20
- @_client = client
19
+ @_client = bot.client
21
20
  @build_types = build_types
22
- @bot = CiToolkit::GithubBot.new
21
+ @bot = bot
23
22
  end
24
23
 
25
24
  def title
@@ -123,7 +122,7 @@ module CiToolkit
123
122
  private
124
123
 
125
124
  def client
126
- @_client = GitLab::Client.new if @_client.nil?
125
+ @_client = @bot.client if @_client.nil?
127
126
  @_client
128
127
  end
129
128
  end
@@ -7,11 +7,10 @@ module CiToolkit
7
7
  class GitlabRelease
8
8
  def initialize(
9
9
  env = CiToolkit::BitriseEnv.new,
10
- client = Gitlab.client(endpoint: ENV["GITLAB_API_URL"] || "",
11
- private_token: ENV["GITLAB_USER_PRIVATE_TOKEN"] || "")
10
+ bot = CiToolkit::GitlabBot.new
12
11
  )
13
12
  @repo_slug = env.repository_slug
14
- @client = client
13
+ @client = bot.client
15
14
  end
16
15
 
17
16
  # rubocop:disable Metrics/ParameterLists
data/lib/ci_toolkit.rb CHANGED
@@ -7,6 +7,7 @@ require "ci_toolkit/duplicate_files_finder"
7
7
  require "ci_toolkit/dvcs_pr"
8
8
  require "ci_toolkit/github_bot"
9
9
  require "ci_toolkit/github_pr"
10
+ require "ci_toolkit/gitlab_bot"
10
11
  require "ci_toolkit/gitlab_pr"
11
12
  require "ci_toolkit/gitlab_release"
12
13
  require "ci_toolkit/dvcs_pr_factory"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.15
4
+ version: 1.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-08 00:00:00.000000000 Z
11
+ date: 2022-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -227,6 +227,7 @@ files:
227
227
  - lib/ci_toolkit/git.rb
228
228
  - lib/ci_toolkit/github_bot.rb
229
229
  - lib/ci_toolkit/github_pr.rb
230
+ - lib/ci_toolkit/gitlab_bot.rb
230
231
  - lib/ci_toolkit/gitlab_pr.rb
231
232
  - lib/ci_toolkit/gitlab_release.rb
232
233
  - lib/ci_toolkit/jira.rb