Skip to content

Commit ff92ddf

Browse files
agent: Fix wrong content-type flag name. (#2131)
Co-authored-by: Yun Peng <[email protected]>
1 parent 81735bd commit ff92ddf

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

agent/src/artifact/upload.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,9 @@ impl Uploader {
419419
) -> Result<()> {
420420
let artifact = artifact.display().to_string();
421421
let mut args = vec!["artifact", "upload"];
422-
let ct_arg = content_type
423-
.map(|ct| "--content_type=".to_owned() + ct)
424-
.unwrap_or_default();
425-
if !ct_arg.is_empty() {
426-
args.push(ct_arg.as_str());
422+
if let Some(content_type) = content_type {
423+
args.push("--content-type");
424+
args.push(content_type);
427425
}
428426
args.push(artifact.as_str());
429427
execute_command(dry, cwd, "buildkite-agent", &args)

agent/tests/artifact/upload.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn test_logs_uploaded_to_buildkite() -> Result<()> {
1919
]);
2020
cmd.assert()
2121
.success()
22-
.stdout(predicates::ord::eq("buildkite-agent artifact upload --content_type=text/plain;encoding=utf-8 src\\test\\shell\\bazel\\resource_compiler_toolchain_test\\test.log\n"));
22+
.stdout(predicates::ord::eq("buildkite-agent artifact upload --content-type text/plain;encoding=utf-8 src\\test\\shell\\bazel\\resource_compiler_toolchain_test\\test.log\n"));
2323

2424
Ok(())
2525
}
@@ -37,7 +37,7 @@ fn test_logs_uploaded_to_buildkite() -> Result<()> {
3737
]);
3838
cmd.assert()
3939
.success()
40-
.stdout(predicates::ord::eq("buildkite-agent artifact upload --content_type=text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log\n"));
40+
.stdout(predicates::ord::eq("buildkite-agent artifact upload --content-type text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log\n"));
4141

4242
Ok(())
4343
}
@@ -139,7 +139,7 @@ fn test_logs_deduplicated() -> Result<()> {
139139
]);
140140
cmd.assert()
141141
.success()
142-
.stdout(predicates::str::contains("buildkite-agent artifact upload --content_type=text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log").count(1));
142+
.stdout(predicates::str::contains("buildkite-agent artifact upload --content-type text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log").count(1));
143143

144144
Ok(())
145145
}
@@ -178,7 +178,7 @@ fn test_running_json_file() -> Result<()> {
178178

179179
cmd.assert()
180180
.success()
181-
.stdout(predicates::str::contains("buildkite-agent artifact upload --content_type=text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log"));
181+
.stdout(predicates::str::contains("buildkite-agent artifact upload --content-type text/plain;encoding=utf-8 src/test/shell/bazel/starlark_repository_test/shard_4_of_6/test_attempts/attempt_1.log"));
182182
Ok(())
183183
})
184184
}

0 commit comments

Comments
 (0)