diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2021-03-23 08:31:35 +0000 |
---|---|---|
committer | Jan-Simon Möller <jsmoeller@linuxfoundation.org> | 2021-03-25 13:50:12 +0100 |
commit | 485ec385e7292e5953ffa1a88f9193bd7175da40 (patch) | |
tree | 10ed7e5ac5c1d7757435a6d8af4f738c0febe484 /utils | |
parent | d29d852f562fbe7f129c465a5ece7d6953b5fc33 (diff) |
SPEC-3414: Permit to use the bmeta helper without token
Allow to use utils/agl-publish.py without token for debugging and
verifying it works.
Change-Id: I2d752d3debf25ab1bb78fdd39c45bbd79ab1aedd
Bug-AGL: SPEC-3414
Signed-off-by: Corentin LABBE <clabbe@baylibre.com>
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/agl-publish.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/utils/agl-publish.py b/utils/agl-publish.py index a6b540b..b559566 100755 --- a/utils/agl-publish.py +++ b/utils/agl-publish.py @@ -7,8 +7,16 @@ import os import json import urllib -ptoken=os.environ["KCI_PUSH_TOKEN"] -utoken=os.environ["KCI_UPLOAD_TOKEN"] +if not "KCI_PUSH_TOKEN" in os.environ: + print("Missing env variable KCI_PUSH_TOKEN") + ptoken=None +else: + ptoken=os.environ["KCI_PUSH_TOKEN"] +if not "KCI_UPLOAD_TOKEN" in os.environ: + print("Missing env variable KCI_UPLOAD_TOKEN") + utoken=None +else: + utoken=os.environ["KCI_UPLOAD_TOKEN"] parser = argparse.ArgumentParser(description="AGL create bmeta", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--arch', action='store', help="arch of the build", required=True) @@ -48,9 +56,6 @@ with open(os.path.join(DIR_META, 'bmeta.json'), 'w') as json_file: def upload(): path = bmeta["file_server_resource"] - headers = { - 'Authorization': utoken, - } data = { 'path': path, } @@ -67,7 +72,12 @@ def upload(): url = urljoin(args.api, 'upload') print("DATA====================") print(data) - return 0 + if utoken is None: + print("No upload token, skipping upload") + return 0 + headers = { + 'Authorization': utoken, + } resp = requests.post(url, headers=headers, data=data, files=files) resp.raise_for_status() print(resp.reason) @@ -87,7 +97,9 @@ def publish_kernel(): }.items()} print("DATA====================") print(data) - return 0 + if ptoken is None: + print("No publish token, skipping publish") + return 0 headers = { 'Authorization': ptoken, 'Content-Type': 'application/json', |