Hi everyone,
Build artifacts for maas-ui
(the project for MAAS’s web interface) are now available from the Github API for every merged pull request from the date of this post. Please note that Github has a 90 day retention policy for artifacts.
The following example demonstrates finding and downloading an artifact for commit 13a14cfd378560c8d4b046efd4988a0263b7e74d.
Find the artifact download url
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/canonical-web-and-design/maas-ui/actions/artifacts | \
jq '.artifacts[] | select(.name | contains("maas-ui-13a14cfd378560c8d4b046efd4988a0263b7e74d"))'
Note that artifact names are always in the format maas-ui-${long-sha}
.
This will return an artifact metadata object:
{
"id": 37853703,
"node_id": "MDg6QXJ0aWZhY3QzNzg1MzcwMw==",
"name": "maas-ui-13a14cfd378560c8d4b046efd4988a0263b7e74d",
"size_in_bytes": 16242200,
"url": "https://api.github.com/repos/canonical-web-and-design/maas-ui/actions/artifacts/37853703",
"archive_download_url": "https://api.github.com/repos/canonical-web-and-design/maas-ui/actions/artifacts/37853703/zip",
"expired": false,
"created_at": "2021-01-28T23:49:14Z",
"updated_at": "2021-01-28T23:49:14Z",
"expires_at": "2021-04-28T23:49:02Z"
}
Downloading the artifact
To download the artifact, make a second request to archive_download_url
, with a personal github token (this must have repo read access), e.g.:
curl -v -u github-username:github-token \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/canonical-web-and-design/maas-ui/actions/artifacts/37853703/zip
The location
in the response header is the download URL for the archive. Note, this download url expires one minute after the request is made.
More details can be found in the artifacts API documentation, with examples of programmatic access.