ci_toolkit 1.5.13 → 1.5.16
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/Gemfile.lock +1 -1
- data/lib/ci_toolkit/dvcs_pr_factory.rb +1 -1
- data/lib/ci_toolkit/gitlab_bot.rb +30 -0
- data/lib/ci_toolkit/gitlab_pr.rb +4 -5
- data/lib/ci_toolkit/gitlab_release.rb +6 -5
- data/lib/ci_toolkit.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd3020f481c44b5a3aa5338f2642db5ad6616ed580be930532182e83ef4f434
|
4
|
+
data.tar.gz: 5bddb92459c6e5e9219e5fb2ddaf5d9c07a62674396b776d37e6b0e3769ceb85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d45f01faa0ecd50030c092e9bbe373bdbf78c22c74c7f95d2f54ddc9448839683598b0445654d491e48a469dd73712b4898fdc9771d7f3da4d38d97a9d88b298
|
7
|
+
data.tar.gz: 3b75f18b57b521e91f235e4efe280c9c5ca77cbe968b08984eca33d16eb3d21a098495f4eef688b2806d1999eec0abe603f57700ca6178687f88400486bd08cb
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/ci_toolkit/gitlab_pr.rb
CHANGED
@@ -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
|
-
|
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 =
|
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 =
|
125
|
+
@_client = @bot.client if @_client.nil?
|
127
126
|
@_client
|
128
127
|
end
|
129
128
|
end
|
@@ -7,31 +7,32 @@ module CiToolkit
|
|
7
7
|
class GitlabRelease
|
8
8
|
def initialize(
|
9
9
|
env = CiToolkit::BitriseEnv.new,
|
10
|
-
|
11
|
-
private_token: "glpat-YcYDycpz-PJe7QxLSA22")
|
10
|
+
bot = CiToolkit::GitlabBot.new
|
12
11
|
)
|
13
12
|
@repo_slug = env.repository_slug
|
14
|
-
@
|
15
|
-
@client = client
|
13
|
+
@client = bot.client
|
16
14
|
end
|
17
15
|
|
16
|
+
# rubocop:disable Metrics/ParameterLists
|
18
17
|
def create_release(
|
19
18
|
project_id:,
|
20
19
|
name:,
|
21
20
|
description:,
|
21
|
+
last_git_commit:,
|
22
22
|
tag_name:,
|
23
23
|
file_name:
|
24
24
|
)
|
25
25
|
release_details = {
|
26
26
|
name: name,
|
27
27
|
tag_name: tag_name,
|
28
|
-
ref:
|
28
|
+
ref: last_git_commit,
|
29
29
|
description: description,
|
30
30
|
assets: { links: [get_assets_details(project_id, tag_name, file_name)] }
|
31
31
|
}
|
32
32
|
|
33
33
|
@client.create_project_release(project_id, release_details)
|
34
34
|
end
|
35
|
+
# rubocop:enable Metrics/ParameterLists
|
35
36
|
|
36
37
|
# rubocop:disable Metrics/MethodLength
|
37
38
|
def upload_file(project_id:, tag_name:, full_path_to_file:)
|
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.
|
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-
|
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
|