Skip to content

Commit

Permalink
agent: Fix wrong content-type flag name. (#2131)
Browse files Browse the repository at this point in the history
Co-authored-by: Yun Peng <pcloudy@google.com>
  • Loading branch information
coeuvre and meteorcloudy authored Dec 2, 2024
1 parent 81735bd commit ff92ddf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions agent/src/artifact/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions agent/tests/artifact/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand All @@ -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(())
}
Expand Down Expand Up @@ -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(())
}
Expand Down Expand Up @@ -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(())
})
}

0 comments on commit ff92ddf

Please sign in to comment.