diff --git a/agent/src/artifact/upload.rs b/agent/src/artifact/upload.rs index 927ba8647f..e968e42626 100644 --- a/agent/src/artifact/upload.rs +++ b/agent/src/artifact/upload.rs @@ -419,11 +419,9 @@ impl Uploader { ) -> Result<()> { let artifact = artifact.display().to_string(); let mut args = vec!["artifact", "upload"]; - let ct_arg = content_type - .map(|ct| "--content_type=".to_owned() + ct) - .unwrap_or_default(); - if !ct_arg.is_empty() { - args.push(ct_arg.as_str()); + if let Some(content_type) = content_type { + args.push("--content-type"); + args.push(content_type); } args.push(artifact.as_str()); execute_command(dry, cwd, "buildkite-agent", &args) diff --git a/agent/tests/artifact/upload.rs b/agent/tests/artifact/upload.rs index 8a892c84e9..6d210c5ca3 100644 --- a/agent/tests/artifact/upload.rs +++ b/agent/tests/artifact/upload.rs @@ -19,7 +19,7 @@ fn test_logs_uploaded_to_buildkite() -> Result<()> { ]); cmd.assert() .success() - .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")); + .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")); Ok(()) } @@ -37,7 +37,7 @@ fn test_logs_uploaded_to_buildkite() -> Result<()> { ]); cmd.assert() .success() - .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")); + .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")); Ok(()) } @@ -139,7 +139,7 @@ fn test_logs_deduplicated() -> Result<()> { ]); cmd.assert() .success() - .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)); + .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)); Ok(()) } @@ -178,7 +178,7 @@ fn test_running_json_file() -> Result<()> { cmd.assert() .success() - .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")); + .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")); Ok(()) }) }