Skip to content

Commit d740ef0

Browse files
authored
Mtopo27/add tag to uploads (#73)
1 parent f421117 commit d740ef0

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/commands/upload/build.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Build < EmergeCLI::Commands::GlobalOptions
2323
option :base_sha, type: :string, required: false, desc: 'Base SHA'
2424
option :previous_sha, type: :string, required: false, desc: 'Previous SHA'
2525
option :pr_number, type: :string, required: false, desc: 'PR number'
26+
option :tag, type: :string, required: false, desc: 'Tag to associate with this build'
2627

2728
def initialize(network: nil, git_info_provider: nil)
2829
@network = network
@@ -102,7 +103,8 @@ def fetch_upload_url
102103
# Optional
103104
base_sha:,
104105
previous_sha:,
105-
pr_number: pr_number&.to_s
106+
pr_number: pr_number&.to_s,
107+
tag: @options[:tag]
106108
}.compact
107109

108110
upload_response = @network.post(

lib/commands/upload/snapshots/snapshots.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Snapshots < EmergeCLI::Commands::GlobalOptions
2727
option :base_sha, type: :string, required: false, desc: 'Base SHA'
2828
option :previous_sha, type: :string, required: false, desc: 'Previous SHA'
2929
option :pr_number, type: :string, required: false, desc: 'PR number'
30+
option :tag, type: :string, required: false, desc: 'Tag to associate with this snapshot run'
3031
option :concurrency, type: :integer, default: 5,
3132
desc: 'Number of concurrency for parallel image uploads when not using batch mode'
3233

@@ -178,7 +179,8 @@ def create_run
178179
# Optional
179180
base_sha:,
180181
previous_sha:,
181-
pr_number: pr_number&.to_s
182+
pr_number: pr_number&.to_s,
183+
tag: @options[:tag]
182184
}.compact
183185

184186
response = @network.post(path: '/v1/snapshots/run', body: payload)

test/commands/upload/snapshots/snapshots_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def test_overrides_git_info_with_options
7474
base_sha: 'custom-base-sha',
7575
previous_sha: 'custom-previous-sha',
7676
pr_number: 'custom-pr',
77+
tag: 'manual-run',
7778
concurrency: 1
7879
}
7980

@@ -85,6 +86,7 @@ def test_overrides_git_info_with_options
8586
assert_equal 'custom-base-sha', run_request[:body][:base_sha]
8687
assert_equal 'custom-previous-sha', run_request[:body][:previous_sha]
8788
assert_equal 'custom-pr', run_request[:body][:pr_number]
89+
assert_equal 'manual-run', run_request[:body][:tag]
8890
end
8991
end
9092
end

0 commit comments

Comments
 (0)