-
Notifications
You must be signed in to change notification settings - Fork 723
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
Unable to download artifacts uploaded with upload-artifact@v4 #1790
Comments
I have a working patch... can't say it was easy... |
gsmet
added a commit
to hub4j-test-org/GHWorkflowRunTest
that referenced
this issue
Feb 12, 2024
gsmet
added a commit
to gsmet/github-api
that referenced
this issue
Feb 13, 2024
The artifacts upload by actions/upload-artifact@v4 are hosted on a new infrastructure which has several constraints: - we will have an error if we push the Authorization header to it, which was the case when using the Java 11 HttpClient (and is considered a bad practice so it is good to have fixed it anyway) - the host name is dynamic so our test infrastructure was having problems with proxying the request All these problems are sorted out by this pull request and we are now testing an artifact uploaded by v3 and one uploaded by v4. Fixes hub4j#1790
11 tasks
We are seeing a similar issue but in our case it's not related to the Reproducer
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.kohsuke:github-api:1.319
import org.kohsuke.github.*;
import org.kohsuke.github.function.InputStreamFunction;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
private static String token;
private static String thisRepo;
private static String runId;
private static InputStreamFunction<String> getLogArchiveInputStreamFunction(String... filters) {
return (is) -> {
StringBuilder stringBuilder = new StringBuilder();
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append(System.lineSeparator());
}
}
return stringBuilder.toString();
};
}
public static void main(String... args) {
thisRepo = args[0];
runId = args[1];
if (args.length > 2) {
token = args[2];
}
else {
token = System.getenv("GITHUB_TOKEN");
}
try {
final GitHub github = new GitHubBuilder().withOAuthToken(token).build();
final GHRepository workflowRepository = github.getRepository(thisRepo);
GHWorkflowRun workflowRun = workflowRepository.getWorkflowRun(Long.parseLong(runId));
PagedIterable<GHWorkflowJob> listJobs = workflowRun.listJobs();
listJobs.forEach(job -> {
try {
System.out.println(job.downloadLogs(getLogArchiveInputStreamFunction()));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
} 2.Run with:
|
@zakkak yeah, I checked the URLs and they are using the same infrastructure as |
bitwiseman
added a commit
that referenced
this issue
Mar 9, 2024
* Add support for artifacts uploaded by actions/upload-artifact@v4 The artifacts upload by actions/upload-artifact@v4 are hosted on a new infrastructure which has several constraints: - we will have an error if we push the Authorization header to it, which was the case when using the Java 11 HttpClient (and is considered a bad practice so it is good to have fixed it anyway) - the host name is dynamic so our test infrastructure was having problems with proxying the request All these problems are sorted out by this pull request and we are now testing an artifact uploaded by v3 and one uploaded by v4. Fixes #1790 * Add support for Git longpaths on Windows CI * Update src/main/java11/org/kohsuke/github/extras/HttpClientGitHubConnector.java * Move redirect handling to GitHubClient * WIP * Make snapshot file names based on mapping file information * For redirect host is only same if ports are also same * Delete .vscode/launch.json * Verify removal of header when redirecting --------- Co-authored-by: Liam Newman <bitwiseman@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GitHub published a new version of upload-artifact, v4: https://github.com/actions/upload-artifact .
It is supposed to be a lot better, most notably faster and more flexible.
I tried to use it and unfortunately, we hit an issue:
I stumbled upon arduino/report-size-deltas#83 which seems to indicate that we shouldn't send the
Authorization
header to the download URL.Unfortunately, my guess is that the Java HTTP Client is not flexible enough for that and is sending the
Authorization
header anyway.It's not possible to configure the redirect behavior at the request level either so that's a bit problematic.
I'm not completely sure how to solve this (or even if my diagnostic is the correct one...).
The text was updated successfully, but these errors were encountered: