Comments (4)
There are quite a few articles saying that you can't download universal artifacts with a simple HTTP call, e.g.
- https://stackoverflow.com/questions/63058823/how-to-download-universal-artifacts-from-the-artifacts-ui
- https://developercommunity.visualstudio.com/t/download-universal-package-trough-api/495533
I did find this blog post which claims to know how to do it, and promises to explain all in a subsequent post but unfortunately hasn't written that one!
I'll try to investigate what artifacttool
does.
from azure-devops-rust-api.
I investigated what artifacttool
does. I installed Azure CLI and mitmproxy in CBL-Mariner Linux. I added the proxy certificate to the list of trusted certificates following these instructions.
openssl verify ~/.mitmproxy/mitmproxy-ca.pem
sudo cp ~/.mitmproxy/mitmproxy-ca.pem /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust
openssl verify ~/.mitmproxy/mitmproxy-ca.pem
After starting mitmproxy
or I prefer mitmweb
, setting HTTPS_PROXY
allows the az artifacts universal download
HTTP calls to be captured.
export HTTPS_PROXY=http://127.0.0.1:8080
If using the azure-devops-python-api, for the TLS connection to work, REQUESTS_CA_BUNDLE
also has to be set:
export REQUESTS_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt
I then wrote and ran this python get_package.py
:
from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint
from beeprint import pp
personal_access_token = ''
organization_url = 'https://dev.azure.com/myorg'
project = 'myproj'
feed_id = 'myfeed'
package_name = 'mypackage'
package_version = '0.1.7'
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)
upack = connection.clients.get_upack_api_client()
package_version = upack.get_package_version(feed_id, package_name, package_version, project)
pp(package_version)
packaging = connection.clients.get_upack_packaging_client()
package = packaging.get_package_metadata(feed_id, package_name, package_version, project)
pp(package)
Notice that there are two different clients. The second one is what is needed for downloading a universal package. I did not find it in the API specs. The first client is from this spec:
vsts-rest-api-specs\specification\artifactsPackageTypes\7.1\universal.json
"x-ms-vss-method": "GetPackageVersion"
GET "/{organization}/{project}/_apis/packaging/feeds/{feedId}/upack/packages/{packageName}/versions/{packageVersion}"
The HTTP call for get_package_metadata
is:
GET "/{organization}/{project}/_packaging/{feedId}/upack/packages/{packageName}/versions/{packageVersion}"
The URL is very similar, but no _apis
or feeds
, and a different json response:
{
"manifestId": "8BE335749F6313AC7BB4EFCC8025573BE63AEE791836D0B922D73972B1F9A33A01",
"packageSize": 5464585,
"superRootId": "DDEFB81F13FAE572147ECCD659A1969D42EC3B157C777C3CE96BB84AB62A8C5102",
"version": "0.1.7"
}
After this, there are a couple of service lookups, a package manifest get, a call to get a list of chunks per file in the package manifest, then calls to get all the chunks.
from azure-devops-rust-api.
Not sure... I'll do some investigation.
from azure-devops-rust-api.
@cataggar Interesting! And after getting the chunks, do you know the logic to reconstruct the files?
from azure-devops-rust-api.
Related Issues (20)
- Removing Option wrappers from `GitPullRequest` breaks pull request create HOT 1
- git::commits::get_changes(...) response parsing fails HOT 4
- Missing git operation get_vsts_info_by_remote_url
- Need better diagnostics when deserialization fails
- Failure parsing build list response
- date-time parameters are not formatted as RFC3339
- deserialize is failing in Distributed task due to null value in variableGroupProjectReferences HOT 2
- Extension deserialization fails due to flags fields HOT 3
- `release::releases::get_logs()` returns unprintable/garbled string HOT 3
- `git::items::list` `recursion_level` should be an enum rather than a String HOT 1
- Listing work item queries fails with a response parsing failure
- API mismatch with reality? HOT 10
- ADO_ORGANIZATION format? Run example: `cargo run --example build_list --features="build"` (A potentially dangerous Request.Path value was detected from the client ) HOT 5
- question: is there a way to trigger a rerun for a certain build? HOT 3
- auth-required set to true for feeds scoped to a public project which prevents unauthenticated download
- Add support for Azure DevOps throttling/rate limiting HOT 1
- Error in Return Type in Get Items Batch API Call HOT 1
- Cannot create a git push HOT 2
- support upload file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-devops-rust-api.