diff options
author | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-07 18:29:20 +0300 |
---|---|---|
committer | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-07 18:29:20 +0300 |
commit | b57c89e61b60743b0f2b6bd6c6bf4e4b80fb505c (patch) | |
tree | 4ad0c52b1de59bc08a6f8415dec25496915f3827 /curl.sh | |
parent | a1cea3033fa87b91d9f7d95aca63373f92e290dc (diff) | |
download | wmf-ci-arch-b57c89e61b60743b0f2b6bd6c6bf4e4b80fb505c.tar.gz |
Add: helper scripts to use CI component API
Diffstat (limited to 'curl.sh')
-rwxr-xr-x | curl.sh | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -0,0 +1,34 @@ +#!/bin/sh + +set -eu + +runcurl() { + ./mktoken > token + curl -s -H "Authorization: Bearer $(cat token)" "$@" +} + +cmd="$1" +shift 1 + +case "$cmd" in + update-repo) + runcurl -X POST --data-binary @hithere.json \ + -H "Content-Type: application/json" \ + https://wmf2-vcsworker.vm.liw.fi/updaterepo + ;; + + upload-blob) + runcurl -X PUT --data-binary @"$1" \ + -H "Content-Type: application/octet-stream" \ + https://wmf2-artifacts.vm.liw.fi/blobs/"$2" + ;; + + get-blob) + runcurl -X GET https://wmf2-artifacts.vm.liw.fi/blobs/"$1" + ;; + + *) + echo "eek" 1>&2 + exit 1 + ;; +esac |