Upload a new artifact
As a debusine user (identified with a token), I can upload an artifact with the debusine command line interface:
$ debusine create-artifact <category> --upload <file1> <file2> ...
result: success
message: "New artifact created in {api_url} in workspace {workspace_name} with id {artifact_id}."
artifact_id: 123
When I don't specify any target workspace, the artifact is uploaded to my default workspace. If my account is not associated to any default workspace, then the command fails with an error:
$ debusine create-artifact debian:dsc --upload pkg_1.0.dsc pkg_1.0.tar.gz
result: error
message: "You don't have any default workspace, please specify one explicitly with --workspace."
$ debusine create-artifact debian:dsc --workspace freexian-elts --upload pkg_1.0.dsc pkg_1.0.tar.gz
result: success
[...]
If I try to create an artifact in a workspace that doesn't exist, I get an error:
$ debusine create-artifact debian:dsc --workspace foobar [...]
result: error
message: "Workspace foobar doesn't exist"
To be able to pass metadata associated to the artifact, we have the --data $FILE
parameter to read YAML data from a textual file. If $FILE is "-", then the metadata is read from the standard input:
$ debusine create-artifact $CATEGORY --data - <<EOF
key: value
list:
- entry
- entry
EOF
[...]
Later when we have implemented access control, we can get a permission error too, when we try to create an artifact in a workspace where we don't have write permissions:
$ debusine create-artifact debian:dsc --workspace foobar [...]
result: error
message: "User {username} doesn't have the permission to create a new artifact in workspace foobar"
Internally, the debusine client makes the required calls to the HTTP API described in #61 (closed).