summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-07-04 15:43:02 +0300
committerLars Wirzenius <liw@liw.fi>2018-07-04 15:43:02 +0300
commit5b3b5c5f8a724a124a572b6b05990d4588b2c705 (patch)
tree94fb06642f09f30a5f8fb8f733059a5a3a8f06e8
parent9c6a2c4640e5deab07750434eb3cc41df6b26088 (diff)
downloadick2-5b3b5c5f8a724a124a572b6b05990d4588b2c705.tar.gz
Add: icktool get-artifact subcommand
-rw-r--r--NEWS3
-rwxr-xr-xicktool15
2 files changed, 18 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 3450608..db02032 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,9 @@ Version 0.52.1+git, not yet released
* Icktool now looks for credentials using both the controller URL, and
the authentication URL.
+* Icktool can now download artifacts from the artifact store, with the
+ new `get-artifact` subcomand.
+
* The `archive: workspace` action now takes an optional `glob` field,
which is a list of Unix filename globs, for what to include in the
artifact. Also, optionally the field `name_from` can be used to
diff --git a/icktool b/icktool
index 39def14..5329fd2 100755
--- a/icktool
+++ b/icktool
@@ -148,6 +148,10 @@ class Icktool(cliapp.Application):
cmd = self._command(ShowLatestLogCommand)
cmd.execute(args)
+ def cmd_get_artifact(self, args):
+ cmd = self._command(GetArtifactCommand)
+ cmd.execute(args)
+
def _command(self, klass):
api = self._new_api()
token = self._new_token(api)
@@ -487,4 +491,15 @@ class ShowLatestLogCommand(Command):
return None
+class GetArtifactCommand(Command):
+
+ def execute(self, args):
+ if not args:
+ raise Exception('Must give blob id as argument')
+ blob_id = args[0]
+ path = '/blobs/{}'.format(blob_id)
+ blob = self.api.show_blob(path)
+ sys.stdout.buffer.write(blob)
+
+
Icktool(version=ick2.__version__).run()