-
Notifications
You must be signed in to change notification settings - Fork 336
Use azcopy for uploading large artifacts #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -883,6 +883,43 @@ namespace vcpkg | |
| return true; | ||
| } | ||
|
|
||
| bool azcopy_to_asset_cache(DiagnosticContext& context, | ||
| StringView raw_url, | ||
| const SanitizedUrl& sanitized_url, | ||
| const Path& file) | ||
| { | ||
| auto azcopy_cmd = Command{"azcopy"}; | ||
vicroms marked this conversation as resolved.
Show resolved
Hide resolved
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: We can't call @ras0219-msft points out that a potential way to reduce complexity here would be adding an explicit azcopy provider which moves the tool fetch up front like we do for the other binary caching backends e.g. awscli.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC I'm asked to make changes now.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| azcopy_cmd.string_arg("copy"); | ||
| azcopy_cmd.string_arg("--from-to").string_arg("LocalBlob"); | ||
| azcopy_cmd.string_arg("--log-level").string_arg("NONE"); | ||
| azcopy_cmd.string_arg(file); | ||
| azcopy_cmd.string_arg(raw_url.to_string()); | ||
|
|
||
| int code = 0; | ||
| auto res = cmd_execute_and_stream_lines(context, azcopy_cmd, [&code](StringView line) { | ||
| static constexpr StringLiteral response_marker = "RESPONSE "; | ||
vicroms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (line.starts_with(response_marker)) | ||
| { | ||
| code = std::strtol(line.data() + response_marker.size(), nullptr, 10); | ||
| } | ||
| }); | ||
|
|
||
| auto pres = res.get(); | ||
| if (!pres) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| if (*pres != 0) | ||
| { | ||
| context.report_error(msg::format( | ||
| msgAzcopyFailedToPutBlob, msg::exit_code = *pres, msg::url = sanitized_url, msg::value = code)); | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| std::string format_url_query(StringView base_url, View<std::string> query_params) | ||
| { | ||
| if (query_params.empty()) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.