-
Notifications
You must be signed in to change notification settings - Fork 231
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
getArtifactContentZip doesn't work for "resource.type": "PipelineArtifact" #432
Comments
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Should this be re-opened given that this is still an existing issue? The sample code seems to indicate this is a known limitation. This is unfortunate especially since PublishBuildArtifacts ado task is considered deprecated and pipeline artifact is recommended instead. Thanks. |
Hi @linsword13 reopening this since it's still actual. |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Still actual |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Still actual |
I currently use something like the following as a workaround (requires an extra roundtrip unfortunately): const buildApi = this.adoWebApi.getBuildApi();
const artifact = await buildApi.getArtifact(projectName, buildId, artifactName);
if (!artifact) {
throw new Error('...');
}
if (!artifact.resource?.downloadUrl) {
throw new Error('...');
}
const stream = (await buildApi.http.get(artifact.resource.downloadUrl)).message;
const jsZip = (await unzip(stream)).folder(artifactName); |
Thanks for the workaround! |
@anatolybolshakov this is still broken (using [email protected], doesn't look like BuildApi changed in 12.0.0). It's the same root cause as microsoft/azure-devops-extension-api#48 - |
@anatolybolshakov @max-zaytsev more pings to reopen this issue. Our current workaround is: // 🚨 HACK TIME 🚨
// ADO's APIs try to download pipeline artifacts using an API version that isn't supported
// by the artifact download endpoint.
// One way of getting around that is by temporarily removing the API version to force it to use
// a supported version. Woo!
// https://github.com/microsoft/azure-devops-node-api/issues/432
const buildApi: BuildApi = await connection.getBuildApi();
const originalCreateAcceptHeader = buildApi.createAcceptHeader;
buildApi.createAcceptHeader = (type: string): string => type;
const download = await buildApi.getArtifactContentZip(project, buildId, artifactName);
buildApi.createAcceptHeader = originalCreateAcceptHeader; which avoids the extra roundtrip in the other workaround. |
Folks are still hitting this. |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
I don't see any relevant commits here, so I'm going to go out on a limb and say that this is still broken. |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Yep, still broken. |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Surprise! Still broken. |
This issue has had no activity in 90 days. Please comment if it is not actually stale |
Looks like it's that time of year again. |
Environment
Node version: 14.15.5
Npm version: 6.14.11
OS and version: Microsoft Windows 10 Enterprise, Version 10.0.18363 Build 18363
azure-devops-node-api version: 10.2.1
Issue Description
IBuildApi.getArtifactContentZip does't work for artifact resource type: PipelineArtifact but it does for type: Container
Expected behaviour
I should be able to get zip from Build Artifacts and Pipeline Artifacts
Actual behaviour
In fiddler I'm getting 404 where the same url working correctly on Web using "Get Artifact URL and pasting to Browser".
Steps to reproduce
Logs
REQ
GET https://artprodsu6weu.artifacts.visualstudio.com/Ad2f735ff-1e43-4ce8-826b-9e3578951332/2a4e21b6-7b9c-47c3-9a4f-0430e7a2fec9/_apis/artifact/XXXXXXXXXXXXXXXXXXXX/content?format=zip HTTP/1.1
accept: application/zip;api-version=6.1-preview.5
user-agent: node-Build-api
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X-TFS-FedAuthRedirect: Suppress
Host: artprodsu6weu.artifacts.visualstudio.com
Connection: close
RESP
HTTP/1.1 404 Not Found
P3P: CP="CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOC CNT"
The text was updated successfully, but these errors were encountered: